Reputation: 13
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?
Upvotes: 1
Views: 1441
Reputation: 17
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.
Upvotes: 0
Reputation: 941218
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.
Upvotes: 4