Microsoft KB Archive/147781: Difference between revisions
(importing KB archive) |
m (Text replacement - """ to """) |
||
Line 81: | Line 81: | ||
<p>NOTE: This is not a complete list. You should watch closely for different parameter data types when you convert code that makes an API call or supplies parameters to an API call.</p></li> | <p>NOTE: This is not a complete list. You should watch closely for different parameter data types when you convert code that makes an API call or supplies parameters to an API call.</p></li> | ||
<li><p>API function names are case-sensitive. This differs from the 16-bit API, which is not case-sensitive. For example, in a 16-bit API call, the following statements are equivalent:</p> | <li><p>API function names are case-sensitive. This differs from the 16-bit API, which is not case-sensitive. For example, in a 16-bit API call, the following statements are equivalent:</p> | ||
<pre class="codesample"> Declare Function GetVersion Lib | <pre class="codesample"> Declare Function GetVersion Lib "KERNEL" () as Long | ||
Declare Function gEtVeRsIoN Lib | Declare Function gEtVeRsIoN Lib "KERNEL" () as Long | ||
</pre> | </pre> | ||
<p>However, when converted to a 32-bit API, the following statements are not equivalent because the function names are case-sensitive:</p> | <p>However, when converted to a 32-bit API, the following statements are not equivalent because the function names are case-sensitive:</p> | ||
<pre class="codesample"> Declare Function GetVersion Lib | <pre class="codesample"> Declare Function GetVersion Lib "KERNEL32" () as Long | ||
Declare Function gEtVeRsIoN Lib | Declare Function gEtVeRsIoN Lib "KERNEL32" () as Long | ||
</pre></li> | </pre></li> | ||
<li>Some API functions have different versions to accommodate ANSI and UniCode strings. If an API listed in this article is limited to use under a specific operating system in 32-bit, it will be noted with the API function.</li></ul> | <li>Some API functions have different versions to accommodate ANSI and UniCode strings. If an API listed in this article is limited to use under a specific operating system in 32-bit, it will be noted with the API function.</li></ul> | ||
Line 105: | Line 105: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function BitBlt Lib | <pre class="codesample"> Declare Function BitBlt Lib "GDI" (ByVal hDestDC As Integer, _ | ||
ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As _ | ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As _ | ||
Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, _ | Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, _ | ||
Line 112: | Line 112: | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiBitBlt Lib | <pre class="codesample"> Declare Function apiBitBlt Lib "gdi32" Alias "BitBlt" (ByVal _ | ||
hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth _ | hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth _ | ||
As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal _ | As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal _ | ||
Line 120: | Line 120: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function CheckMenuItem Lib | <pre class="codesample"> Declare Function CheckMenuItem Lib "User" (ByVal hMenu As _ | ||
Integer, ByVal wIDCheckItem As Integer, ByVal wCheck As _ | Integer, ByVal wIDCheckItem As Integer, ByVal wCheck As _ | ||
Integer) As Integer | Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiCheckMenuItem Lib | <pre class="codesample"> Declare Function apiCheckMenuItem Lib "user32" Alias _ | ||
"CheckMenuItem" (ByVal hMenu As Long, ByVal wIDCheckItem _ | |||
As Long, ByVal wCheck As Long) As Long | As Long, ByVal wCheck As Long) As Long | ||
</pre> | </pre> | ||
NOTE: In Microsoft Access for Windows 95 version 7.0, you can use the SetMenuItem macro action to set the state of menu items (enabled or disabled, checked or unchecked) on a custom menu bar or the global menu bar for the active window. For more information about the SetMenuItem action, search the Help Index for | NOTE: In Microsoft Access for Windows 95 version 7.0, you can use the SetMenuItem macro action to set the state of menu items (enabled or disabled, checked or unchecked) on a custom menu bar or the global menu bar for the active window. For more information about the SetMenuItem action, search the Help Index for "SetMenuItem Action."<br /> | ||
<br /> | <br /> | ||
In Microsoft Access 97, you can use the SetMenuItem macro action only with custom menu bars and global menu bars created by using menu bar macros. The SetMenuItem action is included in Microsoft Access 97 for compatibility with earlier versions. To implement the same functionality with the CommandBars collection in Microsoft Access 97, use the Enabled and State properties of command bars in Visual Basic for Applications to enable or disable, check or uncheck items on menu bars, toolbars, and shortcut menus. For more information about these properties, search the Help Index for | In Microsoft Access 97, you can use the SetMenuItem macro action only with custom menu bars and global menu bars created by using menu bar macros. The SetMenuItem action is included in Microsoft Access 97 for compatibility with earlier versions. To implement the same functionality with the CommandBars collection in Microsoft Access 97, use the Enabled and State properties of command bars in Visual Basic for Applications to enable or disable, check or uncheck items on menu bars, toolbars, and shortcut menus. For more information about these properties, search the Help Index for "Enabled" or "State," or ask the Microsoft Access 97 Office Assistant. | ||
=== ChooseColor === | === ChooseColor === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function ChooseColor_API Lib | <pre class="codesample"> Declare Function ChooseColor_API Lib "COMMDLG.DLL" Alias _ | ||
"ChooseColor" (pCHOOSECOLOR As ChooseColor) As Integer | |||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
Line 151: | Line 151: | ||
End Type | End Type | ||
Declare Function apiChooseColor Lib | Declare Function apiChooseColor Lib "comdlg32.dll" Alias _ | ||
"ChooseColorA" (pChoosecolor As CHOOSECOLOR) As Long | |||
</pre> | </pre> | ||
NOTE: You can use the ChooseColor functionality of this API by using the Common Dialog ActiveX control included with the Microsoft Access Developer's Toolkit for Windows 95 and Microsoft Office 97 Developer Edition. | NOTE: You can use the ChooseColor functionality of this API by using the Common Dialog ActiveX control included with the Microsoft Access Developer's Toolkit for Windows 95 and Microsoft Office 97 Developer Edition. | ||
Line 158: | Line 158: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function CloseClipboard Lib | <pre class="codesample"> Declare Function CloseClipboard Lib "User" () As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiCloseClipboard Lib | <pre class="codesample"> Declare Function apiCloseClipboard Lib "user32" Alias _ | ||
"CloseClipboard" () As Long | |||
</pre> | </pre> | ||
=== CommDlgExtendedError === | === CommDlgExtendedError === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function CommDlgExtendedError Lib | <pre class="codesample"> Declare Function CommDlgExtendedError Lib "COMMDLG.DLL" () _ | ||
As Long | As Long | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiCommDlgExtendedError Lib | <pre class="codesample"> Declare Function apiCommDlgExtendedError Lib "comdlg32.dll" _ | ||
Alias | Alias "CommDlgExtendedError" () As Long | ||
</pre> | </pre> | ||
=== CopyFile === | === CopyFile === | ||
Line 182: | Line 182: | ||
<br /> | <br /> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiCopyFile Lib | <pre class="codesample"> Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _ | ||
(ByVal lpExistingFileName As String, ByVal lpNewFileName As _ | (ByVal lpExistingFileName As String, ByVal lpNewFileName As _ | ||
String, ByVal bFailIfExists As Long) As Long | String, ByVal bFailIfExists As Long) As Long | ||
Line 192: | Line 192: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Sub hmemcpy Lib | <pre class="codesample"> Declare Sub hmemcpy Lib "kernel" (hpvDest As Any, hpvSrc As _ | ||
Any, ByVal cbBytes As Long) | Any, ByVal cbBytes As Long) | ||
</pre> | </pre> | ||
Line 200: | Line 200: | ||
Global Const GHND = (GMEM_MOVEABLE Or GMEM_ZEROINIT) | Global Const GHND = (GMEM_MOVEABLE Or GMEM_ZEROINIT) | ||
Declare Sub CopyMemory Lib | Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _ | ||
(hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long) | (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long) | ||
</pre> | </pre> | ||
Line 206: | Line 206: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function CreateCompatibleBitmap Lib | <pre class="codesample"> Declare Function CreateCompatibleBitmap Lib "GDI" (ByVal _ | ||
hDC As Integer, ByVal nWidth As Integer, ByVal nHeight As _ | hDC As Integer, ByVal nWidth As Integer, ByVal nHeight As _ | ||
Integer) As Integer | Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiCreateCompatibleBitmap Lib | <pre class="codesample"> Declare Function apiCreateCompatibleBitmap Lib "gdi32" Alias _ | ||
"CreateCompatibleBitmap" (ByVal hdc As Long, ByVal nWidth As _ | |||
Long, ByVal nHeight As Long) As Long | Long, ByVal nHeight As Long) As Long | ||
</pre> | </pre> | ||
Line 218: | Line 218: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function CreateCompatibleDC Lib | <pre class="codesample"> Declare Function CreateCompatibleDC Lib "GDI" (ByVal hdc As _ | ||
Integer) As Integer | Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiCreateCompatibleDC Lib | <pre class="codesample"> Declare Function apiCreateCompatibleDC Lib "Gdi32" (ByVal hdc _ | ||
As Long) As Long | As Long) As Long | ||
</pre> | </pre> | ||
Line 228: | Line 228: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function DeleteDC Lib | <pre class="codesample"> Declare Function DeleteDC Lib "GDI" (ByVal hDC As Integer) _ | ||
As Integer | As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiDeleteDC Lib | <pre class="codesample"> Declare Function apiDeleteDC Lib "gdi32" Alias "DeleteDC" _ | ||
(ByVal hdc As Long) As Long | (ByVal hdc As Long) As Long | ||
</pre> | </pre> | ||
Line 238: | Line 238: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Sub DrawMenuBar Lib | <pre class="codesample"> Declare Sub DrawMenuBar Lib "User" (ByVal hWnd As Integer) | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiDrawMenuBar Lib | <pre class="codesample"> Declare Function apiDrawMenuBar Lib "user32" Alias _ | ||
"DrawMenuBar" (ByVal hwnd As Long) As Long | |||
</pre> | </pre> | ||
=== EmptyClipboard === | === EmptyClipboard === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function EmptyClipboard Lib | <pre class="codesample"> Declare Function EmptyClipboard Lib "User" () As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiEmptyClipboard Lib | <pre class="codesample"> Declare Function apiEmptyClipboard Lib "user32" Alias _ | ||
"EmptyClipboard" () As Long | |||
</pre> | </pre> | ||
=== EnableMenuItem === | === EnableMenuItem === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function EnableMenuItem Lib | <pre class="codesample"> Declare Function EnableMenuItem Lib "User" (ByVal hMenu As _ | ||
Integer, ByVal wIDEnableItem As Integer, ByVal wEnable _ | Integer, ByVal wIDEnableItem As Integer, ByVal wEnable _ | ||
As Integer) As Integer | As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiEnableMenuItem Lib | <pre class="codesample"> Declare Function apiEnableMenuItem Lib "user32" Alias _ | ||
"EnableMenuItem" (ByVal hMenu As Long, ByVal wIDEnableItem _ | |||
As Long, ByVal wEnable As Long) As Long | As Long, ByVal wEnable As Long) As Long | ||
</pre> | </pre> | ||
Line 268: | Line 268: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function ExitWindows Lib | <pre class="codesample"> Declare Function ExitWindows Lib "User" (ByVal dwReturnCode _ | ||
As Long, ByVal wReserved As Integer) As Integer | As Long, ByVal wReserved As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiExitWindows Lib | <pre class="codesample"> Declare Function apiExitWindows Lib "user32" Alias _ | ||
"ExitWindows" (ByVal dwReserved As Long, ByVal uReturnCode _ | |||
As Long) As Long | As Long) As Long | ||
</pre> | </pre> | ||
Line 279: | Line 279: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function FindExecutable Lib | <pre class="codesample"> Declare Function FindExecutable Lib "Shell" (ByVal _ | ||
lpszFile As String, ByVal lpszDir As String, ByVal _ | lpszFile As String, ByVal lpszDir As String, ByVal _ | ||
lpszResult As String) As Integer | lpszResult As String) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiFindExecutable Lib | <pre class="codesample"> Declare Function apiFindExecutable Lib "shell32.dll" Alias _ | ||
"FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory _ | |||
As String, ByVal lpResult As String) As Long | As String, ByVal lpResult As String) As Long | ||
</pre> | </pre> | ||
Line 291: | Line 291: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function FindWindow Lib | <pre class="codesample"> Declare Function FindWindow Lib "user"(ByVal lpclassname As _ | ||
Any, ByVal lpCaption As Any) As Integer | Any, ByVal lpCaption As Any) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiFindWindow Lib | <pre class="codesample"> Declare Function apiFindWindow Lib "User32" Alias "FindWindowA" _ | ||
(ByVal lpclassname As Any, ByVal lpCaption As Any) as Long | (ByVal lpclassname As Any, ByVal lpCaption As Any) as Long | ||
</pre> | </pre> | ||
Line 301: | Line 301: | ||
16-bit: | 16-bit: | ||
<pre class="codesample">Declare Function fRead Lib | <pre class="codesample">Declare Function fRead Lib "kernel" Alias "lread" (ByVal _ | ||
hFile As Integer, ByVal lpBuff As Long, ByVal nBuff _ | hFile As Integer, ByVal lpBuff As Long, ByVal nBuff _ | ||
As Integer) As Long | As Integer) As Long | ||
Line 312: | Line 312: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function fWrite Lib | <pre class="codesample"> Declare Function fWrite Lib "kernel" Alias "_lwrite" (ByVal _ | ||
hFile As Integer, ByVal lpBuff As Long, ByVal nBuff As Integer) _ | hFile As Integer, ByVal lpBuff As Long, ByVal nBuff As Integer) _ | ||
As Long | As Long | ||
Line 323: | Line 323: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetActiveWindow Lib | <pre class="codesample"> Declare Function GetActiveWindow Lib "User" () As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetActiveWindow Lib | <pre class="codesample"> Declare Function apiGetActiveWindow Lib "user32" Alias _ | ||
"GetActiveWindow" () As Long | |||
</pre> | </pre> | ||
=== GetClassName === | === GetClassName === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetClassName Lib | <pre class="codesample"> Declare Function GetClassName Lib "User" (ByVal hWnd _ | ||
As Integer, ByVal lpClassName As String, ByVal nMaxCount _ | As Integer, ByVal lpClassName As String, ByVal nMaxCount _ | ||
As Integer) As Integer | As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetClassName Lib | <pre class="codesample"> Declare Function apiGetClassName Lib "user32" Alias _ | ||
"GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName _ | |||
As String, ByVal nMaxCount As Long) As Long | As String, ByVal nMaxCount As Long) As Long | ||
</pre> | </pre> | ||
Line 344: | Line 344: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetClipboardData Lib | <pre class="codesample"> Declare Function GetClipboardData Lib "User" (ByVal _ | ||
wFormat As Integer) As Integer | wFormat As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetClipboardData Lib | <pre class="codesample"> Declare Function apiGetClipboardData Lib "user32" Alias _ | ||
"GetClipboardDataA" (ByVal wFormat As Long) As Long | |||
</pre> | </pre> | ||
=== GetCursorPos === | === GetCursorPos === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Sub GetCursorPos Lib | <pre class="codesample"> Declare Sub GetCursorPos Lib "User" (lpPoint As POINTAPI) | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
Line 362: | Line 362: | ||
End Type | End Type | ||
Declare Sub apiGetCursorPos Lib | Declare Sub apiGetCursorPos Lib "User32" (lpPoint _ | ||
As POINTAPI) | As POINTAPI) | ||
</pre> | </pre> | ||
Line 368: | Line 368: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetDC Lib | <pre class="codesample"> Declare Function GetDC Lib "User" (ByVal hWnd As Integer) _ | ||
As Integer | As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetDC Lib | <pre class="codesample"> Declare Function apiGetDC Lib "user32" Alias "GetDC" (ByVal _ | ||
hwnd As Long) As Long | hwnd As Long) As Long | ||
</pre> | </pre> | ||
Line 378: | Line 378: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetDesktopWindow Lib | <pre class="codesample"> Declare Function GetDesktopWindow Lib "User" () As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetDesktopWindow Lib | <pre class="codesample"> Declare Function apiGetDesktopWindow Lib "user32" Alias _ | ||
"GetDesktopWindow" () As Long | |||
</pre> | </pre> | ||
NOTE: You can also use GetWindow to perform the same function. | NOTE: You can also use GetWindow to perform the same function. | ||
Line 388: | Line 388: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetDeviceCaps Lib | <pre class="codesample"> Declare Function GetDeviceCaps Lib "GDI" (ByVal hDC _ | ||
As Integer, ByVal nIndex As Integer) As Integer | As Integer, ByVal nIndex As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetDeviceCaps Lib | <pre class="codesample"> Declare Function apiGetDeviceCaps Lib "gdi32" Alias _ | ||
"GetDeviceCaps" (ByVal hdc As Long, ByVal nIndex As Long) _ | |||
As Long | As Long | ||
</pre> | </pre> | ||
Line 399: | Line 399: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetDriveType Lib | <pre class="codesample"> Declare Function GetDriveType Lib "Kernel" (ByVal nDrive _ | ||
As Integer) As Integer | As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetDriveType Lib | <pre class="codesample"> Declare Function apiGetDriveType Lib "kernel32" Alias _ | ||
"GetDriveTypeA" (ByVal nDrive As String) As Long | |||
</pre> | </pre> | ||
=== GetFileVersionInfo === | === GetFileVersionInfo === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetFileVersionInfo Lib | <pre class="codesample"> Declare Function GetFileVersionInfo Lib "VER.DLL" _ | ||
(ByVal lpszFileName As String, ByVal lpdwHandle As Long, _ | (ByVal lpszFileName As String, ByVal lpdwHandle As Long, _ | ||
ByVal cbbuf As Long, ByVal lpvdata As String) As Integer | ByVal cbbuf As Long, ByVal lpvdata As String) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetFileVersionInfo Lib | <pre class="codesample"> Declare Function apiGetFileVersionInfo Lib "version.dll" _ | ||
Alias | Alias "GetFileVersionInfoA" (ByVal lptstrFilename As _ | ||
String, ByVal dwHandle As Long, ByVal dwLen As Long, _ | String, ByVal dwHandle As Long, ByVal dwLen As Long, _ | ||
lpData As Any) As Long | lpData As Any) As Long | ||
Line 422: | Line 422: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetFileVersionInfoSize Lib | <pre class="codesample"> Declare Function GetFileVersionInfoSize Lib "VER.DLL" _ | ||
(ByVal lpszFileName As String, lpdwHandle As Long) As Long | (ByVal lpszFileName As String, lpdwHandle As Long) As Long | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetFileVersionInfoSize Lib _ | <pre class="codesample"> Declare Function apiGetFileVersionInfoSize Lib _ | ||
"version.dll" Alias "GetFileVersionInfoSizeA" _ | |||
(ByVal lptstrFilename As String, lpdwHandle As Long) As Long | (ByVal lptstrFilename As String, lpdwHandle As Long) As Long | ||
</pre> | </pre> | ||
Line 433: | Line 433: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetKeyState Lib | <pre class="codesample"> Declare Function GetKeyState Lib "User" (ByVal nVirtKey _ | ||
As Integer) As Integer | As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetKeyState Lib | <pre class="codesample"> Declare Function apiGetKeyState Lib "user32" Alias _ | ||
"GetKeyState" (ByVal nVirtKey As Long) As Integer | |||
</pre> | </pre> | ||
=== GetMenu === | === GetMenu === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetMenu Lib | <pre class="codesample"> Declare Function GetMenu Lib "User" (ByVal hWnd As _ | ||
Integer) As Integer | Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetMenu Lib | <pre class="codesample"> Declare Function apiGetMenu Lib "user32" Alias "GetMenu" _ | ||
(ByVal hwnd As Long) As Long | (ByVal hwnd As Long) As Long | ||
</pre> | </pre> | ||
Line 453: | Line 453: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetMenuState Lib | <pre class="codesample"> Declare Function GetMenuState Lib "User" (ByVal hMenu _ | ||
As Integer, ByVal wId As Integer, ByVal wFlags As _ | As Integer, ByVal wId As Integer, ByVal wFlags As _ | ||
Integer) As Integer | Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetMenuState Lib | <pre class="codesample"> Declare Function apiGetMenuState Lib "user32" Alias _ | ||
"GetMenuState" (ByVal hMenu As Long, ByVal wID As Long, _ | |||
ByVal wFlags As Long) As Long | ByVal wFlags As Long) As Long | ||
</pre> | </pre> | ||
Line 465: | Line 465: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetModuleFileName Lib | <pre class="codesample"> Declare Function GetModuleFileName Lib "Kernel" (ByVal _ | ||
hModule As Integer, ByVal lpFilename As String, ByVal _ | hModule As Integer, ByVal lpFilename As String, ByVal _ | ||
nSize As Integer) As Integer | nSize As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetModuleFileName Lib | <pre class="codesample"> Declare Function apiGetModuleFileName Lib "kernel32" Alias _ | ||
"GetModuleFileNameA" (ByVal hModule As Long, ByVal _ | |||
lpFileName As String, ByVal nSize As Long) As Long | lpFileName As String, ByVal nSize As Long) As Long | ||
</pre> | </pre> | ||
Line 477: | Line 477: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetModuleHandle Lib | <pre class="codesample"> Declare Function GetModuleHandle Lib "Kernel" (ByVal _ | ||
lpModuleName As String) As Integer | lpModuleName As String) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetModuleHandle Lib | <pre class="codesample"> Declare Function apiGetModuleHandle Lib "kernel32" Alias _ | ||
"GetModuleHandleA" (ByVal lpModuleName As String) As Long | |||
</pre> | </pre> | ||
=== GetModuleUsage === | === GetModuleUsage === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetModuleUsage Lib | <pre class="codesample"> Declare Function GetModuleUsage Lib "Kernel" (ByVal _ | ||
hModule As Integer) As Integer | hModule As Integer) As Integer | ||
</pre> | </pre> | ||
Line 496: | Line 496: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetOpenFileName Lib | <pre class="codesample"> Declare Function GetOpenFileName Lib "COMMDLG.DLL" _ | ||
(OPENFILENAME As tagOPENFILENAME) As Integer | (OPENFILENAME As tagOPENFILENAME) As Integer | ||
</pre> | </pre> | ||
Line 523: | Line 523: | ||
End Type | End Type | ||
Declare Function apiGetOpenFileName Lib | Declare Function apiGetOpenFileName Lib "comdlg32.dll" _ | ||
Alias | Alias "GetOpenFileNameA" (OPENFILENAME as tagOPENFILENAME) _ | ||
As Long | As Long | ||
</pre> | </pre> | ||
Line 530: | Line 530: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetParent Lib | <pre class="codesample"> Declare Function GetParent Lib "User" (ByVal hWnd As _ | ||
Integer) As Integer | Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetParent Lib | <pre class="codesample"> Declare Function apiGetParent Lib "user32" Alias _ | ||
"GetParent" (ByVal hwnd As Long) As Long | |||
</pre> | </pre> | ||
=== GetPrivateProfileString === | === GetPrivateProfileString === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetPrivateProfileString Lib | <pre class="codesample"> Declare Function GetPrivateProfileString Lib "Kernel" _ | ||
(ByVal lpApplicationName As String, ByVal lpKeyName As _ | (ByVal lpApplicationName As String, ByVal lpKeyName As _ | ||
Any, ByVal lpDefault As String, ByVal lpReturnedString As _ | Any, ByVal lpDefault As String, ByVal lpReturnedString As _ | ||
Line 547: | Line 547: | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetPrivateProfileString Lib | <pre class="codesample"> Declare Function apiGetPrivateProfileString Lib "kernel32" _ | ||
Alias | Alias "GetPrivateProfileStringA" (ByVal lpApplicationName _ | ||
As String, ByVal lpKeyName As Any, ByVal lpDefault As _ | As String, ByVal lpKeyName As Any, ByVal lpDefault As _ | ||
String, ByVal lpReturnedString As String, ByVal nSize As _ | String, ByVal lpReturnedString As String, ByVal nSize As _ | ||
Line 556: | Line 556: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetSaveFileName Lib | <pre class="codesample"> Declare Function GetSaveFileName Lib "COMMDLG.DLL" _ | ||
(OPENFILENAME As tagOPENFILENAME) As Integer | (OPENFILENAME As tagOPENFILENAME) As Integer | ||
</pre> | </pre> | ||
Line 583: | Line 583: | ||
End Type | End Type | ||
Declare Function apiGetSaveFileName Lib | Declare Function apiGetSaveFileName Lib "comdlg32.dll" _ | ||
Alias | Alias "GetSaveFileNameA" (pOpenfilename as OPENFILENAME) _ | ||
As Long | As Long | ||
</pre> | </pre> | ||
Line 591: | Line 591: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetSubMenu Lib | <pre class="codesample"> Declare Function GetSubMenu Lib "User" (ByVal hMenu _ | ||
As Integer, ByVal nPos As Integer) As Integer | As Integer, ByVal nPos As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetSubMenu Lib | <pre class="codesample"> Declare Function apiGetSubMenu Lib "user32" Alias _ | ||
"GetSubMenu" (ByVal hMenu As Long, ByVal nPos As Long) _ | |||
As Long | As Long | ||
</pre> | </pre> | ||
Line 602: | Line 602: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetSystemDirectory Lib | <pre class="codesample"> Declare Function GetSystemDirectory Lib "Kernel" _ | ||
(ByVal lpBuffer As String, ByVal nSize As Integer) As _ | (ByVal lpBuffer As String, ByVal nSize As Integer) As _ | ||
Integer | Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetSystemDirectory Lib | <pre class="codesample"> Declare Function apiGetSystemDirectory Lib "kernel32" _ | ||
Alias | Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, _ | ||
ByVal nSize As Long) As Long | ByVal nSize As Long) As Long | ||
</pre> | </pre> | ||
Line 614: | Line 614: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetSystemMenu Lib | <pre class="codesample"> Declare Function GetSystemMenu Lib "user" (ByVal _ | ||
hWnd As Integer, ByVal flag As Integer) As Integer | hWnd As Integer, ByVal flag As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetSystemMenu Lib | <pre class="codesample"> Declare Function apiGetSystemMenu Lib "user32" Alias _ | ||
"GetSystemMenu" (ByVal hWnd As Long, ByVal flag As Long) _ | |||
As Long | As Long | ||
</pre> | </pre> | ||
Line 625: | Line 625: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetSystemMetrics Lib | <pre class="codesample"> Declare Function GetSystemMetrics Lib "User" (ByVal _ | ||
nIndex As Integer) As Integer | nIndex As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetSystemMetrics Lib | <pre class="codesample"> Declare Function apiGetSystemMetrics Lib "user32" Alias _ | ||
"GetSystemMetrics" (ByVal nIndex As Long) As Long | |||
</pre> | </pre> | ||
=== GetVersion === | === GetVersion === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetVersion Lib | <pre class="codesample"> Declare Function GetVersion Lib "Kernel" () As Long | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetVersion Lib | <pre class="codesample"> Declare Function apiGetVersion Lib "kernel32" Alias _ | ||
"GetVersion" () As Long | |||
</pre> | </pre> | ||
=== GetWindow === | === GetWindow === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetWindow Lib | <pre class="codesample"> Declare Function GetWindow Lib "User" (ByVal hWnd As _ | ||
Integer, ByVal wCmd As Integer) As Integer | Integer, ByVal wCmd As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetWindow Lib | <pre class="codesample"> Declare Function apiGetWindow Lib "user32" Alias _ | ||
"GetWindow" (ByVal hwnd As Long, ByVal wCmd As Long) As Long | |||
</pre> | </pre> | ||
=== GetWindowLong === | === GetWindowLong === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetWindowLong Lib | <pre class="codesample"> Declare Function GetWindowLong Lib "User" (ByVal hWnd _ | ||
As Integer, ByVal nIndex As Integer) As Long | As Integer, ByVal nIndex As Integer) As Long | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetWindowLong Lib | <pre class="codesample"> Declare Function apiGetWindowLong Lib "user32" Alias _ | ||
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As _ | |||
Long) As Long | Long) As Long | ||
</pre> | </pre> | ||
Line 665: | Line 665: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Sub GetWindowRect Lib | <pre class="codesample"> Declare Sub GetWindowRect Lib "GDI" (ByVal hWnd As _ | ||
Integer, lpRect As RECT) | Integer, lpRect As RECT) | ||
</pre> | </pre> | ||
Line 676: | Line 676: | ||
End Type | End Type | ||
Declare Function apiGetWindowRect Lib | Declare Function apiGetWindowRect Lib "user32" Alias _ | ||
"GetWindowRect" (ByVal hwnd As Long, lpRect As RECT_Type) _ | |||
As Long | As Long | ||
</pre> | </pre> | ||
Line 683: | Line 683: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetWindowText Lib | <pre class="codesample"> Declare Function GetWindowText Lib "User" (ByVal hWnd As _ | ||
Integer, ByVal lpString As String, ByVal aint As Integer) As _ | Integer, ByVal lpString As String, ByVal aint As Integer) As _ | ||
Integer | Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetWindowText Lib | <pre class="codesample"> Declare Function apiGetWindowText Lib "user32" Alias _ | ||
"GetWindowTextA" (ByVal hwnd As Long, ByVal lpString _ | |||
As String, ByVal cch As Long) As Long | As String, ByVal cch As Long) As Long | ||
</pre> | </pre> | ||
Line 695: | Line 695: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetWindowWord Lib | <pre class="codesample"> Declare Function GetWindowWord Lib "User" (ByVal _ | ||
hWnd As Integer, ByVal nIndex As Integer) As Integer | hWnd As Integer, ByVal nIndex As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetWindowWord Lib | <pre class="codesample"> Declare Function apiGetWindowWord Lib "user32" Alias _ | ||
"GetWindowWord" (ByVal hwnd As Long, ByVal nIndex As _ | |||
Long) As Integer | Long) As Integer | ||
</pre> | </pre> | ||
Line 706: | Line 706: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GetWindowsDirectory Lib | <pre class="codesample"> Declare Function GetWindowsDirectory Lib "Kernel" _ | ||
(ByVal lpbuffer As String, ByVal nsize As Integer) As Integer | (ByVal lpbuffer As String, ByVal nsize As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGetWindowsDirectory Lib _ | <pre class="codesample"> Declare Function apiGetWindowsDirectory Lib _ | ||
"Kernel32" Alias "GetWindowsDirectoryA" (ByVal _ | |||
lpbuffer As String, ByVal nsize As Long) As Long | lpbuffer As String, ByVal nsize As Long) As Long | ||
</pre> | </pre> | ||
Line 717: | Line 717: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GlobalAlloc Lib | <pre class="codesample"> Declare Function GlobalAlloc Lib "Kernel" (ByVal _ | ||
wFlags As Integer, ByVal dwBytes As Long) As Integer | wFlags As Integer, ByVal dwBytes As Long) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGlobalAlloc Lib | <pre class="codesample"> Declare Function apiGlobalAlloc Lib "kernel32" Alias _ | ||
"GlobalAlloc" (ByVal wFlags As Long, ByVal dwBytes _ | |||
As Long) As Long | As Long) As Long | ||
</pre> | </pre> | ||
Line 728: | Line 728: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GlobalFree Lib | <pre class="codesample"> Declare Function GlobalFree Lib "Kernel" (ByVal hMem _ | ||
As Integer) As Integer | As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGlobalFree Lib | <pre class="codesample"> Declare Function apiGlobalFree Lib "kernel32" Alias _ | ||
"GlobalFree" (ByVal hMem As Long) As Long | |||
</pre> | </pre> | ||
=== GlobalLock === | === GlobalLock === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GlobalLock Lib | <pre class="codesample"> Declare Function GlobalLock Lib "Kernel" (ByVal hMem _ | ||
As Integer) As Long | As Integer) As Long | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGlobalLock Lib | <pre class="codesample"> Declare Function apiGlobalLock Lib "kernel32" Alias _ | ||
"GlobalLock" (ByVal hMem As Long) As Long | |||
</pre> | </pre> | ||
=== GlobalSize === | === GlobalSize === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GlobalSize Lib | <pre class="codesample"> Declare Function GlobalSize Lib "Kernel" (ByVal hMem _ | ||
As Integer) As Long | As Integer) As Long | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGlobalSize Lib | <pre class="codesample"> Declare Function apiGlobalSize Lib "kernel32" Alias _ | ||
"GlobalSize" (ByVal hMem As Long) As Long | |||
</pre> | </pre> | ||
=== GlobalUnlock === | === GlobalUnlock === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function GlobalUnlock Lib | <pre class="codesample"> Declare Function GlobalUnlock Lib "Kernel" (ByVal _ | ||
hMem As Integer) As Integer | hMem As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiGlobalUnlock Lib | <pre class="codesample"> Declare Function apiGlobalUnlock Lib "kernel32" Alias _ | ||
"GlobalUnlock" (ByVal hMem As Long) As Long | |||
</pre> | </pre> | ||
=== hmemcpy === | === hmemcpy === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Sub hmemcpy Lib | <pre class="codesample"> Declare Sub hmemcpy Lib "kernel" (hpvDest As Any, _ | ||
hpvSrc As Any, ByVal cbBytes As Long) | hpvSrc As Any, ByVal cbBytes As Long) | ||
</pre> | </pre> | ||
Line 778: | Line 778: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function IsIconic Lib | <pre class="codesample"> Declare Function IsIconic Lib "User" (ByVal hWnd As _ | ||
Integer) As Integer | Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiIsIconic Lib | <pre class="codesample"> Declare Function apiIsIconic Lib "user32" Alias _ | ||
"IsIconic" (ByVal hwnd As Long) As Long | |||
</pre> | </pre> | ||
=== IsWindowVisible === | === IsWindowVisible === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function IsWindowVisible Lib | <pre class="codesample"> Declare Function IsWindowVisible Lib "User" (ByVal _ | ||
hWnd As Integer) As Integer | hWnd As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiIsWindowVisible Lib | <pre class="codesample"> Declare Function apiIsWindowVisible Lib "user32" Alias _ | ||
"IsWindowVisible" (ByVal hwnd As Long) As Long | |||
</pre> | </pre> | ||
=== IsZoomed === | === IsZoomed === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function IsZoomed Lib | <pre class="codesample"> Declare Function IsZoomed Lib "User" (ByVal hWnd As _ | ||
Integer) As Integer | Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiIsZoomed Lib | <pre class="codesample"> Declare Function apiIsZoomed Lib "user32" Alias _ | ||
"IsZoomed" (ByVal hwnd As Long) As Long | |||
</pre> | </pre> | ||
=== lstrcpy === | === lstrcpy === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function lstrcpy Lib | <pre class="codesample"> Declare Function lstrcpy Lib "Kernel" (ByVal lpString1 As _ | ||
Any, ByVal lpString2 As Any) As Long | Any, ByVal lpString2 As Any) As Long | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apilstrcpy Lib | <pre class="codesample"> Declare Function apilstrcpy Lib "kernel32" Alias "lstrcpyA" _ | ||
(ByVal lpString1 As Any, ByVal lpString2 As Any) As Long | (ByVal lpString1 As Any, ByVal lpString2 As Any) As Long | ||
</pre> | </pre> | ||
Line 818: | Line 818: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function NetWkstaGetInfo Lib | <pre class="codesample"> Declare Function NetWkstaGetInfo Lib "NetAPI.DLL" _ | ||
(ByVal lServer As Long, ByVal sLevel As Integer, _ | (ByVal lServer As Long, ByVal sLevel As Integer, _ | ||
ByVal pbBuffer As Long, ByVal cbBuffer As Integer, _ | ByVal pbBuffer As Long, ByVal cbBuffer As Integer, _ | ||
Line 824: | Line 824: | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiNetWkstaGetInfo Lib | <pre class="codesample"> Declare Function apiNetWkstaGetInfo Lib "NetAPI32.dll"_ | ||
Alias NetWkstaGetInfo (ByVal lServer as Integer, ByVal _ | Alias NetWkstaGetInfo (ByVal lServer as Integer, ByVal _ | ||
sLevel as Integer, ByVal pbBuffer as Long, cbBuffer as _ | sLevel as Integer, ByVal pbBuffer as Long, cbBuffer as _ | ||
Line 835: | Line 835: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function OpenClipboard Lib | <pre class="codesample"> Declare Function OpenClipboard Lib "User" (ByVal _ | ||
hWnd As Integer) As Integer | hWnd As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiOpenClipboard Lib | <pre class="codesample"> Declare Function apiOpenClipboard Lib "user32" Alias _ | ||
"OpenClipboard" (ByVal hwnd As Long) As Long | |||
</pre> | </pre> | ||
=== Playsound === | === Playsound === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function sndplaysound Lib | <pre class="codesample"> Declare Function sndplaysound Lib "mmsystem" (ByVal _ | ||
filename as String, ByVal snd_async as Integer) As Integer | filename as String, ByVal snd_async as Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apisndPlaySound Lib | <pre class="codesample"> Declare Function apisndPlaySound Lib "winmm" Alias _ | ||
"sndPlaySoundA" (ByVal filename As String, ByVal snd_async _ | |||
As Long) As Long | As Long) As Long | ||
</pre> | </pre> | ||
Line 856: | Line 856: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function ReleaseDC Lib | <pre class="codesample"> Declare Function ReleaseDC Lib "User" (ByVal hWnd _ | ||
As Integer, ByVal hDC As Integer) As Integer | As Integer, ByVal hDC As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiReleaseDC Lib | <pre class="codesample"> Declare Function apiReleaseDC Lib "user32" Alias _ | ||
"ReleaseDC" (ByVal hwnd As Long, ByVal hdc As Long) _ | |||
As Long | As Long | ||
</pre> | </pre> | ||
Line 867: | Line 867: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function SelectObject Lib | <pre class="codesample"> Declare Function SelectObject Lib "GDI" (ByVal hDC _ | ||
As Integer, ByVal hObject As Integer) As Integer | As Integer, ByVal hObject As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiSelectObject Lib | <pre class="codesample"> Declare Function apiSelectObject Lib "GDI32" Alias _ | ||
"SelectObject" (ByVal hdc As Long, ByVal hObject As _ | |||
Long) As Long | Long) As Long | ||
</pre> | </pre> | ||
Line 878: | Line 878: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function SetActiveWindow Lib | <pre class="codesample"> Declare Function SetActiveWindow Lib "User" (ByVal _ | ||
hWnd As Integer) As Integer | hWnd As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiSetActiveWindow Lib | <pre class="codesample"> Declare Function apiSetActiveWindow Lib "user32" _ | ||
Alias | Alias "SetActiveWindow" (ByVal hwnd As Long) As Long | ||
</pre> | </pre> | ||
=== SetClipBoardData === | === SetClipBoardData === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function SetClipboardData Lib | <pre class="codesample"> Declare Function SetClipboardData Lib "User" _ | ||
(ByVal wFormat As Integer, ByVal hMem As Integer) As Integer | (ByVal wFormat As Integer, ByVal hMem As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> | <pre class="codesample"> | ||
Declare Function apiSetClipboardData Lib | Declare Function apiSetClipboardData Lib "User32.dll" _ | ||
Alias | Alias "SetClipboardData" (ByVal wFormat as Long, _ | ||
ByVal hMem as Long) as Long | ByVal hMem as Long) as Long | ||
</pre> | </pre> | ||
Line 900: | Line 900: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Sub SetKeyboardState Lib | <pre class="codesample"> Declare Sub SetKeyboardState Lib "User" (lpKeyState As Any) | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiSetKeyboardState Lib | <pre class="codesample"> Declare Function apiSetKeyboardState Lib "user32" Alias_ | ||
"SetKeyboardState" (lppbKeyState As Byte) As Long | |||
</pre> | </pre> | ||
=== SetSysModalWindow === | === SetSysModalWindow === | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function SetSysModalWindow Lib | <pre class="codesample"> Declare Function SetSysModalWindow Lib "User" _ | ||
(ByVal hwnd As Integer) As Integer | (ByVal hwnd As Integer) As Integer | ||
</pre> | </pre> | ||
Line 918: | Line 918: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function SetWindowLong Lib | <pre class="codesample"> Declare Function SetWindowLong Lib "User" (ByVal hWnd _ | ||
As Integer, ByVal nIndex As Integer, ByVal dwNewLong _ | As Integer, ByVal nIndex As Integer, ByVal dwNewLong _ | ||
As Long) As Long | As Long) As Long | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiSetWindowLong Lib | <pre class="codesample"> Declare Function apiSetWindowLong Lib "user32" Alias _ | ||
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex _ | |||
As Long, lNewLong as Long) As Long | As Long, lNewLong as Long) As Long | ||
</pre> | </pre> | ||
Line 931: | Line 931: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> | <pre class="codesample"> | ||
Declare Sub SetWindowPos Lib | Declare Sub SetWindowPos Lib "User" (ByVal hWnd As Integer,_ | ||
ByVal hWndInsertAfter As Integer, ByVal X As Integer, _ | ByVal hWndInsertAfter As Integer, ByVal X As Integer, _ | ||
ByVal Y As Integer, ByVal cx As Integer, ByVal cy _ | ByVal Y As Integer, ByVal cx As Integer, ByVal cy _ | ||
Line 937: | Line 937: | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiSetWindowPos Lib | <pre class="codesample"> Declare Function apiSetWindowPos Lib "user32" Alias _ | ||
"SetWindowPos" (ByVal hwnd As Long, ByVal _ | |||
hWndInsertAfter As Long, ByVal x As Long, ByVal y _ | hWndInsertAfter As Long, ByVal x As Long, ByVal y _ | ||
As Long, ByVal cx As Long, ByVal cy As Long, _ | As Long, ByVal cx As Long, ByVal cy As Long, _ | ||
Line 946: | Line 946: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function ShellExecute Lib | <pre class="codesample"> Declare Function ShellExecute Lib "SHELL" (ByVal _ | ||
hwnd As Integer, ByVal lpszOp As String, ByVal lpszFile _ | hwnd As Integer, ByVal lpszOp As String, ByVal lpszFile _ | ||
As String, ByVal lpszParams As String, ByVal lpszDir As _ | As String, ByVal lpszParams As String, ByVal lpszDir As _ | ||
Line 952: | Line 952: | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiShellExecute Lib | <pre class="codesample"> Declare Function apiShellExecute Lib "shell32.dll" Alias _ | ||
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As _ | |||
String, ByVal lpFile As String, ByVal lpParameters As _ | String, ByVal lpFile As String, ByVal lpParameters As _ | ||
String, ByVal lpDirectory As String, ByVal nShowCmd As _ | String, ByVal lpDirectory As String, ByVal nShowCmd As _ | ||
Line 961: | Line 961: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function ShowWindow Lib | <pre class="codesample"> Declare Function ShowWindow Lib "User" (ByVal hWnd _ | ||
As Integer, ByVal nCmdShow As Integer) As Integer | As Integer, ByVal nCmdShow As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiShowWindow Lib | <pre class="codesample"> Declare Function apiShowWindow Lib "user32" Alias _ | ||
"ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As _ | |||
Long) As Long | Long) As Long | ||
</pre> | </pre> | ||
Line 972: | Line 972: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function WNetAddConnection Lib | <pre class="codesample"> Declare Function WNetAddConnection Lib "User" (ByVal _ | ||
lpszNetPath As String, ByVal lpszPassword As String, _ | lpszNetPath As String, ByVal lpszPassword As String, _ | ||
ByVal lpszLocalName As String) As Integer | ByVal lpszLocalName As String) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiWNetAddConnection Lib | <pre class="codesample"> Declare Function apiWNetAddConnection Lib "mpr.dll" Alias _ | ||
"WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal _ | |||
lpszPassword As String, ByVal lpszLocalName As String) As Long | lpszPassword As String, ByVal lpszLocalName As String) As Long | ||
</pre> | </pre> | ||
Line 984: | Line 984: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function WNetCancelConnection Lib | <pre class="codesample"> Declare Function WNetCancelConnection Lib "User" (ByVal _ | ||
lpszName As String, ByVal bForce As Integer) As Integer | lpszName As String, ByVal bForce As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiWNetCancelConnection Lib | <pre class="codesample"> Declare Function apiWNetCancelConnection Lib "mpr.dll" _ | ||
Alias | Alias "WNetCancelConnectionA" (ByVal lpszName As _ | ||
String, ByVal fForce As Long) As Long | String, ByVal fForce As Long) As Long | ||
</pre> | </pre> | ||
Line 995: | Line 995: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function WNetGetUser Lib | <pre class="codesample"> Declare Function WNetGetUser Lib "USER.EXE" (ByVal _ | ||
szUser As String, lpnBufferSize As Integer) As Integer | szUser As String, lpnBufferSize As Integer) As Integer | ||
</pre> | </pre> | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> | <pre class="codesample"> | ||
Declare Function apiWNetGetUser Lib | Declare Function apiWNetGetUser Lib "mpr.dll" Alias _ | ||
"WNetGetUserA" (ByVal lpName As String, ByVal _ | |||
lpUserName As String, lpnLength As Long) As _ | lpUserName As String, lpnLength As Long) As _ | ||
Long | Long | ||
Declare Function WNetGetUser Lib | Declare Function WNetGetUser Lib "mpr" Alias _ | ||
"WNetGetUserA" (ByVal lpName As String, ByVal _ | |||
lpUserName As String, lpnLength As Long) As Long | lpUserName As String, lpnLength As Long) As Long | ||
</pre> | </pre> | ||
Line 1,013: | Line 1,013: | ||
16-bit: | 16-bit: | ||
<pre class="codesample"> Declare Function WritePrivateProfileString Lib _ | <pre class="codesample"> Declare Function WritePrivateProfileString Lib _ | ||
"Kernel" (ByVal lpApplicationName As String, ByVal _ | |||
lpKeyName As Any, ByVal lpString As Any, ByVal _ | lpKeyName As Any, ByVal lpString As Any, ByVal _ | ||
lplFileName As String) As Integer | lplFileName As String) As Integer | ||
Line 1,019: | Line 1,019: | ||
32-bit: | 32-bit: | ||
<pre class="codesample"> Declare Function apiWritePrivateProfileString Lib _ | <pre class="codesample"> Declare Function apiWritePrivateProfileString Lib _ | ||
"kernel32" Alias "WritePrivateProfileStringA" _ | |||
(ByVal lpApplicationName As String, ByVal lpKeyName _ | (ByVal lpApplicationName As String, ByVal lpKeyName _ | ||
As Any, ByVal lpString As Any, ByVal lpFileName As _ | As Any, ByVal lpString As Any, ByVal lpFileName As _ | ||
Line 1,032: | Line 1,032: | ||
Win32 API Declarations File and Viewer<br /> | Win32 API Declarations File and Viewer<br /> | ||
<br /> | <br /> | ||
"Microsoft Windows 3.1 Programmer's Reference," Volume 2, "Functions"<br /> | |||
<br /> | <br /> | ||
"Microsoft Win32 Programmer's Reference," Volumes 1-4 | |||
</div> | </div> |
Revision as of 10:08, 21 July 2020
Article ID: 147781
Article Last Modified on 1/19/2007
APPLIES TO
- Microsoft Access 95 Standard Edition
- Microsoft Access 97 Standard Edition
This article was previously published under Q147781
SUMMARY
Advanced: Requires expert coding, interoperability, and multiuser skills.
Because the architecture of Windows 95 and later and Windows NT is 32-bit, there are several differences in the application programming interface (API) from the 16-bit API of Windows 3.x. This article shows you how to convert code that contains 16-bit API calls to 32-bit API calls so that the code will run successfully in a 32-bit operating environment. This article discusses the following topics:
- Why 16-bit API calls do not work in a 32-bit operating environment
- Tips on how to make the conversion process easier
- List of converted declaration statements for common API functions that you can copy into your modules.
MORE INFORMATION
Why 16-bit API Calls Do Not Work in a 32-bit Operating Environment
You cannot use a 16-bit API call in the Windows 95 and later or Windows NT 32-bit operating environment for the following reasons:
The API library names (dll) are different, for example:
16-bit 32-bit ------------------------- User.dll User32.dll Kernel.dll Kernel32.dll GDI.dll GDI32.dll
Parameter data types are often different, for example:
16-bit 32-bit ------------------- Integer Long Integer Byte Double Long
NOTE: This is not a complete list. You should watch closely for different parameter data types when you convert code that makes an API call or supplies parameters to an API call.
API function names are case-sensitive. This differs from the 16-bit API, which is not case-sensitive. For example, in a 16-bit API call, the following statements are equivalent:
Declare Function GetVersion Lib "KERNEL" () as Long Declare Function gEtVeRsIoN Lib "KERNEL" () as Long
However, when converted to a 32-bit API, the following statements are not equivalent because the function names are case-sensitive:
Declare Function GetVersion Lib "KERNEL32" () as Long Declare Function gEtVeRsIoN Lib "KERNEL32" () as Long
- Some API functions have different versions to accommodate ANSI and UniCode strings. If an API listed in this article is limited to use under a specific operating system in 32-bit, it will be noted with the API function.
Tips on How to Make the Conversion Process Easier
You can reduce the work involved with converting your existing code by adopting these practices:
- When you declare an API procedure, use an alias for the procedure name. The alias must be unique from the function name. If it is not, the alias will be deleted automatically.
- When you declare the data type returned by the function or the data type of parameters passed to the function, use an As clause rather than the type declaration characters (%, $, and so on).
There is also a helpful utility included with the Microsoft Access Developers Toolkit for Windows 95, Microsoft Office 97 Developer Edition, and Visual Basic 4.0 that makes working with APIs easier. It is called the API Viewer. It enables you to browse through Declares, Constants, and Types that are included in any text file or in a Microsoft Jet database that contains API information. You can copy these items to the Clipboard and then paste them into your code.
List of Converted Declaration Statements for Common API Functions
Following is a listing of 16-bit and 32-bit Declare statements for common API calls that you can use as reference when you convert your code to 32-bit.
NOTE: If you use any of the following 16-bit declarations in Microsoft Access 2.0 or earlier, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating these declarations.
BitBlt
16-bit:
Declare Function BitBlt Lib "GDI" (ByVal hDestDC As Integer, _ ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As _ Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, _ ByVal XSrc As Integer, ByVal YSrc As Integer, ByVal dwRop As _ Long) As Long
32-bit:
Declare Function apiBitBlt Lib "gdi32" Alias "BitBlt" (ByVal _ hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth _ As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal _ XSrc As Long, ByVal YSrc As Long, ByVal dwRop As Long) As Long
CheckMenuItem
16-bit:
Declare Function CheckMenuItem Lib "User" (ByVal hMenu As _ Integer, ByVal wIDCheckItem As Integer, ByVal wCheck As _ Integer) As Integer
32-bit:
Declare Function apiCheckMenuItem Lib "user32" Alias _ "CheckMenuItem" (ByVal hMenu As Long, ByVal wIDCheckItem _ As Long, ByVal wCheck As Long) As Long
NOTE: In Microsoft Access for Windows 95 version 7.0, you can use the SetMenuItem macro action to set the state of menu items (enabled or disabled, checked or unchecked) on a custom menu bar or the global menu bar for the active window. For more information about the SetMenuItem action, search the Help Index for "SetMenuItem Action."
In Microsoft Access 97, you can use the SetMenuItem macro action only with custom menu bars and global menu bars created by using menu bar macros. The SetMenuItem action is included in Microsoft Access 97 for compatibility with earlier versions. To implement the same functionality with the CommandBars collection in Microsoft Access 97, use the Enabled and State properties of command bars in Visual Basic for Applications to enable or disable, check or uncheck items on menu bars, toolbars, and shortcut menus. For more information about these properties, search the Help Index for "Enabled" or "State," or ask the Microsoft Access 97 Office Assistant.
ChooseColor
16-bit:
Declare Function ChooseColor_API Lib "COMMDLG.DLL" Alias _ "ChooseColor" (pCHOOSECOLOR As ChooseColor) As Integer
32-bit:
Type CHOOSECOLOR lStructSize As Long hwndOwner As Long hInstance As Long RgbResult As Long lpCustColors As Long Flags As Long lCustData As Long lpfnHook As Long lpTemplateName As Long End Type Declare Function apiChooseColor Lib "comdlg32.dll" Alias _ "ChooseColorA" (pChoosecolor As CHOOSECOLOR) As Long
NOTE: You can use the ChooseColor functionality of this API by using the Common Dialog ActiveX control included with the Microsoft Access Developer's Toolkit for Windows 95 and Microsoft Office 97 Developer Edition.
CloseClipboard
16-bit:
Declare Function CloseClipboard Lib "User" () As Integer
32-bit:
Declare Function apiCloseClipboard Lib "user32" Alias _ "CloseClipboard" () As Long
CommDlgExtendedError
16-bit:
Declare Function CommDlgExtendedError Lib "COMMDLG.DLL" () _ As Long
32-bit:
Declare Function apiCommDlgExtendedError Lib "comdlg32.dll" _ Alias "CommDlgExtendedError" () As Long
CopyFile
16-bit:
Not available in 16-bit.
32-bit:
Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _ (ByVal lpExistingFileName As String, ByVal lpNewFileName As _ String, ByVal bFailIfExists As Long) As Long
NOTE: File attributes (FILE_ATTRIBUTE_*) for the existing file are copied to the new file. For example, if an existing file has the FILE_ATTRIBUTE_READONLY file attribute, a copy created through a call to CopyFile will also have the FILE_ATTRIBUTE_READONLY file attribute. For further information on file attributes, see CreateFile.
NOTE: To achieve the same results, you can use the FileCopy Statement from within Microsoft Access 7.0 or 97.
CopyMemory
16-bit:
Declare Sub hmemcpy Lib "kernel" (hpvDest As Any, hpvSrc As _ Any, ByVal cbBytes As Long)
32-bit:
Global Const GMEM_MOVEABLE = &H2 Global Const GMEM_ZEROINIT = &H40 Global Const GHND = (GMEM_MOVEABLE Or GMEM_ZEROINIT) Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _ (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
CreateCompatibleBitmap
16-bit:
Declare Function CreateCompatibleBitmap Lib "GDI" (ByVal _ hDC As Integer, ByVal nWidth As Integer, ByVal nHeight As _ Integer) As Integer
32-bit:
Declare Function apiCreateCompatibleBitmap Lib "gdi32" Alias _ "CreateCompatibleBitmap" (ByVal hdc As Long, ByVal nWidth As _ Long, ByVal nHeight As Long) As Long
CreateCompatibleDC
16-bit:
Declare Function CreateCompatibleDC Lib "GDI" (ByVal hdc As _ Integer) As Integer
32-bit:
Declare Function apiCreateCompatibleDC Lib "Gdi32" (ByVal hdc _ As Long) As Long
DeleteDC
16-bit:
Declare Function DeleteDC Lib "GDI" (ByVal hDC As Integer) _ As Integer
32-bit:
Declare Function apiDeleteDC Lib "gdi32" Alias "DeleteDC" _ (ByVal hdc As Long) As Long
DrawMenuBar
16-bit:
Declare Sub DrawMenuBar Lib "User" (ByVal hWnd As Integer)
32-bit:
Declare Function apiDrawMenuBar Lib "user32" Alias _ "DrawMenuBar" (ByVal hwnd As Long) As Long
EmptyClipboard
16-bit:
Declare Function EmptyClipboard Lib "User" () As Integer
32-bit:
Declare Function apiEmptyClipboard Lib "user32" Alias _ "EmptyClipboard" () As Long
EnableMenuItem
16-bit:
Declare Function EnableMenuItem Lib "User" (ByVal hMenu As _ Integer, ByVal wIDEnableItem As Integer, ByVal wEnable _ As Integer) As Integer
32-bit:
Declare Function apiEnableMenuItem Lib "user32" Alias _ "EnableMenuItem" (ByVal hMenu As Long, ByVal wIDEnableItem _ As Long, ByVal wEnable As Long) As Long
ExitWindows
16-bit:
Declare Function ExitWindows Lib "User" (ByVal dwReturnCode _ As Long, ByVal wReserved As Integer) As Integer
32-bit:
Declare Function apiExitWindows Lib "user32" Alias _ "ExitWindows" (ByVal dwReserved As Long, ByVal uReturnCode _ As Long) As Long
FindExecutable
16-bit:
Declare Function FindExecutable Lib "Shell" (ByVal _ lpszFile As String, ByVal lpszDir As String, ByVal _ lpszResult As String) As Integer
32-bit:
Declare Function apiFindExecutable Lib "shell32.dll" Alias _ "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory _ As String, ByVal lpResult As String) As Long
FindWindow
16-bit:
Declare Function FindWindow Lib "user"(ByVal lpclassname As _ Any, ByVal lpCaption As Any) As Integer
32-bit:
Declare Function apiFindWindow Lib "User32" Alias "FindWindowA" _ (ByVal lpclassname As Any, ByVal lpCaption As Any) as Long
fRead
16-bit:
Declare Function fRead Lib "kernel" Alias "lread" (ByVal _ hFile As Integer, ByVal lpBuff As Long, ByVal nBuff _ As Integer) As Long
32-bit:
Use the FileCopy Statement within Microsoft Access 7.0 and 97, or see the CopyFile API call above.
Fwrite
16-bit:
Declare Function fWrite Lib "kernel" Alias "_lwrite" (ByVal _ hFile As Integer, ByVal lpBuff As Long, ByVal nBuff As Integer) _ As Long
32-bit:
Use the FileCopy Statement within Microsoft Access 7.0, or see the CopyFile API call above.
GetActiveWindow
16-bit:
Declare Function GetActiveWindow Lib "User" () As Integer
32-bit:
Declare Function apiGetActiveWindow Lib "user32" Alias _ "GetActiveWindow" () As Long
GetClassName
16-bit:
Declare Function GetClassName Lib "User" (ByVal hWnd _ As Integer, ByVal lpClassName As String, ByVal nMaxCount _ As Integer) As Integer
32-bit:
Declare Function apiGetClassName Lib "user32" Alias _ "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName _ As String, ByVal nMaxCount As Long) As Long
GetClipboardData
16-bit:
Declare Function GetClipboardData Lib "User" (ByVal _ wFormat As Integer) As Integer
32-bit:
Declare Function apiGetClipboardData Lib "user32" Alias _ "GetClipboardDataA" (ByVal wFormat As Long) As Long
GetCursorPos
16-bit:
Declare Sub GetCursorPos Lib "User" (lpPoint As POINTAPI)
32-bit:
Type POINTAPI x as Long y as Long End Type Declare Sub apiGetCursorPos Lib "User32" (lpPoint _ As POINTAPI)
GetDC
16-bit:
Declare Function GetDC Lib "User" (ByVal hWnd As Integer) _ As Integer
32-bit:
Declare Function apiGetDC Lib "user32" Alias "GetDC" (ByVal _ hwnd As Long) As Long
GetDesktopWindow
16-bit:
Declare Function GetDesktopWindow Lib "User" () As Integer
32-bit:
Declare Function apiGetDesktopWindow Lib "user32" Alias _ "GetDesktopWindow" () As Long
NOTE: You can also use GetWindow to perform the same function.
GetDeviceCaps
16-bit:
Declare Function GetDeviceCaps Lib "GDI" (ByVal hDC _ As Integer, ByVal nIndex As Integer) As Integer
32-bit:
Declare Function apiGetDeviceCaps Lib "gdi32" Alias _ "GetDeviceCaps" (ByVal hdc As Long, ByVal nIndex As Long) _ As Long
GetDriveType
16-bit:
Declare Function GetDriveType Lib "Kernel" (ByVal nDrive _ As Integer) As Integer
32-bit:
Declare Function apiGetDriveType Lib "kernel32" Alias _ "GetDriveTypeA" (ByVal nDrive As String) As Long
GetFileVersionInfo
16-bit:
Declare Function GetFileVersionInfo Lib "VER.DLL" _ (ByVal lpszFileName As String, ByVal lpdwHandle As Long, _ ByVal cbbuf As Long, ByVal lpvdata As String) As Integer
32-bit:
Declare Function apiGetFileVersionInfo Lib "version.dll" _ Alias "GetFileVersionInfoA" (ByVal lptstrFilename As _ String, ByVal dwHandle As Long, ByVal dwLen As Long, _ lpData As Any) As Long
GetFileVersionInfoSize
16-bit:
Declare Function GetFileVersionInfoSize Lib "VER.DLL" _ (ByVal lpszFileName As String, lpdwHandle As Long) As Long
32-bit:
Declare Function apiGetFileVersionInfoSize Lib _ "version.dll" Alias "GetFileVersionInfoSizeA" _ (ByVal lptstrFilename As String, lpdwHandle As Long) As Long
GetKeyState
16-bit:
Declare Function GetKeyState Lib "User" (ByVal nVirtKey _ As Integer) As Integer
32-bit:
Declare Function apiGetKeyState Lib "user32" Alias _ "GetKeyState" (ByVal nVirtKey As Long) As Integer
GetMenu
16-bit:
Declare Function GetMenu Lib "User" (ByVal hWnd As _ Integer) As Integer
32-bit:
Declare Function apiGetMenu Lib "user32" Alias "GetMenu" _ (ByVal hwnd As Long) As Long
GetMenuState
16-bit:
Declare Function GetMenuState Lib "User" (ByVal hMenu _ As Integer, ByVal wId As Integer, ByVal wFlags As _ Integer) As Integer
32-bit:
Declare Function apiGetMenuState Lib "user32" Alias _ "GetMenuState" (ByVal hMenu As Long, ByVal wID As Long, _ ByVal wFlags As Long) As Long
GetModuleFileName
16-bit:
Declare Function GetModuleFileName Lib "Kernel" (ByVal _ hModule As Integer, ByVal lpFilename As String, ByVal _ nSize As Integer) As Integer
32-bit:
Declare Function apiGetModuleFileName Lib "kernel32" Alias _ "GetModuleFileNameA" (ByVal hModule As Long, ByVal _ lpFileName As String, ByVal nSize As Long) As Long
GetModuleHandle
16-bit:
Declare Function GetModuleHandle Lib "Kernel" (ByVal _ lpModuleName As String) As Integer
32-bit:
Declare Function apiGetModuleHandle Lib "kernel32" Alias _ "GetModuleHandleA" (ByVal lpModuleName As String) As Long
GetModuleUsage
16-bit:
Declare Function GetModuleUsage Lib "Kernel" (ByVal _ hModule As Integer) As Integer
32-bit:
This function has been deleted. Each Win32 application runs in its own address space.
GetOpenFileName
16-bit:
Declare Function GetOpenFileName Lib "COMMDLG.DLL" _ (OPENFILENAME As tagOPENFILENAME) As Integer
32-bit:
Type tagOPENFILENAME lStructSize As Long hwndOwner As Long hInstance As Long lpstrFilter As String lpstrCustomFilter As String nMaxCustFilter As Long nFilterIndex As Long lpstrFile As String nMaxFile As Long lpstrFileTitle As String nMaxFileTitle As Long lpstrInitialDir As String lpstrTitle As String flags As Long nFileOffset As Integer nFileExtension As Integer lpstrDefExt As String lCustData As Long lpfnHook As Long lpTemplateName As String End Type Declare Function apiGetOpenFileName Lib "comdlg32.dll" _ Alias "GetOpenFileNameA" (OPENFILENAME as tagOPENFILENAME) _ As Long
GetParent
16-bit:
Declare Function GetParent Lib "User" (ByVal hWnd As _ Integer) As Integer
32-bit:
Declare Function apiGetParent Lib "user32" Alias _ "GetParent" (ByVal hwnd As Long) As Long
GetPrivateProfileString
16-bit:
Declare Function GetPrivateProfileString Lib "Kernel" _ (ByVal lpApplicationName As String, ByVal lpKeyName As _ Any, ByVal lpDefault As String, ByVal lpReturnedString As _ String, ByVal nSize As Integer, ByVal lpFileName As String) _ As Integer
32-bit:
Declare Function apiGetPrivateProfileString Lib "kernel32" _ Alias "GetPrivateProfileStringA" (ByVal lpApplicationName _ As String, ByVal lpKeyName As Any, ByVal lpDefault As _ String, ByVal lpReturnedString As String, ByVal nSize As _ Long, ByVal lpFileName As String) As Long
GetSaveFileName
16-bit:
Declare Function GetSaveFileName Lib "COMMDLG.DLL" _ (OPENFILENAME As tagOPENFILENAME) As Integer
32-bit:
Type OPENFILENAME lStructSize As Long hwndOwner As Long hInstance As Long lpstrFilter As String lpstrCustomFilter As String nMaxCustFilter As Long nFilterIndex As Long lpstrFile As String nMaxFile As Long lpstrFileTitle As Long nMaxFileTitle As Long lpstrInitialDir As String lpstrTitle As String Flags As Long nFileOffset As Integer nFileExtension As Integer lpstrDefExt As String lCustData As Long lpfnHook As Long lpTemplateName As String End Type Declare Function apiGetSaveFileName Lib "comdlg32.dll" _ Alias "GetSaveFileNameA" (pOpenfilename as OPENFILENAME) _ As Long
NOTE: You can achieve the same functionality with the Common Dialog OLE control included with the Microsoft Access Developer's Toolkit for Windows 95 and Microsoft Office 97 Professional Edition.
GetSubMenu
16-bit:
Declare Function GetSubMenu Lib "User" (ByVal hMenu _ As Integer, ByVal nPos As Integer) As Integer
32-bit:
Declare Function apiGetSubMenu Lib "user32" Alias _ "GetSubMenu" (ByVal hMenu As Long, ByVal nPos As Long) _ As Long
GetSystemDirectory
16-bit:
Declare Function GetSystemDirectory Lib "Kernel" _ (ByVal lpBuffer As String, ByVal nSize As Integer) As _ Integer
32-bit:
Declare Function apiGetSystemDirectory Lib "kernel32" _ Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, _ ByVal nSize As Long) As Long
GetSystemMenu
16-bit:
Declare Function GetSystemMenu Lib "user" (ByVal _ hWnd As Integer, ByVal flag As Integer) As Integer
32-bit:
Declare Function apiGetSystemMenu Lib "user32" Alias _ "GetSystemMenu" (ByVal hWnd As Long, ByVal flag As Long) _ As Long
GetSystemMetrics
16-bit:
Declare Function GetSystemMetrics Lib "User" (ByVal _ nIndex As Integer) As Integer
32-bit:
Declare Function apiGetSystemMetrics Lib "user32" Alias _ "GetSystemMetrics" (ByVal nIndex As Long) As Long
GetVersion
16-bit:
Declare Function GetVersion Lib "Kernel" () As Long
32-bit:
Declare Function apiGetVersion Lib "kernel32" Alias _ "GetVersion" () As Long
GetWindow
16-bit:
Declare Function GetWindow Lib "User" (ByVal hWnd As _ Integer, ByVal wCmd As Integer) As Integer
32-bit:
Declare Function apiGetWindow Lib "user32" Alias _ "GetWindow" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
GetWindowLong
16-bit:
Declare Function GetWindowLong Lib "User" (ByVal hWnd _ As Integer, ByVal nIndex As Integer) As Long
32-bit:
Declare Function apiGetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As _ Long) As Long
GetWindowRect
16-bit:
Declare Sub GetWindowRect Lib "GDI" (ByVal hWnd As _ Integer, lpRect As RECT)
32-bit:
Type RECT_Type left As Long top As Long right As Long bottom As Long End Type Declare Function apiGetWindowRect Lib "user32" Alias _ "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT_Type) _ As Long
GetWindowText
16-bit:
Declare Function GetWindowText Lib "User" (ByVal hWnd As _ Integer, ByVal lpString As String, ByVal aint As Integer) As _ Integer
32-bit:
Declare Function apiGetWindowText Lib "user32" Alias _ "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString _ As String, ByVal cch As Long) As Long
GetWindowWord
16-bit:
Declare Function GetWindowWord Lib "User" (ByVal _ hWnd As Integer, ByVal nIndex As Integer) As Integer
32-bit:
Declare Function apiGetWindowWord Lib "user32" Alias _ "GetWindowWord" (ByVal hwnd As Long, ByVal nIndex As _ Long) As Integer
GetWindowsDirectory
16-bit:
Declare Function GetWindowsDirectory Lib "Kernel" _ (ByVal lpbuffer As String, ByVal nsize As Integer) As Integer
32-bit:
Declare Function apiGetWindowsDirectory Lib _ "Kernel32" Alias "GetWindowsDirectoryA" (ByVal _ lpbuffer As String, ByVal nsize As Long) As Long
GlobalAlloc
16-bit:
Declare Function GlobalAlloc Lib "Kernel" (ByVal _ wFlags As Integer, ByVal dwBytes As Long) As Integer
32-bit:
Declare Function apiGlobalAlloc Lib "kernel32" Alias _ "GlobalAlloc" (ByVal wFlags As Long, ByVal dwBytes _ As Long) As Long
GlobalFree
16-bit:
Declare Function GlobalFree Lib "Kernel" (ByVal hMem _ As Integer) As Integer
32-bit:
Declare Function apiGlobalFree Lib "kernel32" Alias _ "GlobalFree" (ByVal hMem As Long) As Long
GlobalLock
16-bit:
Declare Function GlobalLock Lib "Kernel" (ByVal hMem _ As Integer) As Long
32-bit:
Declare Function apiGlobalLock Lib "kernel32" Alias _ "GlobalLock" (ByVal hMem As Long) As Long
GlobalSize
16-bit:
Declare Function GlobalSize Lib "Kernel" (ByVal hMem _ As Integer) As Long
32-bit:
Declare Function apiGlobalSize Lib "kernel32" Alias _ "GlobalSize" (ByVal hMem As Long) As Long
GlobalUnlock
16-bit:
Declare Function GlobalUnlock Lib "Kernel" (ByVal _ hMem As Integer) As Integer
32-bit:
Declare Function apiGlobalUnlock Lib "kernel32" Alias _ "GlobalUnlock" (ByVal hMem As Long) As Long
hmemcpy
16-bit:
Declare Sub hmemcpy Lib "kernel" (hpvDest As Any, _ hpvSrc As Any, ByVal cbBytes As Long)
32-bit:
This subfunction is not available in 32-bit environments. The function CopyMemory is the replacement for hmemcpy.
IsIconic
16-bit:
Declare Function IsIconic Lib "User" (ByVal hWnd As _ Integer) As Integer
32-bit:
Declare Function apiIsIconic Lib "user32" Alias _ "IsIconic" (ByVal hwnd As Long) As Long
IsWindowVisible
16-bit:
Declare Function IsWindowVisible Lib "User" (ByVal _ hWnd As Integer) As Integer
32-bit:
Declare Function apiIsWindowVisible Lib "user32" Alias _ "IsWindowVisible" (ByVal hwnd As Long) As Long
IsZoomed
16-bit:
Declare Function IsZoomed Lib "User" (ByVal hWnd As _ Integer) As Integer
32-bit:
Declare Function apiIsZoomed Lib "user32" Alias _ "IsZoomed" (ByVal hwnd As Long) As Long
lstrcpy
16-bit:
Declare Function lstrcpy Lib "Kernel" (ByVal lpString1 As _ Any, ByVal lpString2 As Any) As Long
32-bit:
Declare Function apilstrcpy Lib "kernel32" Alias "lstrcpyA" _ (ByVal lpString1 As Any, ByVal lpString2 As Any) As Long
NetWkstaGetInfo
16-bit:
Declare Function NetWkstaGetInfo Lib "NetAPI.DLL" _ (ByVal lServer As Long, ByVal sLevel As Integer, _ ByVal pbBuffer As Long, ByVal cbBuffer As Integer, _ pcbTotalAvail As Integer) As Integer
32-bit:
Declare Function apiNetWkstaGetInfo Lib "NetAPI32.dll"_ Alias NetWkstaGetInfo (ByVal lServer as Integer, ByVal _ sLevel as Integer, ByVal pbBuffer as Long, cbBuffer as _ Integer, pcbTotalAvail as Integer) As Integer
NOTE: This function is available only in the Windows NT environment.
NOTE: In Microsoft Access 7.0 and 97, you can use the CurrentUser() function to obtain the currently logged on user.
OpenClipboard
16-bit:
Declare Function OpenClipboard Lib "User" (ByVal _ hWnd As Integer) As Integer
32-bit:
Declare Function apiOpenClipboard Lib "user32" Alias _ "OpenClipboard" (ByVal hwnd As Long) As Long
Playsound
16-bit:
Declare Function sndplaysound Lib "mmsystem" (ByVal _ filename as String, ByVal snd_async as Integer) As Integer
32-bit:
Declare Function apisndPlaySound Lib "winmm" Alias _ "sndPlaySoundA" (ByVal filename As String, ByVal snd_async _ As Long) As Long
ReleaseDC
16-bit:
Declare Function ReleaseDC Lib "User" (ByVal hWnd _ As Integer, ByVal hDC As Integer) As Integer
32-bit:
Declare Function apiReleaseDC Lib "user32" Alias _ "ReleaseDC" (ByVal hwnd As Long, ByVal hdc As Long) _ As Long
SelectObject
16-bit:
Declare Function SelectObject Lib "GDI" (ByVal hDC _ As Integer, ByVal hObject As Integer) As Integer
32-bit:
Declare Function apiSelectObject Lib "GDI32" Alias _ "SelectObject" (ByVal hdc As Long, ByVal hObject As _ Long) As Long
SetActiveWindow
16-bit:
Declare Function SetActiveWindow Lib "User" (ByVal _ hWnd As Integer) As Integer
32-bit:
Declare Function apiSetActiveWindow Lib "user32" _ Alias "SetActiveWindow" (ByVal hwnd As Long) As Long
SetClipBoardData
16-bit:
Declare Function SetClipboardData Lib "User" _ (ByVal wFormat As Integer, ByVal hMem As Integer) As Integer
32-bit:
Declare Function apiSetClipboardData Lib "User32.dll" _ Alias "SetClipboardData" (ByVal wFormat as Long, _ ByVal hMem as Long) as Long
SetKeyboardState
16-bit:
Declare Sub SetKeyboardState Lib "User" (lpKeyState As Any)
32-bit:
Declare Function apiSetKeyboardState Lib "user32" Alias_ "SetKeyboardState" (lppbKeyState As Byte) As Long
SetSysModalWindow
16-bit:
Declare Function SetSysModalWindow Lib "User" _ (ByVal hwnd As Integer) As Integer
32-bit:
This function has been deleted.
SetWindowLong
16-bit:
Declare Function SetWindowLong Lib "User" (ByVal hWnd _ As Integer, ByVal nIndex As Integer, ByVal dwNewLong _ As Long) As Long
32-bit:
Declare Function apiSetWindowLong Lib "user32" Alias _ "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex _ As Long, lNewLong as Long) As Long
SetWindowPos
16-bit:
Declare Sub SetWindowPos Lib "User" (ByVal hWnd As Integer,_ ByVal hWndInsertAfter As Integer, ByVal X As Integer, _ ByVal Y As Integer, ByVal cx As Integer, ByVal cy _ As Integer, ByVal wFlags As Integer)
32-bit:
Declare Function apiSetWindowPos Lib "user32" Alias _ "SetWindowPos" (ByVal hwnd As Long, ByVal _ hWndInsertAfter As Long, ByVal x As Long, ByVal y _ As Long, ByVal cx As Long, ByVal cy As Long, _ ByVal wFlags As Long) As Long
ShellExecute
16-bit:
Declare Function ShellExecute Lib "SHELL" (ByVal _ hwnd As Integer, ByVal lpszOp As String, ByVal lpszFile _ As String, ByVal lpszParams As String, ByVal lpszDir As _ String, ByVal fsShowCmd As Integer) As Integer
32-bit:
Declare Function apiShellExecute Lib "shell32.dll" Alias _ "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As _ String, ByVal lpFile As String, ByVal lpParameters As _ String, ByVal lpDirectory As String, ByVal nShowCmd As _ Long) As Long
ShowWindow
16-bit:
Declare Function ShowWindow Lib "User" (ByVal hWnd _ As Integer, ByVal nCmdShow As Integer) As Integer
32-bit:
Declare Function apiShowWindow Lib "user32" Alias _ "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As _ Long) As Long
WNetAddConnection
16-bit:
Declare Function WNetAddConnection Lib "User" (ByVal _ lpszNetPath As String, ByVal lpszPassword As String, _ ByVal lpszLocalName As String) As Integer
32-bit:
Declare Function apiWNetAddConnection Lib "mpr.dll" Alias _ "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal _ lpszPassword As String, ByVal lpszLocalName As String) As Long
WNetCancelConnection
16-bit:
Declare Function WNetCancelConnection Lib "User" (ByVal _ lpszName As String, ByVal bForce As Integer) As Integer
32-bit:
Declare Function apiWNetCancelConnection Lib "mpr.dll" _ Alias "WNetCancelConnectionA" (ByVal lpszName As _ String, ByVal fForce As Long) As Long
WNetGetUser
16-bit:
Declare Function WNetGetUser Lib "USER.EXE" (ByVal _ szUser As String, lpnBufferSize As Integer) As Integer
32-bit:
Declare Function apiWNetGetUser Lib "mpr.dll" Alias _ "WNetGetUserA" (ByVal lpName As String, ByVal _ lpUserName As String, lpnLength As Long) As _ Long Declare Function WNetGetUser Lib "mpr" Alias _ "WNetGetUserA" (ByVal lpName As String, ByVal _ lpUserName As String, lpnLength As Long) As Long
WritePrivateProfileString
16-bit:
Declare Function WritePrivateProfileString Lib _ "Kernel" (ByVal lpApplicationName As String, ByVal _ lpKeyName As Any, ByVal lpString As Any, ByVal _ lplFileName As String) As Integer
32-bit:
Declare Function apiWritePrivateProfileString Lib _ "kernel32" Alias "WritePrivateProfileStringA" _ (ByVal lpApplicationName As String, ByVal lpKeyName _ As Any, ByVal lpString As Any, ByVal lpFileName As _ String) As Long
REFERENCES
Win32 API Declarations File and Viewer
"Microsoft Windows 3.1 Programmer's Reference," Volume 2, "Functions"
"Microsoft Win32 Programmer's Reference," Volumes 1-4
Keywords: kbfaq kbhowto kbprogramming KB147781