Click here to Skip to main content
15,908,115 members
Home / Discussions / C#
   

C#

 
GeneralRe: how can made Login Form in c#.net?how can coding any easy in dot net or c#.net?please send me any software Pin
EliottA6-Jan-09 6:56
EliottA6-Jan-09 6:56 
AnswerRe: how can made Login Form in c#.net?how can coding any easy in dot net or c#.net?please send me any software Pin
Pete O'Hanlon6-Jan-09 10:39
mvePete O'Hanlon6-Jan-09 10:39 
QuestionCall DataBindings.Clear() on multiple, similarly named controls [modified] Pin
Jaffa Bobfluff6-Jan-09 6:26
Jaffa Bobfluff6-Jan-09 6:26 
AnswerRe: Call DataBindings.Clear() on multiple, similarly named controls Pin
Jaffa Bobfluff12-Jan-09 23:10
Jaffa Bobfluff12-Jan-09 23:10 
QuestionMarshalling pointers to structs Pin
Quiltfish6-Jan-09 5:50
Quiltfish6-Jan-09 5:50 
GeneralRe: Marshalling pointers to structs Pin
Luc Pattyn6-Jan-09 6:16
sitebuilderLuc Pattyn6-Jan-09 6:16 
GeneralRe: Marshalling pointers to structs [modified] Pin
Quiltfish6-Jan-09 8:56
Quiltfish6-Jan-09 8:56 
GeneralRe: Marshalling pointers to structs Pin
Luc Pattyn6-Jan-09 12:42
sitebuilderLuc Pattyn6-Jan-09 12:42 
OK,

be careful with element sizes: C/C++ long is 4B (C# long is 8B); C/C++ char often is 1B
(C# char is 2B); pointers are 4B/8B depending on Win32/Win64 (IntPtr should take care of that).

AFAIK order is preserved if all elements are naturally aligned (e.g. each int got preceded by a multiple of 4 data bytes, so there are no gaps to get alignment; if there are gaps, I expect a reordering to obtain minimal total size).

You can use explicit marshaling specification, as in:
	[StructLayout(LayoutKind.Explicit, CharSet=CharSet.Ansi)]
	public unsafe struct vc1_sBlk {
		[FieldOffset(0), MarshalAs(UnmanagedType.I4)]
		public int eBlkType;
		[FieldOffset(4), MarshalAs(UnmanagedType.AsAny)]
		public byte Coded;
...


Obviously it should match the native side, so it all depends on how they coded it,
and what tools and switches got used (read the doc!!).

If you have running native code and can influence the data it generates, you can
experiment (say first accept it as all ints, the managed/native border does not care
about it) and look at the data, then start feeding it the correct information about the struct layout.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Love, happiness and fewer bugs for 2009!


QuestionSetter for Property bubbling up a level? Pin
Eric Burns6-Jan-09 4:49
Eric Burns6-Jan-09 4:49 
AnswerRe: Setter for Property bubbling up a level? Pin
J4amieC6-Jan-09 5:30
J4amieC6-Jan-09 5:30 
AnswerRe: Setter for Property bubbling up a level? Pin
Wendelius6-Jan-09 5:30
mentorWendelius6-Jan-09 5:30 
AnswerRe: Setter for Property bubbling up a level? Pin
benjymous6-Jan-09 5:31
benjymous6-Jan-09 5:31 
AnswerRe: Setter for Property bubbling up a level? Pin
Henry Minute6-Jan-09 5:48
Henry Minute6-Jan-09 5:48 
GeneralRe: Setter for Property bubbling up a level? Pin
Eric Burns6-Jan-09 9:17
Eric Burns6-Jan-09 9:17 
GeneralRe: Setter for Property bubbling up a level? Pin
Henry Minute6-Jan-09 9:20
Henry Minute6-Jan-09 9:20 
GeneralRe: Setter for Property bubbling up a level? Pin
Henry Minute6-Jan-09 10:05
Henry Minute6-Jan-09 10:05 
GeneralRe: Setter for Property bubbling up a level? Pin
Henry Minute6-Jan-09 13:48
Henry Minute6-Jan-09 13:48 
GeneralRe: Setter for Property bubbling up a level? Pin
Henry Minute6-Jan-09 13:51
Henry Minute6-Jan-09 13:51 
GeneralRe: Setter for Property bubbling up a level? Pin
Eric Burns7-Jan-09 6:55
Eric Burns7-Jan-09 6:55 
GeneralRe: Setter for Property bubbling up a level? Pin
Henry Minute7-Jan-09 7:17
Henry Minute7-Jan-09 7:17 
AnswerOT: Is it really called 'class Object'? Pin
Jon Rista6-Jan-09 10:14
Jon Rista6-Jan-09 10:14 
GeneralRe: OT: Is it really called 'class Object'? Pin
Eric Burns6-Jan-09 11:11
Eric Burns6-Jan-09 11:11 
GeneralRe: OT: Is it really called 'class Object'? Pin
Jon Rista6-Jan-09 11:38
Jon Rista6-Jan-09 11:38 
AnswerRe: Setter for Property bubbling up a level? Pin
Pete O'Hanlon6-Jan-09 10:29
mvePete O'Hanlon6-Jan-09 10:29 
QuestionSource code from visio flow chart Pin
sree6-Jan-09 4:14
sree6-Jan-09 4:14 

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.