De informatie in dit artikel is van toepassing op:
- Microsoft Access 95 Standard Edition
- Microsoft Access 97 Standard Edition
Dit artikel is eerder gepubliceerd onder NL147781
Samenvatting
Geavanceerd: vereist goede vaardigheden op het gebied van codering, interoperabiliteit en werken met meerdere gebruikers.
De architectuur van Windows 95 en hoger en van Windows NT is 32-bits. Er zijn daarom een aantal verschillen tussen de API (Application Programming Interface) van deze besturingssystemen ten opzichte van de 16-bits API van Windows 3.x. In dit artikel wordt beschreven hoe u code met 16-bits API-aanroepen kunt omzetten naar code met 32-bits API-aanroepen, zodat de code met succes kan worden uitgevoerd in een 32-bits besturingsomgeving. De volgende onderwerpen komen aan de orde:
- Waarom 16-bits API-aanroepen niet werken in een 32-bits besturingsomgeving
- Tips voor een eenvoudigere conversieprocedure
- Lijst met geconverteerde declaratie-instructies voor algemene API-functies die u naar uw modules kunt kopiëren.
Meer informatie
Waarom 16-bits API-aanroepen niet werken in een 32-bits besturingsomgeving
U kunt om de volgende redenen geen 16-bits API-aanroep gebruiken in de 32-bits besturingsomgevingen Windows 95 of hoger en Windows NT:
- De bibliotheeknamen (dll) voor de API's verschillen. Bijvoorbeeld:
16-bit 32-bit ------------------------- User.dll User32.dll Kernel.dll Kernel32.dll GDI.dll GDI32.dll
- Parametergegevenstypen verschillen vaak. Bijvoorbeeld:
16-bit 32-bit ------------------- Integer Long Integer Byte Double Long
Opmerking Dit is geen volledige lijst. Let goed op verschillende parametergegevenstypen bij het converteren van code die een API-aanroep uitvoert of parameters voor een API-aanroep levert. - In API-functienamen wordt onderscheid gemaakt tussen hoofdletters en kleine letters. Dit is een verschil met de 16-bits API, waar dit onderscheid niet wordt gemaakt. In een 16-bits API-aanroep bijvoorbeeld, is er geen verschil tussen de volgende instructies:
Declare Function GetVersion Lib "KERNEL" () as Long Declare Function gEtVeRsIoN Lib "KERNEL" () as Long
Wanneer echter wordt geconverteerd naar een 32-bits API, is er wel verschil tussen de volgende instructies omdat in functienamen onderscheid wordt gemaakt tussen hoofdletters en kleine letters:
Declare Function GetVersion Lib "KERNEL32" () as Long Declare Function gEtVeRsIoN Lib "KERNEL32" () as Long
- Sommige API-functies hebben verschillende versies ter ondersteuning van ANSI- en UniCode-tekenreeksen. Als een API die in dit artikel wordt vermeld, in de 32-bits-versie beperkt is tot gebruik onder een bepaald besturingssysteem, wordt dit bij de API-functie vermeld.
Tips voor een eenvoudigere conversieprocedure
U kunt de procedure voor het converteren van de bestaande code vereenvoudigen door de volgende handelingen uit te voeren:
- Gebruik een alias voor de procedurenaam wanneer u een API-procedure declareert. De alias moet uniek zijn ten opzichte van de functienaam. Als de alias niet uniek is, wordt deze automatisch verwijderd.
- Gebruik een As-component in plaats van de type-aanduidingstekens (%, $, enzovoort) bij het declareren van het gegevenstype dat door de functie wordt geretourneerd of van het gegevenstype van parameters die aan de functie worden doorgegeven.
In de Microsoft Access Developer's Toolkit voor Windows 95, Microsoft Office 97 Developer Edition en Visual Basic 4.0 is een handig hulpprogramma opgenomen om het werken met API's te vereenvoudigen. Dit hulpprogramma is de API Viewer. Hiermee kunt u door declaraties, constanten en typen bladeren in tekstbestanden of in een Microsoft Jet-database die API-informatie bevat. U kunt deze items naar het Klembord kopiëren en ze vervolgens in uw code plakken.
Lijst met geconverteerde declaratie-instructies voor algemene API-functies
Hieronder vindt u een lijst met 16-bits en 32-bits Declare-instructies voor algemene API-aanroepen die u kunt gebruiken als referentie wanneer u code converteert naar 32-bits.
Opmerking Als u een van de volgende 16-bits declaraties gebruikt in Microsoft Access 2.0 of eerder, wordt een onderstrepingsteken (_) aan het einde van een regel gebruikt als regelvoortzettingsteken. Verwijder het onderstrepingsteken aan het einde van de regel wanneer u deze declaraties opnieuw maakt.
BitBlt
16-bits:
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-bits:
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-bits:
Declare Function CheckMenuItem Lib "User" (ByVal hMenu As _ Integer, ByVal wIDCheckItem As Integer, ByVal wCheck As _ Integer) As Integer
32-bits:
Declare Function apiCheckMenuItem Lib "user32" Alias _ "CheckMenuItem" (ByVal hMenu As Long, ByVal wIDCheckItem _ As Long, ByVal wCheck As Long) As Long
Opmerking In Microsoft Access voor Windows 95 versie 7.0 kunt u de macro-actie SetMenuItem gebruiken om de status in te stellen van menuopdrachten (ingeschakeld of uitgeschakeld, geselecteerd of niet geselecteerd) in een aangepaste menubalk of in de algemene menubalk van het actieve venster. Zoek in de Help-index naar 'SetMenuItem Action' voor meer informatie over deze macro-actie.
In Microsoft Access 97 kunt u de macro-actie SetMenuItem uitsluitend gebruiken met aangepaste menubalken en algemene menubalken die gemaakt zijn met behulp van menubalkmacro's. De actie SetMenuItem is in Microsoft Access 97 opgenomen voor compatibiliteit met eerdere versies. Als u dezelfde functionaliteit wilt implementeren met de collectie CommandBars in Microsoft Access 97, kunt u de eigenschappen Ingeschakeld en Status van opdrachtbalken in Visual Basic for Applications gebruiken om items in menubalken, werkbalken en snelmenu's in of uit te schakelen. Zoek in de Help-index naar 'Ingeschakeld' of 'Status' of vraag de Microsoft Access 97 Office-assistent naar meer informatie over deze eigenschappen.
ChooseColor
16-bits:
Declare Function ChooseColor_API Lib "COMMDLG.DLL" Alias _ "ChooseColor" (pCHOOSECOLOR As ChooseColor) As Integer
32-bits:
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
Opmerking U kunt de functie ChooseColor van deze API gebruiken via het besturingselement Common Dialog ActiveX dat is opgenomen in de Microsoft Access Developer's Toolkit voor Windows 95 en in Microsoft Office 97 Developer Edition.
CloseClipboard
16-bits:
Declare Function CloseClipboard Lib "User" () As Integer
32-bits:
Declare Function apiCloseClipboard Lib "user32" Alias _
"CloseClipboard" () As Long
CommDlgExtendedError
16-bits:
Declare Function CommDlgExtendedError Lib "COMMDLG.DLL" () _ As Long
32-bits:
Declare Function apiCommDlgExtendedError Lib "comdlg32.dll" _ Alias "CommDlgExtendedError" () As Long
CopyFile
16-bits:
Niet beschikbaar in 16-bits.
32-bits:
Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _ (ByVal lpExistingFileName As String, ByVal lpNewFileName As _ String, ByVal bFailIfExists As Long) As Long
Opmerking Bestandskenmerken (FILE_ATTRIBUTE_*) voor de bestaande bestanden worden naar het nieuwe bestand gekopieerd. Als een bestaand bestand bijvoorbeeld het bestandskenmerk FILE_ATTRIBUTE_READONLY heeft, heeft ook een kopie die gemaakt is via een aanroep van CopyFile het bestandskenmerk FILE_ATTRIBUTE_READONLY. Zie CreateFile voor meer informatie over bestandskenmerken.
Opmerking U kunt dezelfde resultaten bereiken met de instructie FileCopy vanuit Microsoft Access 7.0 of 97.
CopyMemory
16-bits:
Declare Sub hmemcpy Lib "kernel" (hpvDest As Any, hpvSrc As _ Any, ByVal cbBytes As Long)
32-bits:
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-bits:
Declare Function CreateCompatibleBitmap Lib "GDI" (ByVal _ hDC As Integer, ByVal nWidth As Integer, ByVal nHeight As _ Integer) As Integer
32-bits:
Declare Function apiCreateCompatibleBitmap Lib "gdi32" Alias _ "CreateCompatibleBitmap" (ByVal hdc As Long, ByVal nWidth As _ Long, ByVal nHeight As Long) As Long
CreateCompatibleDC
16-bits:
Declare Function CreateCompatibleDC Lib "GDI" (ByVal hdc As _ Integer) As Integer
32-bits:
Declare Function apiCreateCompatibleDC Lib "Gdi32" (ByVal hdc _ As Long) As Long
DeleteDC
16-bits:
Declare Function DeleteDC Lib "GDI" (ByVal hDC As Integer) _ As Integer
32-bits:
Declare Function apiDeleteDC Lib "gdi32" Alias "DeleteDC" _ (ByVal hdc As Long) As Long
DrawMenuBar
16-bits:
Declare Sub DrawMenuBar Lib "User" (ByVal hWnd As Integer)
32-bits:
Declare Function apiDrawMenuBar Lib "user32" Alias _ "DrawMenuBar" (ByVal hwnd As Long) As Long
EmptyClipboard
16-bits:
Declare Function EmptyClipboard Lib "User" () As Integer
32-bits:
Declare Function apiEmptyClipboard Lib "user32" Alias _ "EmptyClipboard" () As Long
EnableMenuItem
16-bits:
Declare Function EnableMenuItem Lib "User" (ByVal hMenu As _ Integer, ByVal wIDEnableItem As Integer, ByVal wEnable _ As Integer) As Integer
32-bits:
Declare Function apiEnableMenuItem Lib "user32" Alias _ "EnableMenuItem" (ByVal hMenu As Long, ByVal wIDEnableItem _ As Long, ByVal wEnable As Long) As Long
ExitWindows
16-bits:
Declare Function ExitWindows Lib "User" (ByVal dwReturnCode _ As Long, ByVal wReserved As Integer) As Integer
32-bits:
Declare Function apiExitWindows Lib "user32" Alias _ "ExitWindows" (ByVal dwReserved As Long, ByVal uReturnCode _ As Long) As Long
FindExecutable
16-bits:
Declare Function FindExecutable Lib "Shell" (ByVal _ lpszFile As String, ByVal lpszDir As String, ByVal _ lpszResult As String) As Integer
32-bits:
Declare Function apiFindExecutable Lib "shell32.dll" Alias _ "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory _ As String, ByVal lpResult As String) As Long
FindWindow
16-bits:
Declare Function FindWindow Lib "user"(ByVal lpclassname As _ Any, ByVal lpCaption As Any) As Integer
32-bits:
Declare Function apiFindWindow Lib "User32" Alias "FindWindowA" _ (ByVal lpclassname As Any, ByVal lpCaption As Any) as Long
fRead
16-bits:
Declare Function fRead Lib "kernel" Alias "lread" (ByVal _ hFile As Integer, ByVal lpBuff As Long, ByVal nBuff _ As Integer) As Long
32-bits:
Gebruik de instructie FileCopy in Microsoft Access 7.0 en 97 of zie de API-aanroep CopyFile hierboven.
Fwrite
16-bits:
Declare Function fWrite Lib "kernel" Alias "_lwrite" (ByVal _ hFile As Integer, ByVal lpBuff As Long, ByVal nBuff As Integer) _ As Long
32-bits:
Gebruik de instructie FileCopy in Microsoft Access 7.0 of zie de API-aanroep CopyFile hierboven.
GetActiveWindow
16-bits:
Declare Function GetActiveWindow Lib "User" () As Integer
32-bits:
Declare Function apiGetActiveWindow Lib "user32" Alias _ "GetActiveWindow" () As Long
GetClassName
16-bits:
Declare Function GetClassName Lib "User" (ByVal hWnd _ As Integer, ByVal lpClassName As String, ByVal nMaxCount _ As Integer) As Integer
32-bits:
Declare Function apiGetClassName Lib "user32" Alias _ "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName _ As String, ByVal nMaxCount As Long) As Long
GetClipboardData
16-bits:
Declare Function GetClipboardData Lib "User" (ByVal _ wFormat As Integer) As Integer
32-bits:
Declare Function apiGetClipboardData Lib "user32" Alias _ "GetClipboardDataA" (ByVal wFormat As Long) As Long
GetCursorPos
16-bits:
Declare Sub GetCursorPos Lib "User" (lpPoint As POINTAPI)
32-bits:
Type POINTAPI x as Long y as Long End Type
Declare Sub apiGetCursorPos Lib "User32" (lpPoint _ As POINTAPI)
GetDC
16-bits:
Declare Function GetDC Lib "User" (ByVal hWnd As Integer) _ As Integer
32-bits:
Declare Function apiGetDC Lib "user32" Alias "GetDC" (ByVal _ hwnd As Long) As Long
GetDesktopWindow
16-bits:
Declare Function GetDesktopWindow Lib "User" () As Integer
32-bits:
Declare Function apiGetDesktopWindow Lib "user32" Alias _ "GetDesktopWindow" () As Long
Opmerking U kunt ook GetWindow gebruiken om dezelfde functie uit te voeren.
GetDeviceCaps
16-bits:
Declare Function GetDeviceCaps Lib "GDI" (ByVal hDC _ As Integer, ByVal nIndex As Integer) As Integer
32-bits:
Declare Function apiGetDeviceCaps Lib "gdi32" Alias _ "GetDeviceCaps" (ByVal hdc As Long, ByVal nIndex As Long) _ As Long
GetDriveType
16-bits:
Declare Function GetDriveType Lib "Kernel" (ByVal nDrive _ As Integer) As Integer
32-bits:
Declare Function apiGetDriveType Lib "kernel32" Alias _ "GetDriveTypeA" (ByVal nDrive As String) As Long
GetFileVersionInfo
16-bits:
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-bits:
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-bits:
Declare Function GetFileVersionInfoSize Lib "VER.DLL" _ (ByVal lpszFileName As String, lpdwHandle As Long) As Long
32-bits:
Declare Function apiGetFileVersionInfoSize Lib _ "version.dll" Alias "GetFileVersionInfoSizeA" _ (ByVal lptstrFilename As String, lpdwHandle As Long) As Long
GetKeyState
16-bits:
Declare Function GetKeyState Lib "User" (ByVal nVirtKey _ As Integer) As Integer
32-bits:
Declare Function apiGetKeyState Lib "user32" Alias _ "GetKeyState" (ByVal nVirtKey As Long) As Integer
GetMenu
16-bits:
Declare Function GetMenu Lib "User" (ByVal hWnd As _ Integer) As Integer
32-bits:
Declare Function apiGetMenu Lib "user32" Alias "GetMenu" _ (ByVal hwnd As Long) As Long
GetMenuState
16-bits:
Declare Function GetMenuState Lib "User" (ByVal hMenu _ As Integer, ByVal wId As Integer, ByVal wFlags As _ Integer) As Integer
32-bits:
Declare Function apiGetMenuState Lib "user32" Alias _ "GetMenuState" (ByVal hMenu As Long, ByVal wID As Long, _ ByVal wFlags As Long) As Long
GetModuleFileName
16-bits:
Declare Function GetModuleFileName Lib "Kernel" (ByVal _ hModule As Integer, ByVal lpFilename As String, ByVal _ nSize As Integer) As Integer
32-bits:
Declare Function apiGetModuleFileName Lib "kernel32" Alias _ "GetModuleFileNameA" (ByVal hModule As Long, ByVal _ lpFileName As String, ByVal nSize As Long) As Long
GetModuleHandle
16-bits:
Declare Function GetModuleHandle Lib "Kernel" (ByVal _ lpModuleName As String) As Integer
32-bits:
Declare Function apiGetModuleHandle Lib "kernel32" Alias _ "GetModuleHandleA" (ByVal lpModuleName As String) As Long
GetModuleUsage
16-bits:
Declare Function GetModuleUsage Lib "Kernel" (ByVal _ hModule As Integer) As Integer
32-bits:
Deze functie is verwijderd. Elke Win32-toepassing wordt in een eigen adresruimte uitgevoerd.
GetOpenFileName
16-bits:
Declare Function GetOpenFileName Lib "COMMDLG.DLL" _ (OPENFILENAME As tagOPENFILENAME) As Integer
32-bits:
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-bits:
Declare Function GetParent Lib "User" (ByVal hWnd As _ Integer) As Integer
32-bits:
Declare Function apiGetParent Lib "user32" Alias _ "GetParent" (ByVal hwnd As Long) As Long
GetPrivateProfileString
16-bits:
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-bits:
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-bits:
Declare Function GetSaveFileName Lib "COMMDLG.DLL" _ (OPENFILENAME As tagOPENFILENAME) As Integer
32-bits:
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
Opmerking U kunt dezelfde functionaliteit bereiken met het besturingselement Common Dialog OLE dat is opgenomen in de Microsoft Access Developer's Toolkit voor Windows 95 en in Microsoft Office 97 Professional Edition.
GetSubMenu
16-bits:
Declare Function GetSubMenu Lib "User" (ByVal hMenu _ As Integer, ByVal nPos As Integer) As Integer
32-bits:
Declare Function apiGetSubMenu Lib "user32" Alias _ "GetSubMenu" (ByVal hMenu As Long, ByVal nPos As Long) _ As Long
GetSystemDirectory
16-bits:
Declare Function GetSystemDirectory Lib "Kernel" _ (ByVal lpBuffer As String, ByVal nSize As Integer) As _ Integer
32-bits:
Declare Function apiGetSystemDirectory Lib "kernel32" _ Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, _ ByVal nSize As Long) As Long
GetSystemMenu
16-bits:
Declare Function GetSystemMenu Lib "user" (ByVal _ hWnd As Integer, ByVal flag As Integer) As Integer
32-bits:
Declare Function apiGetSystemMenu Lib "user32" Alias _ "GetSystemMenu" (ByVal hWnd As Long, ByVal flag As Long) _ As Long
GetSystemMetrics
16-bits:
Declare Function GetSystemMetrics Lib "User" (ByVal _ nIndex As Integer) As Integer
32-bits:
Declare Function apiGetSystemMetrics Lib "user32" Alias _ "GetSystemMetrics" (ByVal nIndex As Long) As Long
GetVersion
16-bits:
Declare Function GetVersion Lib "Kernel" () As Long
32-bits:
Declare Function apiGetVersion Lib "kernel32" Alias _ "GetVersion" () As Long
GetWindow
16-bits:
Declare Function GetWindow Lib "User" (ByVal hWnd As _ Integer, ByVal wCmd As Integer) As Integer
32-bits:
Declare Function apiGetWindow Lib "user32" Alias _ "GetWindow" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
GetWindowLong
16-bits:
Declare Function GetWindowLong Lib "User" (ByVal hWnd _ As Integer, ByVal nIndex As Integer) As Long
32-bits:
Declare Function apiGetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As _ Long) As Long
GetWindowRect
16-bits:
Declare Sub GetWindowRect Lib "GDI" (ByVal hWnd As _ Integer, lpRect As RECT)
32-bits:
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-bits:
Declare Function GetWindowText Lib "User" (ByVal hWnd As _ Integer, ByVal lpString As String, ByVal aint As Integer) As _ Integer
32-bits:
Declare Function apiGetWindowText Lib "user32" Alias _ "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString _ As String, ByVal cch As Long) As Long
GetWindowWord
16-bits:
Declare Function GetWindowWord Lib "User" (ByVal _ hWnd As Integer, ByVal nIndex As Integer) As Integer
32-bits:
Declare Function apiGetWindowWord Lib "user32" Alias _ "GetWindowWord" (ByVal hwnd As Long, ByVal nIndex As _ Long) As Integer
GetWindowsDirectory
16-bits:
Declare Function GetWindowsDirectory Lib "Kernel" _ (ByVal lpbuffer As String, ByVal nsize As Integer) As Integer
32-bits:
Declare Function apiGetWindowsDirectory Lib _ "Kernel32" Alias "GetWindowsDirectoryA" (ByVal _ lpbuffer As String, ByVal nsize As Long) As Long
GlobalAlloc
16-bits:
Declare Function GlobalAlloc Lib "Kernel" (ByVal _ wFlags As Integer, ByVal dwBytes As Long) As Integer
32-bits:
Declare Function apiGlobalAlloc Lib "kernel32" Alias _ "GlobalAlloc" (ByVal wFlags As Long, ByVal dwBytes _ As Long) As Long
GlobalFree
16-bits:
Declare Function GlobalFree Lib "Kernel" (ByVal hMem _ As Integer) As Integer
32-bits:
Declare Function apiGlobalFree Lib "kernel32" Alias _ "GlobalFree" (ByVal hMem As Long) As Long
GlobalLock
16-bits:
Declare Function GlobalLock Lib "Kernel" (ByVal hMem _ As Integer) As Long
32-bits:
Declare Function apiGlobalLock Lib "kernel32" Alias _ "GlobalLock" (ByVal hMem As Long) As Long
GlobalSize
16-bits:
Declare Function GlobalSize Lib "Kernel" (ByVal hMem _ As Integer) As Long
32-bits:
Declare Function apiGlobalSize Lib "kernel32" Alias _ "GlobalSize" (ByVal hMem As Long) As Long
GlobalUnlock
16-bits:
Declare Function GlobalUnlock Lib "Kernel" (ByVal _ hMem As Integer) As Integer
32-bits:
Declare Function apiGlobalUnlock Lib "kernel32" Alias _ "GlobalUnlock" (ByVal hMem As Long) As Long
hmemcpy
16-bits:
Declare Sub hmemcpy Lib "kernel" (hpvDest As Any, _ hpvSrc As Any, ByVal cbBytes As Long)
32-bits:
Deze subfunctie is niet beschikbaar in een 32-bits omgeving. De functie CopyMemory is de vervanging van hmemcpy.
IsIconic
16-bits:
Declare Function IsIconic Lib "User" (ByVal hWnd As _ Integer) As Integer
32-bits:
Declare Function apiIsIconic Lib "user32" Alias _ "IsIconic" (ByVal hwnd As Long) As Long
IsWindowVisible
16-bits:
Declare Function IsWindowVisible Lib "User" (ByVal _ hWnd As Integer) As Integer
32-bits:
Declare Function apiIsWindowVisible Lib "user32" Alias _ "IsWindowVisible" (ByVal hwnd As Long) As Long
IsZoomed
16-bits:
Declare Function IsZoomed Lib "User" (ByVal hWnd As _ Integer) As Integer
32-bits:
Declare Function apiIsZoomed Lib "user32" Alias _ "IsZoomed" (ByVal hwnd As Long) As Long
lstrcpy
16-bits:
Declare Function lstrcpy Lib "Kernel" (ByVal lpString1 As _ Any, ByVal lpString2 As Any) As Long
32-bits:
Declare Function apilstrcpy Lib "kernel32" Alias "lstrcpyA" _ (ByVal lpString1 As Any, ByVal lpString2 As Any) As Long
NetWkstaGetInfo
16-bits:
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-bits:
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
Opmerking Deze functie is uitsluitend beschikbaar in de Windows NT-omgeving.
Opmerking In Microsoft Access 7.0 en 97 kunt u de functie CurrentUser() gebruiken om de huidige aangemelde gebruiker te verkrijgen.
OpenClipboard
16-bits:
Declare Function OpenClipboard Lib "User" (ByVal _ hWnd As Integer) As Integer
32-bits:
Declare Function apiOpenClipboard Lib "user32" Alias _ "OpenClipboard" (ByVal hwnd As Long) As Long
Playsound
16-bits:
Declare Function sndplaysound Lib "mmsystem" (ByVal _ filename as String, ByVal snd_async as Integer) As Integer
32-bits:
Declare Function apisndPlaySound Lib "winmm" Alias _ "sndPlaySoundA" (ByVal filename As String, ByVal snd_async _ As Long) As Long
ReleaseDC
16-bits:
Declare Function ReleaseDC Lib "User" (ByVal hWnd _ As Integer, ByVal hDC As Integer) As Integer
32-bits:
Declare Function apiReleaseDC Lib "user32" Alias _ "ReleaseDC" (ByVal hwnd As Long, ByVal hdc As Long) _ As Long
SelectObject
16-bits:
Declare Function SelectObject Lib "GDI" (ByVal hDC _ As Integer, ByVal hObject As Integer) As Integer
32-bits:
Declare Function apiSelectObject Lib "GDI32" Alias _ "SelectObject" (ByVal hdc As Long, ByVal hObject As _ Long) As Long
SetActiveWindow
16-bits:
Declare Function SetActiveWindow Lib "User" (ByVal _ hWnd As Integer) As Integer
32-bits:
Declare Function apiSetActiveWindow Lib "user32" _ Alias "SetActiveWindow" (ByVal hwnd As Long) As Long
SetClipBoardData
16-bits:
Declare Function SetClipboardData Lib "User" _ (ByVal wFormat As Integer, ByVal hMem As Integer) As Integer
32-bits:
Declare Function apiSetClipboardData Lib "User32.dll" _ Alias "SetClipboardData" (ByVal wFormat as Long, _ ByVal hMem as Long) as Long
SetKeyboardState
16-bits:
Declare Sub SetKeyboardState Lib "User" (lpKeyState As Any)
32-bits:
Declare Function apiSetKeyboardState Lib "user32" Alias_ "SetKeyboardState" (lppbKeyState As Byte) As Long
SetSysModalWindow
16-bits:
Declare Function SetSysModalWindow Lib "User" _ (ByVal hwnd As Integer) As Integer
32-bits:
Deze functie is verwijderd.
SetWindowLong
16-bits:
Declare Function SetWindowLong Lib "User" (ByVal hWnd _ As Integer, ByVal nIndex As Integer, ByVal dwNewLong _ As Long) As Long
32-bits:
Declare Function apiSetWindowLong Lib "user32" Alias _ "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex _ As Long, lNewLong as Long) As Long
SetWindowPos
16-bits:
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-bits:
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-bits:
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-bits:
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-bits:
Declare Function ShowWindow Lib "User" (ByVal hWnd _ As Integer, ByVal nCmdShow As Integer) As Integer
32-bits:
Declare Function apiShowWindow Lib "user32" Alias _ "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As _ Long) As Long
WNetAddConnection
16-bits:
Declare Function WNetAddConnection Lib "User" (ByVal _ lpszNetPath As String, ByVal lpszPassword As String, _ ByVal lpszLocalName As String) As Integer
32-bits:
Declare Function apiWNetAddConnection Lib "mpr.dll" Alias _ "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal _ lpszPassword As String, ByVal lpszLocalName As String) As Long
WNetCancelConnection
16-bits:
Declare Function WNetCancelConnection Lib "User" (ByVal _ lpszName As String, ByVal bForce As Integer) As Integer
32-bits:
Declare Function apiWNetCancelConnection Lib "mpr.dll" _ Alias "WNetCancelConnectionA" (ByVal lpszName As _ String, ByVal fForce As Long) As Long
WNetGetUser
16-bits:
Declare Function WNetGetUser Lib "USER.EXE" (ByVal _ szUser As String, lpnBufferSize As Integer) As Integer
32-bits:
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-bits:
Declare Function WritePrivateProfileString Lib _ "Kernel" (ByVal lpApplicationName As String, ByVal _ lpKeyName As Any, ByVal lpString As Any, ByVal _ lplFileName As String) As Integer
32-bits:
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
Referenties
Declaratiebestand en viewer Win32 API
'Microsoft Windows 3.1 Programmer's Reference', Volume 2, 'Functions'
'Microsoft Win32 Programmer's Reference', Volume 1-4