Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft C# .NET
PostMessage/PeekMessage and interop
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="SeeSharp Bint, post: 10324568"] 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 ? [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft C# .NET
PostMessage/PeekMessage and interop
Top