32 bit API call not recognizing Alias Name 
Author Message
 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))



Mon, 12 Jul 1999 03:00:00 GMT  
 32 bit API call not recognizing Alias Name



Quote:
> If the function is called as "GetWindowsDirectory" instead of the alias
> "GetWindowsDirectoryA" it compiles fine.

When you declared the function, you told Access that YOU'RE going to call
it GetWindowsDirectory. Its real name is GetWIndowsDirectoryA, but you
need to call GetWindowsDirectory. -- Ken
--

http://www.mcwtech.com


Tue, 13 Jul 1999 03:00:00 GMT  
 32 bit API call not recognizing Alias Name

Quote:

>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.

>Declare Function GetWindowsDirectory Lib "kernel32" Alias
>"GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As
>Long

>If the function is called as "GetWindowsDirectory" instead of the alias
>"GetWindowsDirectoryA" it compiles fine.

>Any Ideas??

The alias name is supposed to be the real name of the procedure in the dll.
You Declare  your own Function name to be an Alias for the Real name.
Sveinung Larsen


Tue, 13 Jul 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. API call to get Netware user name from 32-bit client using MSFT Client for Netware

2. API call to get Netware user name from 32-bit client using MSFT Client for Netware

3. 32 bit equivalent of 16 bit API call GetModuleUsage

4. 16 bit API calls in VB 3 supported in 32 bit VB 4.0

5. 16-bit/32-bit API calls

6. How to create 32-bit DLL in Watcom C and call from 32-bit VB

7. Calling a user-written 32-bit dll from 32-bit vb 4.0

8. Calling 32-bit DLL function from 32-bit VB4 app

9. API calls - converting to 32 bit

10. Escape() API call & PDFWriter (32-bit)

11. 32 Bit Btrieve API call

12. API calls from ActiveX - must I make both 16 and 32 bit versions?l

 

 
Powered by phpBB® Forum Software