Click here to Skip to main content
15,923,168 members
Home / Discussions / C#
   

C#

 
GeneralRe: Equiv of DrawState() API in .NET? Pin
James T. Johnson14-May-03 14:16
James T. Johnson14-May-03 14:16 
GeneralRe: Equiv of DrawState() API in .NET? Pin
J. Dunlap14-May-03 14:42
J. Dunlap14-May-03 14:42 
GeneralRe: Equiv of DrawState() API in .NET? Pin
J. Dunlap14-May-03 20:37
J. Dunlap14-May-03 20:37 
GeneralPlease, tell me WebServices are not stupid! Pin
Daniel Turini14-May-03 11:28
Daniel Turini14-May-03 11:28 
GeneralRe: Please, tell me WebServices are not stupid! Pin
leppie14-May-03 12:15
leppie14-May-03 12:15 
GeneralRe: Please, tell me WebServices are not stupid! Pin
James T. Johnson14-May-03 13:53
James T. Johnson14-May-03 13:53 
GeneralPass byte[] -> struct Pin
Wizard_0114-May-03 10:33
Wizard_0114-May-03 10:33 
GeneralRe: Pass byte[] -> struct Pin
Richard Deeming15-May-03 8:45
mveRichard Deeming15-May-03 8:45 
Try something like:
using System.Runtime.InteropServices;
...
public static object ByteArrayToStructure(byte[] buffer, int index, Type tStructure)
{
    if (null == buffer || 0 == buffer.Length)
        throw new ArgumentNullException("buffer");
    if (0 > index || buffer.Length <= index)
        throw new ArgumentOutOfRangeException("index");
    if (null == tStructure)
        throw new ArgumentNullException("tStructure");
    
    int size = Marshal.SizeOf(tStructure);
    if (index + buffer.Length < size)
        throw new ArgumentException("Insufficient data passed", "buffer");
    
    IntPtr pStructure = Marshal.AllocHGlobal(size);
    try
    {
        Marshal.Copy(buffer, index, pStructure, size);
        return Marshal.PtrToStructure(pStructure, tStructure);
    }
    finally
    {
        Marshal.FreeHGlobal(pStructure);
    }
}



"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
GeneralPicture Control Issues Pin
RB@Emphasys14-May-03 9:36
RB@Emphasys14-May-03 9:36 
GeneralRe: Picture Control Issues Pin
leppie14-May-03 9:41
leppie14-May-03 9:41 
GeneralDownloading Pin
Brian Delahunty14-May-03 9:23
Brian Delahunty14-May-03 9:23 
GeneralRe: Downloading Pin
leppie14-May-03 9:42
leppie14-May-03 9:42 
GeneralRe: Downloading Pin
Brian Delahunty14-May-03 10:02
Brian Delahunty14-May-03 10:02 
GeneralRe: Downloading Pin
David Stone14-May-03 10:08
sitebuilderDavid Stone14-May-03 10:08 
GeneralRe: Downloading Pin
Brian Delahunty14-May-03 10:18
Brian Delahunty14-May-03 10:18 
GeneralRe: Downloading Pin
leppie14-May-03 11:06
leppie14-May-03 11:06 
GeneralAxSHDocVw.AxWebBrowser Pin
toanlb14-May-03 9:19
toanlb14-May-03 9:19 
GeneralTesting plan for C# application... Pin
Josh Martin14-May-03 8:14
Josh Martin14-May-03 8:14 
GeneralRe: Testing plan for C# application... Pin
leppie14-May-03 9:22
leppie14-May-03 9:22 
GeneralRe: Testing plan for C# application... Pin
Jeff Martin18-May-03 8:12
Jeff Martin18-May-03 8:12 
QuestionImplementing IPersistStream? Pin
solidstore14-May-03 8:11
solidstore14-May-03 8:11 
AnswerRe: Implementing IPersistStream? Pin
leppie14-May-03 9:26
leppie14-May-03 9:26 
GeneralRe: Implementing IPersistStream? Pin
solidstore14-May-03 10:24
solidstore14-May-03 10:24 
GeneralClipboard.SetDataObject - data doesn't show up... Pin
LJMorsillo14-May-03 7:03
LJMorsillo14-May-03 7:03 
GeneralRe: Clipboard.SetDataObject - data doesn't show up... Pin
LJMorsillo14-May-03 7:20
LJMorsillo14-May-03 7:20 

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.