Click here to Skip to main content
15,889,808 members
Home / Discussions / C#
   

C#

 
AnswerRe: I got a list of processes in a list box, how do i get rid of the 'System.Diagno...' part? Pin
Curtis Schlak.28-Nov-05 12:41
Curtis Schlak.28-Nov-05 12:41 
QuestionHow to "%04i" in C#? Pin
peterchen28-Nov-05 11:57
peterchen28-Nov-05 11:57 
AnswerRe: How to "%04i" in C#? Pin
Christian Graus28-Nov-05 12:15
protectorChristian Graus28-Nov-05 12:15 
GeneralRe: How to "%04i" in C#? Pin
peterchen28-Nov-05 12:17
peterchen28-Nov-05 12:17 
GeneralRe: How to "%04i" in C#? Pin
Christian Graus28-Nov-05 12:18
protectorChristian Graus28-Nov-05 12:18 
QuestionConnecting to MSDE with Visual studio C# Pin
kourvoisier28-Nov-05 11:43
kourvoisier28-Nov-05 11:43 
AnswerRe: Connecting to MSDE with Visual studio C# Pin
Christian Graus28-Nov-05 12:16
protectorChristian Graus28-Nov-05 12:16 
QuestionPassing a struct from c# to c in vs.net Pin
spellman28-Nov-05 11:14
spellman28-Nov-05 11:14 
I am attempting to call legacy c code from C#. I've compiled the c code into a dll in VS.net and am trying to call one of its functions from C#. One of the parameters that the c function is looking for is a pointer to a structure( c_func(C_DEF_STRUCT *cStr) ). The structure is defined as follows:

typedef struct C_DEF_STRUCT {
char aChar;
long a_len;
long b_len;
long c_len;
long d_len;
long e_len;
long f_len;
long unsigned char *aPtr;
long unsigned char *bPtr;
long unsigned char *cPtr;
long unsigned char *dPtr;
long unsigned char *ePtr;
long unsigned char *fPtr;
long unsigned char *gPtr;
} C_DEF_STRUCT;

I created a struct in C# as follows:

[StructLayout(LayoutKind.Sequential)]
public struct DEF_STRUCT
{
public char aChar;
public Int32 a_length;
public Int32 b_length;
public Int32 c_length;
public Int32 d_length;
public Int32 e_length;
public Int32 f_length;
public Int32 g_length;
public Int32 size;
public byte[] aPtr;
public byte[] bPtr;
public byte[] cPtr;
public byte[] dPtr;
public byte[] ePtr;
public byte[] fPtr;
public byte[] gPtr;
}

On the C# side, I before calling the C function I did the following:

DEF_STRUCT myStruct = new DEF_STRUCT();
myStruct.aPtr = new byte[5000];

Then I proceeded to fill aPtr.

When calling the C function, I'm passing myStruct along as a reference ( c_func(ref myStruct) ).

The contents of aPtr is not getting sent over correctly. I get an address on the C side, but the contents of the array does not match what is on the C# side.

I'm not sure how to solve this problem. Any suggestions would be great.
QuestionIs there any other way to open a web page than Process.Start? Pin
Anthony Mushrow28-Nov-05 11:05
professionalAnthony Mushrow28-Nov-05 11:05 
Questionwindows default currency symbol Pin
Shahin7728-Nov-05 10:55
Shahin7728-Nov-05 10:55 
AnswerRe: windows default currency symbol Pin
leppie28-Nov-05 12:35
leppie28-Nov-05 12:35 
QuestionNull Reference Exception COM Objects Pin
thepolishguy28-Nov-05 10:34
thepolishguy28-Nov-05 10:34 
QuestionExtracting user's password for alternate authentication Pin
tantiboh28-Nov-05 10:18
tantiboh28-Nov-05 10:18 
AnswerRe: Extracting user's password for alternate authentication Pin
Colin Angus Mackay28-Nov-05 11:13
Colin Angus Mackay28-Nov-05 11:13 
QuestionText Colors and Outline Pin
Pende28-Nov-05 10:12
Pende28-Nov-05 10:12 
AnswerRe: Text Colors and Outline Pin
Christian Graus28-Nov-05 10:35
protectorChristian Graus28-Nov-05 10:35 
QuestionConditional compilation for 1.1 and 2.0 Pin
Roger Alsing28-Nov-05 9:58
Roger Alsing28-Nov-05 9:58 
AnswerRe: Conditional compilation for 1.1 and 2.0 Pin
Mark DeVol29-Nov-05 11:15
Mark DeVol29-Nov-05 11:15 
QuestionNeed a best possible solution/advice Pin
pavanbabut28-Nov-05 8:43
pavanbabut28-Nov-05 8:43 
AnswerRe: Need a best possible solution/advice Pin
Dan Neely28-Nov-05 9:32
Dan Neely28-Nov-05 9:32 
GeneralRe: Need a best possible solution/advice Pin
pavanbabut28-Nov-05 9:48
pavanbabut28-Nov-05 9:48 
QuestionHosted controls in a User Control Pin
Leyu28-Nov-05 8:41
Leyu28-Nov-05 8:41 
QuestionGarbage Collection Question (How to Prevent) Pin
CarolAnnLove28-Nov-05 8:24
CarolAnnLove28-Nov-05 8:24 
AnswerRe: Garbage Collection Question (How to Prevent) Pin
Judah Gabriel Himango28-Nov-05 9:12
sponsorJudah Gabriel Himango28-Nov-05 9:12 
QuestionStill stuck: Button, Numeric UpDown, and Paint Event Pin
...---...28-Nov-05 6:40
...---...28-Nov-05 6:40 

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.