
32 bit API call not recognizing Alias Name
Hello, Can anyone shed some light? I've looked thru the KB, Help and the
Master Access CD and just plain don't understand what's happening.
When I try to compile the following code. I get a compile error in
Access97. Function or procedure not defined.
The alias name is not being recognized.
See code below that I copied and created a function with sample code from
the "Mastering Microsoft Access Programming" CD.
Option Compare Database
Option Explicit
Declare Function GetWindowsDirectory Lib "kernel32" Alias
"GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As
Long
Dim WinDir As String * 255
Dim sLen As Integer
Function myfunc()
WinDir = "Mark"
sLen = GetWindowsDirectoryA(WinDir, Len(WinDir))
End Function
If the function is called as "GetWindowsDirectory" instead of the alias
"GetWindowsDirectoryA" it compiles fine.
Any Ideas??
ORIGINAL CODE FROM CD
Declare Function GetWindowsDirectory Lib "kernel32" & _
Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, & _
ByVal nSize As Long) As Long
Dim WinDir As String * 255
Dim sLen as Integer
sLen = GetWindowsDirectoryA(WinDir, Len(WinDir))