M
Michael Chong
Another same issue on "NullReferenceException" :-
I have an (exe) executable program created in VB.NET 2003 that calls to a
MFC DLL written in VC++.NET 2003. I always get an error msg
"NullReferenceException: Object Reference Not Set to an Instance of an
Object" when my exe calls the following codes:
in VB.NET
Declare Function test Lib "C:\Cyob\IOComm\Debug\IOComm.dll" _
(ByVal a As Long, ByRef b As String) As Integer
Dim did As Integer
Dim ret As Integer
ret = test(PortHnd, did) //ERROR: Object Reference Not Set to an
Instance of an Object
in VC++.NET
extern "C" int APIENTRY test(HANDLE a, LPSTR b)
{
strcpy(b, "hello"); //ERROR: Object Reference Not Set to an
Instance of an Object
return 99;
}
Why is this happening? Any idea in solving such matter?
Thanks in Advance
Michael.
I have an (exe) executable program created in VB.NET 2003 that calls to a
MFC DLL written in VC++.NET 2003. I always get an error msg
"NullReferenceException: Object Reference Not Set to an Instance of an
Object" when my exe calls the following codes:
in VB.NET
Declare Function test Lib "C:\Cyob\IOComm\Debug\IOComm.dll" _
(ByVal a As Long, ByRef b As String) As Integer
Dim did As Integer
Dim ret As Integer
ret = test(PortHnd, did) //ERROR: Object Reference Not Set to an
Instance of an Object
in VC++.NET
extern "C" int APIENTRY test(HANDLE a, LPSTR b)
{
strcpy(b, "hello"); //ERROR: Object Reference Not Set to an
Instance of an Object
return 99;
}
Why is this happening? Any idea in solving such matter?
Thanks in Advance
Michael.