Click here to Skip to main content
15,910,877 members
Home / Discussions / C#
   

C#

 
GeneralRe: what is method group? Pin
George_George11-Sep-08 15:00
George_George11-Sep-08 15:00 
GeneralRe: what is method group? Pin
DaveyM6910-Sep-08 2:05
professionalDaveyM6910-Sep-08 2:05 
GeneralRe: what is method group? Pin
George_George11-Sep-08 15:01
George_George11-Sep-08 15:01 
GeneralRe: what is method group? Pin
Daniel Grunwald10-Sep-08 1:49
Daniel Grunwald10-Sep-08 1:49 
GeneralRe: what is method group? Pin
leppie10-Sep-08 1:56
leppie10-Sep-08 1:56 
GeneralRe: what is method group? Pin
Daniel Grunwald10-Sep-08 1:59
Daniel Grunwald10-Sep-08 1:59 
GeneralRe: what is method group? Pin
George_George11-Sep-08 15:03
George_George11-Sep-08 15:03 
GeneralRe: what is method group? Pin
leppie11-Sep-08 20:03
leppie11-Sep-08 20:03 
GeneralRe: what is method group? Pin
George_George11-Sep-08 20:23
George_George11-Sep-08 20:23 
GeneralRe: what is method group? Pin
George_George11-Sep-08 15:07
George_George11-Sep-08 15:07 
GeneralRe: what is method group? Pin
George_George11-Sep-08 15:06
George_George11-Sep-08 15:06 
GeneralRe: what is method group? Pin
Daniel Grunwald11-Sep-08 15:17
Daniel Grunwald11-Sep-08 15:17 
GeneralRe: what is method group? Pin
George_George11-Sep-08 15:45
George_George11-Sep-08 15:45 
QuestionQuerying what kind of mail server is active on a machine Pin
Matt Fishbeck10-Sep-08 0:29
Matt Fishbeck10-Sep-08 0:29 
AnswerRe: Querying what kind of mail server is active on a machine Pin
leppie10-Sep-08 0:34
leppie10-Sep-08 0:34 
GeneralRe: Querying what kind of mail server is active on a machine Pin
Matt Fishbeck10-Sep-08 0:37
Matt Fishbeck10-Sep-08 0:37 
GeneralRe: Querying what kind of mail server is active on a machine Pin
leppie10-Sep-08 0:39
leppie10-Sep-08 0:39 
GeneralRe: Querying what kind of mail server is active on a machine Pin
leppie10-Sep-08 0:39
leppie10-Sep-08 0:39 
GeneralRe: Querying what kind of mail server is active on a machine Pin
Matt Fishbeck10-Sep-08 0:56
Matt Fishbeck10-Sep-08 0:56 
QuestionHow can I use a C++ struct from a C# app? Pin
verence33310-Sep-08 0:29
verence33310-Sep-08 0:29 
Hello!

I'm starting to use C#, and I feel lost right now.

I've got a "somestruct.h" file with a C++ struct:

struct SOMESTRUCT
{
TCHAR Field1[100];
int Field2;
double Field3;
};

And, in a C++ class, I have a function that returns a SOMESTRUCT:

SOMESTRUCT someFunction();

Now I have a C# app which will call the C++ function. I have the C++ code in a DLL and I try to import the DLL so I can call that function:

[DllImport("myDLL.dll", CharSet = CharSet.Auto)]
static extern SOMESTRUCT someFunction();

Problem is: my C# app doesn't know the SOMESTRUCT struct. I can't import "somestruct.h" in C# and I really don't know how could I use that function.

I think maybe I could make a managed version of the struct SOMESTRUCT, but I don't know how to transform a fixed-size char array (Field1). If I transform it to a String it doesn't work properly.

I have also read that I could make a wrapper of the struct to get it work from C#, but I just cannot find an easy-to-understand, newbie-suitable, complete example of how to do it.

Please, could somebody help me? Smile | :)
AnswerRe: How can I use a C++ struct from a C# app? Pin
leppie10-Sep-08 0:31
leppie10-Sep-08 0:31 
GeneralRe: How can I use a C++ struct from a C# app? Pin
verence33310-Sep-08 0:47
verence33310-Sep-08 0:47 
GeneralRe: How can I use a C++ struct from a C# app? Pin
leppie10-Sep-08 0:59
leppie10-Sep-08 0:59 
GeneralRe: How can I use a C++ struct from a C# app? Pin
verence33310-Sep-08 1:14
verence33310-Sep-08 1:14 
GeneralRe: How can I use a C++ struct from a C# app? Pin
leppie10-Sep-08 1:19
leppie10-Sep-08 1:19 

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.