I am using Access 2003 and no Api call will work??
All my Api calls return EMPTY .
Some examples I tried:
[blue]
Declare Function apiGetVersion Lib "kernel32" Alias "GetVersion" () As Long
Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Declare Function api_GetUserName Lib "c:\windows\system32\advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function gethostbyname Lib "WSOCK32.DLL" (ByVal hostname As String) As Long
Private Declare Function inet_addr Lib "WSOCK32.DLL" (ByVal s As String) As Long[/blue]
When calling no errors (err.LastDllError=0) occur but the return value is always zero.
Like in the next simple example where lngPC will be set to 0:
[blue]1. Private Declare Function GetComputerName Lib "Kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
2.
3. Public Function GetPcName() As String
4. Dim strBuf As String * 16, strPcName As String, lngPc As Long
5. lngPc = GetComputerName(strBuf, Len(strBuf))
6. If lngPc <> 0 Then
7. strPcName = Left(strBuf, InStr(strBuf, vbNullChar) - 1)
8. GetPcName = strPcName
9. Else
10. GetPcName = vbNullString
11. End If
12. End Function[/blue]
I use MS Access 2003 and my computer(s) run Windows XP Pro (SP2).
The last time I needed to use Api calls was with Access 8 and Windows 95, can’t remember that is was such a struggle.
I really hope someone can help me with this.
Thanks,
Raymond
All my Api calls return EMPTY .
Some examples I tried:
[blue]
Declare Function apiGetVersion Lib "kernel32" Alias "GetVersion" () As Long
Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Declare Function api_GetUserName Lib "c:\windows\system32\advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function gethostbyname Lib "WSOCK32.DLL" (ByVal hostname As String) As Long
Private Declare Function inet_addr Lib "WSOCK32.DLL" (ByVal s As String) As Long[/blue]
When calling no errors (err.LastDllError=0) occur but the return value is always zero.
Like in the next simple example where lngPC will be set to 0:
[blue]1. Private Declare Function GetComputerName Lib "Kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
2.
3. Public Function GetPcName() As String
4. Dim strBuf As String * 16, strPcName As String, lngPc As Long
5. lngPc = GetComputerName(strBuf, Len(strBuf))
6. If lngPc <> 0 Then
7. strPcName = Left(strBuf, InStr(strBuf, vbNullChar) - 1)
8. GetPcName = strPcName
9. Else
10. GetPcName = vbNullString
11. End If
12. End Function[/blue]
I use MS Access 2003 and my computer(s) run Windows XP Pro (SP2).
The last time I needed to use Api calls was with Access 8 and Windows 95, can’t remember that is was such a struggle.
I really hope someone can help me with this.
Thanks,
Raymond