Click here to Skip to main content
15,915,600 members
Home / Discussions / C#
   

C#

 
GeneralRe: Trace output to command window. Pin
Member 232448329-Jan-09 12:01
Member 232448329-Jan-09 12:01 
GeneralRe: Trace output to command window. Pin
Wendelius29-Jan-09 12:11
mentorWendelius29-Jan-09 12:11 
GeneralRe: Trace output to command window. Pin
Member 232448329-Jan-09 13:18
Member 232448329-Jan-09 13:18 
GeneralRe: Trace output to command window. Pin
N a v a n e e t h29-Jan-09 14:52
N a v a n e e t h29-Jan-09 14:52 
GeneralRe: Trace output to command window. Pin
Member 23244832-Feb-09 6:58
Member 23244832-Feb-09 6:58 
QuestionFile Acess Pin
ziwez029-Jan-09 9:57
ziwez029-Jan-09 9:57 
AnswerRe: File Acess Pin
Wendelius29-Jan-09 10:04
mentorWendelius29-Jan-09 10:04 
QuestionMarshalling complex structures Pin
faehne29-Jan-09 9:46
faehne29-Jan-09 9:46 
Hallo - i hope somebody can help me....

i want to call a c-function with this code:

struct StrBox
{
 char str[30];
};

struct StructBox
{
 StrBox * box;
};

DLLIMPORT char * TestStrBox(StructBox *sb);


i used this c#-code to call it:

	[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
	struct StrBox
	{
		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 30)]
		public string str;
	};
	
	[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
	struct StructBox
	{
		[MarshalAs(UnmanagedType.LPStruct)]
		public StrBox box;
	};
...
		StructBox b = new StructBox();
		b.box.str = "Hallo Welt!!!";
		string str = TestStrBox(b);


but if execute it, i get:

Ausnahme System.TypeLoadException wurde im ausgeführten Programm ausgelöst:
Cannot marshal field 'box' of type 'marshal.StructBox': Invalid managed/unmanaged type combination (this value type must be paired with Struct).

So i think it have a problem, with the struct in the struct... but the struct HAVE to be in the struct
(this is just a test, who reflects a real issue).

Hope... somebody have an idea.
Sooo. Many thx in advance
AnswerRe: Marshalling complex structures Pin
Luc Pattyn29-Jan-09 13:55
sitebuilderLuc Pattyn29-Jan-09 13:55 
GeneralRe: Marshalling complex structures Pin
faehne29-Jan-09 14:01
faehne29-Jan-09 14:01 
AnswerRe: Marshalling complex structures [modified] Pin
Luc Pattyn29-Jan-09 14:28
sitebuilderLuc Pattyn29-Jan-09 14:28 
QuestionRestarting a form Pin
Lodeclaw29-Jan-09 9:32
Lodeclaw29-Jan-09 9:32 
AnswerRe: Restarting a form Pin
Wendelius29-Jan-09 9:40
mentorWendelius29-Jan-09 9:40 
GeneralRe: Restarting a form Pin
Lodeclaw29-Jan-09 9:54
Lodeclaw29-Jan-09 9:54 
GeneralRe: Restarting a form Pin
Wendelius29-Jan-09 10:05
mentorWendelius29-Jan-09 10:05 
AnswerRe: Restarting a form Pin
Lodeclaw29-Jan-09 10:08
Lodeclaw29-Jan-09 10:08 
GeneralRe: Restarting a form Pin
Wendelius29-Jan-09 10:15
mentorWendelius29-Jan-09 10:15 
Questionhow to connect oracle database to form in c# in visual studio Pin
Saurabh_nitp29-Jan-09 8:25
Saurabh_nitp29-Jan-09 8:25 
AnswerRe: how to connect oracle database to form in c# in visual studio Pin
vaghelabhavesh29-Jan-09 8:28
vaghelabhavesh29-Jan-09 8:28 
GeneralRe: how to connect oracle database to form in c# in visual studio Pin
musefan29-Jan-09 8:30
musefan29-Jan-09 8:30 
GeneralRe: how to connect oracle database to form in c# in visual studio Pin
vaghelabhavesh29-Jan-09 8:33
vaghelabhavesh29-Jan-09 8:33 
GeneralRe: how to connect oracle database to form in c# in visual studio Pin
musefan29-Jan-09 8:35
musefan29-Jan-09 8:35 
AnswerRe: how to connect oracle database to form in c# in visual studio Pin
musefan29-Jan-09 8:29
musefan29-Jan-09 8:29 
AnswerRe: how to connect oracle database to form in c# in visual studio Pin
Pete O'Hanlon29-Jan-09 8:33
mvePete O'Hanlon29-Jan-09 8:33 
QuestionHow To get MCTS papers? Pin
Roney29-Jan-09 7:59
Roney29-Jan-09 7:59 

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.