Menu
  • HOME
  • TAGS

Capture Window Messages (WM) in WinForms Designer using WndProc

c#,.net,winforms,wndproc,windows-messages

Well, designer eats some of the messages. If you want all messages to be sent to the Control, you need to create a custom control designer and send them to the control. Refer ControlDesigner.WndProc public class CustomDesigner : ControlDesigner { protected override void WndProc(ref Message m) { DefWndProc(ref m);//Passes message...

WM_PAINT not send when using WS_EX_COMPOSITE

visual-c++,mfc,windows-messages

The logical place to enable/disable controls would be CView::OnUpdate, it is called by the framework after the view's document has been modified and from OnInitialUpdate(); you can also call this function if there is some change that would trigger re-evaluation of your business logic. EDIT After reading the question a...

Delphi - replace control WindowProc and dispatch the message

windows,delphi,delphi-xe2,windows-messages

Your main problem is the failure to call FOldWndProc. You need to call that rather than Dispatch. When you call Dispatch you will get the base TObject handling, which does nothing. procedure TOverrideMessage.OverrideWindowProc(var Message: TMessage); begin FOldWndProc(Message); if Message.Msg = WM_NCLBUTTONDOWN then if FControl is TSomeCustomControl then ShowMessage(TSomeCustomControl(FControl).Caption);//this property exists...

SendMessage between WinForms Applications - form needs focus

vb.net,winforms,forms,messages,windows-messages

Thanks to @JustinRyan I figured it out using FindWindow. I added this to my second application that send the message. Private Declare Function FindWindow1 Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer Instead of finding the application process I find the window I want...

WM_TOUCH vs WM_POINTER

winapi,touch,multi-touch,windows-messages,wm-touch

WM_TOUCH is obsolete. Use WM_POINTER exclusively. (WM_TOUCH is actually a wrapper over WM_POINTER.) GetMessageExtraInfo is also notoriously fragile. You have to call it immediately after calling GetMessage, or else you run the risk of intermediate function calls making a COM call or doing something else that results in calling GetMessage....

Signal event on Window's notification

windows,winapi,asynchronous,windows-messages

No, you cannot make Windows signal an event object when particular window messages are received. You would have to catch the messages in your message loop first and then signal the event object yourself as needed. Otherwise, re-write your message loop to use MsgWaitForMultipleObjects() so it can check for event...

Why do some windows not receive Windows messages

windows,messages,windows-messages

Spy++ needs to inject a hook to monitor window messages. For this to work, the bitness of the hook function needs to match the bitness of the process owning the window, and therefore you should use the 32-bit version of Spy++ to monitor windows of 32-bit apps, and the 64-bit...

How to catch WM_DEVICECHANGE in a control other than TForm?

delphi,delphi-2009,windows-messages

The OS sends wm_DeviceChange messages to all top-level windows. The application's main form is a top-level window, but your control is not, which is why the form receives the messages and your control does not. For arbitrary device types, you have two alternatives: Use AllocateHWnd to create a message-only top-level...

How to capture mouse windows messages out of the application?

.net,vb.net,winforms,windows-messages

There are two ways to do this. Using global hooks (Google it) I do not recommend. Making ur winform transparent. U need set transparent color of ur winform as the background control color. To make the form unfocusable u need add this code to ur message handler if (m.Msg ==...

How do I program a resize handle on a delphi TFrame?

delphi,windows-messages

It's not that the frame stops receiving WM_SETCURSOR messages, it's that he cursor gets stuck set at crSizeNWSE. When you switch back to setting crDefault to Screen.Cursor, what happens is that the VCL sends a WM_SETCURSOR to the frame to have it set the default cursor. In effect no cursor...

Window Not Receiving WM_KEYDOWN/WM_KEYUP Events

c++,windows,winapi,windows-messages

I landed up just hooking onto DirectInput and creating the keyboard handling stuff I needed through that. It was not something I wanted to do but in the end the result works as needed.

Message-only window not receiving messages from tray icon

c++,windows,windows-messages,trayicon

You need some form of message loop, not a blocking call to input something. Try the canonical message loop: MSG msg; while (GetMessage(&msg, nullptr, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } ...

Handling multiple WM_USER messages (or achieving the same result)

c++,mfc,windows-messages

Yes, as @Ross suggested, you can pass you 'N' into PostMessage() as one of the [lParam, wParam] arguments. They are pointer-size on both 32 and 64 bit OS. Note that your shenanigans with N are often unnecessary. With dynamically-allocated objects, (like GUI elements usually are since they must outlive the...