Questions tagged [windows-messages]

Questions about various messages in a Windows system.

Windows is an event driven operating system basically only responding to messages.

Message-identifier values are used as follows:

  • The system reserves message-identifier values in the range 0x0000 through 0x03FF (the value of WM_USER – 1) for system-defined messages. Applications cannot use these values for private messages.

  • Values in the range 0x0400 (the value of WM_USER) through 0x7FFF are available for message identifiers for private window classes.

  • If your application is marked version 4.0, you can use message-identifier values in the range 0x8000 (WM_APP) through 0xBFFF for private messages.

  • The system returns a message identifier in the range 0xC000 through 0xFFFF when an application calls the RegisterWindowMessage function to register a message. The message identifier returned by this function is guaranteed to be unique throughout the system. Use of this function prevents conflicts that can arise if other applications use the same message identifier for different purposes.

312 questions
1
vote
2 answers

How to get WM_POWERBROADCAST message in CWinApp?

I create the class that inherited CWinApp and this class has a timer (use a window timer). When PC go sleep mode and wake-up, timer callback is called exact time of wake-up. I want to make to not call the timer callback when PC is resuming from…
1
vote
2 answers

how to detect if ctrl key is pressed when child window ie. richedit is in focus?

I noticed that RichEdit does not send messages to parent window when CTRL key is pressed when the control is in focus. When parent window is active then all goes ok. But when cursor is in RichEdit only mouse 0x20 WM_SETCURSOR messages go ok. When…
rsk82
  • 28,217
  • 50
  • 150
  • 240
1
vote
0 answers

Mouse move message for child window are intercepted by parent, how to get them in child window's callback

I was writing an plugin of Adobe Illustrator. The Illustator UI has many non-modal dialogs (floating panels) in main window. I want to deal with the WM_MOUSEMOVE message of one panel. So I find the handle of the panel and use SetWindowLongPtr() to…
Royt
  • 199
  • 4
  • 14
1
vote
0 answers

How to fix "The queue handle is stale and should be closed?"

On Windows Server 2003, we back up messages in Windows message queue once a week using the following batch commands (http://technet.microsoft.com/en-us/library/cc773213%28v=ws.10%29.aspx): cd "C:\backup" echo y | del *.* /Q /s echo y | mqbkup -b…
1
vote
1 answer

MFC Button ToolTip not showing after button click

I am using MFC CToolTipCtrl for creating tooltip for a button. Now I have problem when I run the application in Windows XP.When I place mouse over the button,tooltip will popup but after clicking the button no tooltip is shown.In windows 7 there is…
Senan
  • 411
  • 2
  • 6
  • 16
0
votes
1 answer

Find out if a button is being held using Windows Messages

I have a program that uses windows messages to know if a button is being clicked or not : IntPtr GetMsg(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN) { int vkCode =…
user779444
  • 1,365
  • 4
  • 21
  • 38
0
votes
2 answers

WM_POWERBROADCAST message not caught in MFC Dlg

I try to catch WM_POWERBROADCAST message when the system goes into sleep mode. I'm doing like : BOOL CPowManApp::PreTranslateMessage(MSG* pMsg) { if(pMsg->message == WM_POWERBROADCAST || pMsg->message == WM_POWER) { CString…
daewonyoon
  • 326
  • 3
  • 7
  • 23
0
votes
1 answer

WM_ACTIVATEAPP on Windows Mobile 6

There's WM_ACTIVATEAPP message on "desktop Windows": Sent when a window belonging to a different application than the active window is about to be activated. The message is sent to the application whose window is being activated and to the…
binaryLV
  • 9,002
  • 2
  • 40
  • 42
0
votes
1 answer

Fill struct from IntPtr received in lParam property of Window Message going across process boundaries in C#

I posted this question a few days ago, and I have some follow up doubts about marshaling an IntPtr to a struct. The thing goes like this: As stated in the question I am referencing, I make calls to asynchronous methods on a native Dll. These…
Gabe Thorns
  • 1,426
  • 16
  • 20
0
votes
0 answers

Rust window created with CreateWindowExW() does not receive winEventHook messages

So I setup windows hook for EVENT_SYSTEM_FOREGROUND event then in order to receive events from windows there must be message loop in the same thread, this requires setting up a window or using GetMessage()(this is not really an option for this case,…
dalvi
  • 27
  • 5
0
votes
0 answers

How can MDI form of Delphi application receive and process WM_DROPFILES Windows message?

I am developing Delphi application in the older Delphi versions (Delphi 6, the essential thing here is that older Delphi versions have no Messaging unit) and I am using approach described https://delphidabbler.com/articles/article-11 and available…
TomR
  • 2,696
  • 6
  • 34
  • 87
0
votes
1 answer

Can Send message properly, but can't receive them in winapi

This is a code designed to roughly estimate the time it takes from the moment of asking the Windows OS to queue a message into a window's queue, till the window's thread is actually given CPU time. The receiving thread has its Message-Only window to…
0
votes
1 answer

Can a window receive messages without being the active window?

I have tested making a default window, and I have tested a message-only window both on a separate thread from the main thread. The goal is to receive WM_INPUT from HID devices from outside the main thread. The reason is that the main thread loop…
Physician
  • 483
  • 2
  • 7
0
votes
1 answer

Passing TMessage as a one-liner

I use C++ Builder and I pass messages to window which are handled in WndProc to update user interface. Something like: struct TWmGuiUpdatedStruct { int id1; int id2; }; TWmGuiUpdatedStruct gui { 1, 2 }; TMessage…
Coder12345
  • 3,431
  • 3
  • 33
  • 73
0
votes
1 answer

Intercepting Window status, position etc. in Firemonkey

I have user-friendliness in mind, so I'd like to intercept the position of each form I'm opening, to store and retrieve each time the same form is opened again. Because I plan to port this for MAC, I decided to use FireMonkey. Unfortunately, there…