Hi,
I have a VB6 program that call a dll. I'm converting the program to c.net 2010. I'm building under x86. The dll was created with PowerBasic.
VB6 Code
Declare Function trm_Open Lib "TRM.DLL" (PathFileName As String, MultiUser As Long) As Long
UidFileName = "c:\user.trm"
multiUserMode = 1
hUidFile = trm_Open(UidFileName, multiUserMode)
c.net 2010
[DllImport(@"TRM.DLL")]
static extern int trm_Open(string pathFileName, int nMultiUser);
public int trmOpen(string pathFileName, int nMultiUser)
{
return trm_Open(pathFileName, nMultiUser);
}
string filename = "c:\user.trm";
int mu=1 ;
rtc = trmOpen(filename, mu);
I'm getting this error.
An unhandled exception of type 'System.DllNotFoundException' occurred in trmtest1.exe
Additional information: Unable to load DLL 'TRM.DLL': Invalid access to memory location. (Exception from HRESULT: 0x800703E6)
Thanks,
Mark