how to cast system.intptr to struct

B

BestNews

Hi all,
how to cast an System.IntPtr value to struct type.
Example:
protected override void WndProc(ref System.Windows.Forms.Message m)


{

const int WM_WINDOWPOSCHANGED = 0x0047;

if(m.Msg == WM_WINDOWPOSCHANGED)


{

string str="";

quickGetText(0,-1,ref str);

//HERE I NEED TO CAST m.LParam to WINDOWPOS struct

//WINDOWPOS wndptr = (WINDOWPOS)m.LParam;

return;


}

base.WndProc(ref m);

}

//C++ structure declaration

[StructLayout(LayoutKind.Sequential)]

struct WINDOWPOS

{

System.IntPtr hwnd;

System.IntPtr hwndInsertAfter;

int x;

int y;

int cx;

int cy;

System.UInt32 flags;

}

Can any help me out.

regards

subash
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top