简体   繁体   中英

32bit dll used by VB6 program doesn't work in 64bit Win 7

1) a 32bit dll is placed in C:\\Windows\\SysWOW64

2) Registered using regasm.exe

3) While compiling, i set the target cpu to x86

I can add reference in my vb6 program but when i try to call the method within the dll, it failed. Error message as follow :

 "Runtime Error '-2147467261' object instance not set to an instance of an object"

Codes here :

Set m_objCLogon = CreateObject("CommonLogon.Logon")
strResult = m_objCLogon.ValidateLogin(p_strUserID, p_strEncryptedPwd, p_strAppID)

The code is pretty simple, just passing in the credentials for validation.

Anyone knows which part has gone wrong?

Clearly there's nothing wrong with the registration, the error message is a .NET exception message. Your code is bombing on a NullReferenceException. That's a very common exception and it is (nearly) always caused by a bug in your code.

You'll need to debug your code. Do so with Project + Properties, Debug tab. Select "Start external program" and set it to your vb6 program or c:\\program files\\microsoft visual studio\\vb6\\vb6.exe. Then Debug + Exceptions, tick the Thrown box for CLR exceptions. Press F5 to start.

If it were me, I would copy the DLL to the System32 directory (since it IS a VB6 32bit DLL) and I would use regsvr32 c:\\Windows\\System32\\MyDLL.DLL. Just like using it on any other 32 bit machine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM