Click here to Skip to main content
15,902,938 members
Home / Discussions / C#
   

C#

 
Generalconvert c/c++ header to c# Pin
savage_8-Jun-05 16:51
savage_8-Jun-05 16:51 
GeneralRe: convert c/c++ header to c# Pin
Christian Graus8-Jun-05 16:53
protectorChristian Graus8-Jun-05 16:53 
GeneralRe: convert c/c++ header to c# Pin
savage_8-Jun-05 16:59
savage_8-Jun-05 16:59 
GeneralRe: convert c/c++ header to c# Pin
Christian Graus8-Jun-05 17:11
protectorChristian Graus8-Jun-05 17:11 
GeneralRe: convert c/c++ header to c# Pin
savage_8-Jun-05 17:20
savage_8-Jun-05 17:20 
GeneralRe: convert c/c++ header to c# Pin
Christian Graus8-Jun-05 17:23
protectorChristian Graus8-Jun-05 17:23 
GeneralRe: convert c/c++ header to c# [EDITED] Pin
Dave Kreskowiak9-Jun-05 8:49
mveDave Kreskowiak9-Jun-05 8:49 
GeneralRe: convert c/c++ header to c# [EDITED] Pin
savage_9-Jun-05 11:18
savage_9-Jun-05 11:18 
what i dont understand is the offsets. heres where im getting stuck:

struct R_OMNI_LINK_MESSAGE {
unsigned char messagelength // offset 0
unionX {
unsigned char data[255] // offset 4?
struct { // this struct has no name?
unsigned char messagetype // since its inside union this ones offset is 4?
unionY {
struct { // NAME_DATA
unsigned char itemtype // offset ??
} // struct name_data
} // unionY
} // struct
} // unionX
} // r_omni_link_message

this is my c# code for the above bit of code
[StructLayout(LayoutKind.Explicit)]
public struct R_OMNI_LINK_MESSAGE
{
[FieldOffset(0)] public int MessageLength;
[FieldOffset(4)][MarshalAs(UnmanagedType.ByValTStr, SizeConst=255)] public string Data;
[FieldOffset(??)] public int MessageType;

//olmNAME_DATA (8 bit)
[FieldOffset(??)][MarshalAs(UnmanagedType.LPStr)] public string ItemType8;
[FieldOffset(??)][MarshalAs(UnmanagedType.LPStr)] public string ItemNumber8;
[FieldOffset(??)][MarshalAs(UnmanagedType.LPStr, SizeConst=16)] public string ItemName8;

?? i dont know the offsets

Kids don't try this at home!
GeneralRe: convert c/c++ header to c# [EDITED] Pin
Dave Kreskowiak9-Jun-05 15:24
mveDave Kreskowiak9-Jun-05 15:24 
Questioncan someone explain this to me??? Pin
Serenena8-Jun-05 16:40
Serenena8-Jun-05 16:40 
AnswerRe: can someone explain this to me??? Pin
Christian Graus8-Jun-05 16:54
protectorChristian Graus8-Jun-05 16:54 
GeneralRe: can someone explain this to me??? Pin
Serenena8-Jun-05 18:49
Serenena8-Jun-05 18:49 
GeneralRe: can someone explain this to me??? Pin
Christian Graus8-Jun-05 18:52
protectorChristian Graus8-Jun-05 18:52 
GeneralRe: can someone explain this to me??? Pin
Serenena8-Jun-05 19:16
Serenena8-Jun-05 19:16 
GeneralRe: can someone explain this to me??? Pin
Christian Graus8-Jun-05 19:22
protectorChristian Graus8-Jun-05 19:22 
GeneralRe: can someone explain this to me??? Pin
Serenena8-Jun-05 19:34
Serenena8-Jun-05 19:34 
GeneralRe: can someone explain this to me??? Pin
Christian Graus8-Jun-05 19:36
protectorChristian Graus8-Jun-05 19:36 
GeneralRe: can someone explain this to me??? Pin
Serenena8-Jun-05 20:14
Serenena8-Jun-05 20:14 
GeneralRe: can someone explain this to me??? Pin
Christian Graus9-Jun-05 0:36
protectorChristian Graus9-Jun-05 0:36 
GeneralRe: can someone explain this to me??? Pin
Dave Kreskowiak9-Jun-05 8:55
mveDave Kreskowiak9-Jun-05 8:55 
GeneralRe: can someone explain this to me??? Pin
Christian Graus9-Jun-05 11:19
protectorChristian Graus9-Jun-05 11:19 
GeneralRe: can someone explain this to me??? Pin
Dave Kreskowiak9-Jun-05 15:26
mveDave Kreskowiak9-Jun-05 15:26 
GeneralRe: can someone explain this to me??? Pin
Christian Graus9-Jun-05 15:30
protectorChristian Graus9-Jun-05 15:30 
GeneralRe: can someone explain this to me??? Pin
Dave Kreskowiak9-Jun-05 16:22
mveDave Kreskowiak9-Jun-05 16:22 
GeneralRe: can someone explain this to me??? Pin
Christian Graus9-Jun-05 16:24
protectorChristian Graus9-Jun-05 16:24 

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.