Update declare statement (1 Viewer)

foxtet

Registered User.
Local time
Today, 08:30
Joined
May 21, 2011
Messages
129
Dear Experts,

I have used custom security module to login the database. This module works fine with 32bit systems. when attempt to run in 64bit it generates the error find in attached.

I have attached sample login module. Can any one update declare statements as mentioned in the error message. so that module can successfully be loaded on 64bit os?

foxtet
 

Attachments

  • AppError.PNG
    AppError.PNG
    37.6 KB · Views: 91
  • Advanced_Custom_Security.zip
    259.1 KB · Views: 74

Ranman256

Well-known member
Local time
Today, 00:30
Joined
Apr 9, 2015
Messages
4,339
use PTRSAFE.

#if Win64 then
Declare PtrSafe Function MyMathFunc Lib "User32" (ByVal N As LongLong) As LongLong
#else
Declare Function MyMathFunc Lib "User32" (ByVal N As Long) As Long
#end if
 

foxtet

Registered User.
Local time
Today, 08:30
Joined
May 21, 2011
Messages
129
use PTRSAFE.

#if Win64 then
Declare PtrSafe Function MyMathFunc Lib "User32" (ByVal N As LongLong) As LongLong
#else
Declare Function MyMathFunc Lib "User32" (ByVal N As Long) As Long
#end if

Which part of the code do I have to add this? I don't understand yet
 

foxtet

Registered User.
Local time
Today, 08:30
Joined
May 21, 2011
Messages
129
The error actually occurring some part of the code given below
from this code where and what additional lines of code to be added?

Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX <> 0 Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = ""
End If
End Function
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:30
Joined
May 7, 2009
Messages
19,228
#if win64 then
Private Declare PtrSafe Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
#else
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
#end if
Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX <> 0 Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = ""
End If
End Function
 

Users who are viewing this thread

Top Bottom