vba - How can I declare function without ptrsafe in 64bit environmnet? -


my vb6 program running on 32bit. have move 64bit.

the lib declare below code,the system seem can't it. declare:

public declare function logonuser lib "advapi32.dll" _ alias "logonusera" (byval lpszusername string, _ byval lpszdomain string, byval lpszpassword string, _ byval dwlogontype long, byval dwlogonprovider long, _ phtoken long) long  public declare function impersonateloggedonuser lib "advapi32.dll" (byval htoken long) long public declare function reverttoself lib "advapi32.dll" () long public declare function closehandle lib "kernel32" (byval hobject long) long 

run code:

public sub logon(byval stradminuser string, byval _     stradminpassword string, byval stradmindomain string)     dim lngtokenhandle long     dim lnglogontype long     dim lnglogonprovider long     dim blnresult boolean      lnglogontype = 2     lnglogonprovider = 0      blnresult = reverttoself()      blnresult = logonuser(stradminuser, stradmindomain, stradminpassword, _     lnglogontype, lnglogonprovider, _     lngtokenhandle)      blnresult = impersonateloggedonuser(lngtokenhandle)     closehandle (lngtokenhandle)  end sub 

i got error message

error 91:object variable or block variable not set

almost people need add "ptrsafe" after declare there no ptrsafe in vb6.

how can declare function lib without "ptrsafe" in 64bit , vb6 ?

almost people need add "ptrsafe" after declare there no ptrsafe in vb6. how can declare function lib without "ptrsafe" in 64bit , vb6 ?

vba needs able deal 64 bit windows when run within 64 bit application such 1 of programs 64 bit office suite.

vb6 runs on own forever & 32 bit process, not need 64 bit aware 64 bit windows happily emulates 32 bit code no additional steps required.

because of pointer-safe types not needed, use 32 bit convention (long) in vb6.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -