J
Jay
Hi,
I have a C++ dll in which I decalred on structure like this,
typedef struct doTrnsfr
{
i nt Protocol;
}doTrnsfr;
I am passing this structure to C# code using
SendMessage(HWND_BROADCAST, WM_ASYNCDATA_RECEIVED, 0,(LPARAM)
doTrnsfr);
In C# application I am using MessageWindow class to process this
message.
the structure is defined this way
struct TransferData
{
[MarshalAs(UnmanagedType.I4)]public int proto;
};
protected override void WndProc(ref Message msg)
{
switch (msg.Msg)
{
case WM_ASYNCDATA_RECEIVED:
unsafe
{
TransferData sTemp = new TransferData();
sTemp =
(TransferData)Marshal.PtrToStructure(msg.LParam, typeof
(TransferData));
MessageBox.Show("Hello");
break;
}
}
when I use PtrToStructure() method the application exits without
throwing any exception
and Messagebox Hello is also not getting displayed.
What could be the reason?
Thanks
I have a C++ dll in which I decalred on structure like this,
typedef struct doTrnsfr
{
i nt Protocol;
}doTrnsfr;
I am passing this structure to C# code using
SendMessage(HWND_BROADCAST, WM_ASYNCDATA_RECEIVED, 0,(LPARAM)
doTrnsfr);
In C# application I am using MessageWindow class to process this
message.
the structure is defined this way
struct TransferData
{
[MarshalAs(UnmanagedType.I4)]public int proto;
};
protected override void WndProc(ref Message msg)
{
switch (msg.Msg)
{
case WM_ASYNCDATA_RECEIVED:
unsafe
{
TransferData sTemp = new TransferData();
sTemp =
(TransferData)Marshal.PtrToStructure(msg.LParam, typeof
(TransferData));
MessageBox.Show("Hello");
break;
}
}
when I use PtrToStructure() method the application exits without
throwing any exception
and Messagebox Hello is also not getting displayed.
What could be the reason?
Thanks