473,394 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

using dll for VC6.0 in C# project VS2008

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
Aug 26 '08 #1
0 1120

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Cirene | last post by:
I used to use the Web Deployment Project with my VS2005 projects. Now I've fully upgraded to VS2008. Do I have to download a new version of the Web Deployment Project? If so where can I find...
2
by: dmeglio | last post by:
Hello, I've just ported an ASP.NET project from VS 2003 to 2008. In 2003, I was using NUnit to test. Under 2008, I don't get a single DLL for my website, so I can't use NUnit anymore....
2
by: cmrchs | last post by:
Hello, I installed Visual Studio 2008 last week, created a web project and could run it. I had to deinstall it for some problems I had, installed it again, try to create a new web-project but...
0
by: Freddy Coal | last post by:
Hi, I would like make new projects in VS2008 (actually I work with VS2005) because in my opinion is more faster than VS2005, but in the moment I need only framework 2.0. Well my problem are with...
1
by: Ronald S. Cook | last post by:
When I convert a VS2005 web project to VS2008, there is no "Reference" folder. Also, when pou go to project properties, it doesn't look like the properties page like if you started a new VS2008...
1
jhardman
by: jhardman | last post by:
I'm working with my first real xbap project, and I have run into a real wall. Although my project runs just fine when debugging and I get no error while building, immediately as the publish finishes...
3
by: SvenV | last post by:
Hello, We created an application in Visual Studio 2003 with .NET 1.1. Now we want to convert this project to .NET 2.0 and want to develop in Visual Studio 2008 (yes I know this has .NET3.5)....
1
by: E11esar | last post by:
Hi there. I have a folder within my asp.net (c#) project in VS2008 called Files. Within this folder is a text file called files.txt. Is there a way to access this folder from the C# code...
3
by: jay123 | last post by:
hi all, i never knew this will be that big problem. actually i am given a Classic ASP project and asked to go through it. now i have VS2005 and VS2008 on my machine. is their any way i...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.