T
tomb
In my C# Windows Form project (VS2008) I am using dll which has been
written for Visual C++ 6.0.
When I plug ethernet cable to device and my pc I got: "Attempted to
read or write protected memory. This is often an indication that other
memory is corrupt."
in MXEIO_Connect() function call. I don't have any error when i am not
connected to device.
My c# project:
public partial class Form1 : Form
{
[DllImport("MXIO.dll")]
private static extern int MXEIO_Init();
[DllImport("MXIO.dll")]
//private static unsafe extern int MXEIO_Connect(char
*szIP,int port, long timeout,int *hConnect);
private static unsafe extern int MXEIO_Connect(string szIP,
Int32 port, Int32 timeout, IntPtr hConnect);
public Form1()
{
InitializeComponent();
label1.Text = "ON";//should be last state!
label3.Text = MXEIO_Init().ToString();
unsafe
{ IntPtr hConn = IntPtr.Zero;
MXEIO_Connect("192.168.127.254", 502, 2000, hConn);
;
}
MXEIO_Exit();
}
MXIO.h MXIO library header file for C/C+:
MXIOEXPORT int CALLBACK MXEIO_Connect(
char * szIP,
WORD wPort,
DWORD dwTimeOut,
int * hConnection );
Can anybody tell me what am I doing wrong?
Thanks in advance.
Tom
written for Visual C++ 6.0.
When I plug ethernet cable to device and my pc I got: "Attempted to
read or write protected memory. This is often an indication that other
memory is corrupt."
in MXEIO_Connect() function call. I don't have any error when i am not
connected to device.
My c# project:
public partial class Form1 : Form
{
[DllImport("MXIO.dll")]
private static extern int MXEIO_Init();
[DllImport("MXIO.dll")]
//private static unsafe extern int MXEIO_Connect(char
*szIP,int port, long timeout,int *hConnect);
private static unsafe extern int MXEIO_Connect(string szIP,
Int32 port, Int32 timeout, IntPtr hConnect);
public Form1()
{
InitializeComponent();
label1.Text = "ON";//should be last state!
label3.Text = MXEIO_Init().ToString();
unsafe
{ IntPtr hConn = IntPtr.Zero;
MXEIO_Connect("192.168.127.254", 502, 2000, hConn);
;
}
MXEIO_Exit();
}
MXIO.h MXIO library header file for C/C+:
MXIOEXPORT int CALLBACK MXEIO_Connect(
char * szIP,
WORD wPort,
DWORD dwTimeOut,
int * hConnection );
Can anybody tell me what am I doing wrong?
Thanks in advance.
Tom