S
SeeSharp Bint
Hi
I'm using some of the definitions I found pinvoke.net for PostMessage and
PeekMessage as follows
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("user32.dll", SetLastError = true)]
public static extern bool PostMessage(
HandleRef hWnd,// handle to destination window
UInt32 Msg, // message
IntPtr wParam, // first message parameter
IntPtr lParam // second message parameter
);
[StructLayout(LayoutKind.Sequential)]
public struct Message
{
public IntPtr handle;
public uint msg;
public IntPtr wParam;
public IntPtr lParam;
public uint time;
public System.Drawing.Point p;
}
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool PeekMessage(
out Message lpMsg,
HandleRef hWnd,// handle to destination window
uint wMsgFilterMin,
uint wMsgFilterMax,
uint wRemoveMsg
);
WM_USER = 0x0400,
public const int WM_EnteringGym = (int)WinServices.WindowsMessages.WM_USER +
11;
I post a message as follows:
PostMessage(new HandleRef(null, _MainWindowHandle),
UserMessages.WM_EnteringGym, 1);
I peek for the message as follows:
Message msg;
PeekMessage(out msg, new HandleRef(null, this.Handle),
UserMessages.WM_EnteringGym, UserMessages.WM_EnteringGym, 1);
When it arrives, and I check msg, WParam is 0x118 and LParam is 0x00
Where am i going wrong please? Why isnt WParam 0x01 ?
I'm using some of the definitions I found pinvoke.net for PostMessage and
PeekMessage as follows
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("user32.dll", SetLastError = true)]
public static extern bool PostMessage(
HandleRef hWnd,// handle to destination window
UInt32 Msg, // message
IntPtr wParam, // first message parameter
IntPtr lParam // second message parameter
);
[StructLayout(LayoutKind.Sequential)]
public struct Message
{
public IntPtr handle;
public uint msg;
public IntPtr wParam;
public IntPtr lParam;
public uint time;
public System.Drawing.Point p;
}
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool PeekMessage(
out Message lpMsg,
HandleRef hWnd,// handle to destination window
uint wMsgFilterMin,
uint wMsgFilterMax,
uint wRemoveMsg
);
WM_USER = 0x0400,
public const int WM_EnteringGym = (int)WinServices.WindowsMessages.WM_USER +
11;
I post a message as follows:
PostMessage(new HandleRef(null, _MainWindowHandle),
UserMessages.WM_EnteringGym, 1);
I peek for the message as follows:
Message msg;
PeekMessage(out msg, new HandleRef(null, this.Handle),
UserMessages.WM_EnteringGym, UserMessages.WM_EnteringGym, 1);
When it arrives, and I check msg, WParam is 0x118 and LParam is 0x00
Where am i going wrong please? Why isnt WParam 0x01 ?