Click here to Skip to main content
15,890,506 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: User controls in toolbox? Pin
Jörgen Sigvardsson8-Feb-03 9:14
Jörgen Sigvardsson8-Feb-03 9:14 
GeneralRe: User controls in toolbox? Pin
leppie8-Feb-03 9:23
leppie8-Feb-03 9:23 
AnswerRe: User controls in toolbox? Pin
James T. Johnson8-Feb-03 12:33
James T. Johnson8-Feb-03 12:33 
GeneralRe: User controls in toolbox? Pin
Jörgen Sigvardsson8-Feb-03 13:00
Jörgen Sigvardsson8-Feb-03 13:00 
Generalusing Process.Container Pin
Kiff5-Feb-03 12:42
Kiff5-Feb-03 12:42 
GeneralXmlSerializer needs default constructor Pin
moredip5-Feb-03 6:25
moredip5-Feb-03 6:25 
GeneralRe: XmlSerializer needs default constructor Pin
Giles13-Feb-03 5:50
Giles13-Feb-03 5:50 
GeneralNeed help regarding marshaling Pin
Thomas Freudenberg5-Feb-03 4:50
Thomas Freudenberg5-Feb-03 4:50 
Hi all,

in my C# app I have to call a function in a legacy Win32 DLL. This function fills a complex struct. Unfortunately, I don't know how to port the data structure to .NET. Here's a simple example:

public class Test
{
    [StructLayout(LayoutKind.Sequential)]
    public class Test
    {
        int i;
    }
 
    [StructLayout(LayoutKind.Sequential)]
    public class Test2
    {
        [MarshalAs(UnmanagedType.ByValArray, SizeConst=10)]
        public Test1[] tests;
    }
 
    public Test()
    {
        int size = Marshal.SizeOf(typeof(Test2));
    }
}
In the constructor, Marshal.SizeOf throws the exception Type Test2 can not be marshaled as an unmanaged structure; no meaningful size or offset can be computed.

How do I marshal fixed size arrays of struct properly?

Thanks in advance.

Regards
Thomas


Disclaimer:
Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.

GeneralRe: Need help regarding marshaling Pin
Heath Stewart5-Feb-03 4:57
protectorHeath Stewart5-Feb-03 4:57 
GeneralRe: Need help regarding marshaling Pin
Thomas Freudenberg5-Feb-03 5:03
Thomas Freudenberg5-Feb-03 5:03 
GeneralRe: Need help regarding marshaling Pin
leppie5-Feb-03 6:12
leppie5-Feb-03 6:12 
GeneralRe: Need help regarding marshaling Pin
Thomas Freudenberg5-Feb-03 6:27
Thomas Freudenberg5-Feb-03 6:27 
GeneralRe: Need help regarding marshaling Pin
leppie5-Feb-03 7:00
leppie5-Feb-03 7:00 
GeneralRe: Need help regarding marshaling Pin
Thomas Freudenberg5-Feb-03 7:05
Thomas Freudenberg5-Feb-03 7:05 
GeneralProblem with ASPNET Worker Process (aspnet_wp.exe) Pin
Vasudevan Deepak Kumar4-Feb-03 22:40
Vasudevan Deepak Kumar4-Feb-03 22:40 
GeneralRe: Problem with ASPNET Worker Process (aspnet_wp.exe) Pin
leppie5-Feb-03 10:19
leppie5-Feb-03 10:19 
GeneralRe: Problem with ASPNET Worker Process (aspnet_wp.exe) Pin
Vasudevan Deepak Kumar5-Feb-03 17:46
Vasudevan Deepak Kumar5-Feb-03 17:46 
Generalaspnet_wp.exe process runs continuously and takes too much of resources Pin
Vasudevan Deepak Kumar4-Feb-03 21:23
Vasudevan Deepak Kumar4-Feb-03 21:23 
GeneralUsage of System EventLogs Pin
Vasudevan Deepak Kumar4-Feb-03 21:18
Vasudevan Deepak Kumar4-Feb-03 21:18 
GeneralStrange PerformanceCounter behaviour Pin
solidstore2-Feb-03 23:46
solidstore2-Feb-03 23:46 
QuestionPerformance counters bug? Pin
solidstore2-Feb-03 23:28
solidstore2-Feb-03 23:28 
AnswerRe: Performance counters bug? Pin
leppie8-Feb-03 9:16
leppie8-Feb-03 9:16 
GeneralPerformance counters with instances Pin
solidstore2-Feb-03 23:27
solidstore2-Feb-03 23:27 
Question.NET Applets? Pin
Jörgen Sigvardsson1-Feb-03 13:35
Jörgen Sigvardsson1-Feb-03 13:35 
AnswerRe: .NET Applets? Pin
Vasudevan Deepak Kumar1-Feb-03 18:44
Vasudevan Deepak Kumar1-Feb-03 18:44 

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.