Click here to Skip to main content
15,924,402 members
Home / Discussions / C#
   

C#

 
GeneralRe: socket programing Pin
Judah Gabriel Himango15-Oct-06 10:38
sponsorJudah Gabriel Himango15-Oct-06 10:38 
QuestionUserControl event handling Pin
CoolASL13-Oct-06 5:01
CoolASL13-Oct-06 5:01 
AnswerRe: UserControl event handling Pin
Dave Kreskowiak13-Oct-06 7:00
mveDave Kreskowiak13-Oct-06 7:00 
AnswerRe: UserControl event handling Pin
Nader Elshehabi13-Oct-06 11:47
Nader Elshehabi13-Oct-06 11:47 
QuestionProblem using legacy C++ dll with C# Pin
JohnnyB71713-Oct-06 4:49
JohnnyB71713-Oct-06 4:49 
AnswerRe: Problem using legacy C++ dll with C# Pin
led mike13-Oct-06 7:58
led mike13-Oct-06 7:58 
GeneralRe: Problem using legacy C++ dll with C# Pin
JohnnyB71713-Oct-06 8:23
JohnnyB71713-Oct-06 8:23 
AnswerRe: Problem using legacy C++ dll with C# Pin
Nader Elshehabi13-Oct-06 11:43
Nader Elshehabi13-Oct-06 11:43 
Hello

I'm not sure if this is the problem, but if I were you I'd give these points attention in this particular order:

1- Your nDevice parameter is a DWORD which is 32bits long, while in your C# code you pass a long which is 64bits long. You should try passing an int32 instead.

2- The second parameter is char* while you pass it IntPtr.. I suggest you pass a StringBuilder class instead. If you do you'd have to remove the unsafe keyword.

3- You are making your C# declaration a bit complex. Why?? Try this P/Invoke:
[DllImport(@"C:\Documents and Settings\jbroderick\My Documents\Visual Studio 2005\Projects\\USB_D2XX_App\LogiComm2GD.dll",
ExactSpelling = true,
CharSet = CharSet.Auto,
CallingConvention = CallingConvention.Cdecl)]
public static extern bool ExGetDeviceSerialNumber(long nDevice, IntPtr ptr);

Notice that IMO the unsafe keyword is not necessary.

4- Calling another function from the exported function? I have doubts about this part.Try copy/paste the code in the second function into the first.

5- Comment these line for the sake of debugging, if they are not necessary:
AFX_MANAGE_STATE(AfxGetStaticModuleState());
TRACE(_T("Entering LogiComm2GD ExGetDeviceSerialNumber\n"));

Also elaborate what does this macro do.

I hope this helps.

RegardsRose | [Rose]

GeneralRe: Problem using legacy C++ dll with C# Pin
JohnnyB71716-Oct-06 9:17
JohnnyB71716-Oct-06 9:17 
QuestionAdding a button (or other controls) to a form i have handle to Pin
ranzask13-Oct-06 3:34
ranzask13-Oct-06 3:34 
AnswerRe: Adding a button (or other controls) to a form i have handle to Pin
Christian Graus13-Oct-06 3:50
protectorChristian Graus13-Oct-06 3:50 
QuestionSecurity Centre API Pin
Soundman32.213-Oct-06 2:47
Soundman32.213-Oct-06 2:47 
QuestionExport data to datagerid Pin
Mamphekgo13-Oct-06 2:20
Mamphekgo13-Oct-06 2:20 
AnswerRe: Export data to datagerid Pin
basumca14-Oct-06 0:11
basumca14-Oct-06 0:11 
QuestionMulticolor Ellipse Pin
The underdog13-Oct-06 2:14
The underdog13-Oct-06 2:14 
AnswerRe: Multicolor Ellipse Pin
rah_sin13-Oct-06 2:45
professionalrah_sin13-Oct-06 2:45 
GeneralRe: Multicolor Ellipse Pin
The underdog13-Oct-06 3:07
The underdog13-Oct-06 3:07 
AnswerRe: Multicolor Ellipse Pin
mav.northwind13-Oct-06 5:21
mav.northwind13-Oct-06 5:21 
QuestionMSMQ queuing vba process sends, C# process receive Pin
rodrigorodriquez13-Oct-06 2:01
rodrigorodriquez13-Oct-06 2:01 
QuestionCall C# Code within DTS Pin
Zeeshan Gulzar13-Oct-06 1:25
Zeeshan Gulzar13-Oct-06 1:25 
QuestionNewbie: Problem invoking?? Pin
Phillip Hodges13-Oct-06 1:07
Phillip Hodges13-Oct-06 1:07 
AnswerRe: Newbie: Problem invoking?? Pin
Christian Graus13-Oct-06 1:24
protectorChristian Graus13-Oct-06 1:24 
QuestionHow to display a word document in a winform Pin
JollyBob197413-Oct-06 0:48
JollyBob197413-Oct-06 0:48 
QuestionProgrammer's "I need your help" Pin
I A Khan13-Oct-06 0:42
I A Khan13-Oct-06 0:42 
QuestionWhere can i get a machine specific code of some sort? Pin
Anthony Mushrow12-Oct-06 23:48
professionalAnthony Mushrow12-Oct-06 23:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.