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
0
votes
3 answers

Passing message to another window

I would like to write an application which passes every message it receives to another window. For example, I have an application where user can press some keys, move mouse over it, etc. and I want all these messages passed to, for example, MS…
Pateman
  • 2,727
  • 3
  • 28
  • 43
0
votes
0 answers

GetMessageTime not work when trying building non-GUI application

I'm trying to make a screenshot helper that takes screenshots when it receives signal from other application. In my design, the higher layer application will send a window message to the helper, and the helper will then take a screenshot for user…
June
  • 1
  • 1
0
votes
0 answers

Unexpected behavior when sending a personalized message

Create an application with two forms, where the main form is created automatically, and the second form is created as needed. I've defined a custom message to pass a certain parameter from the secondary form (which is displayed in a non-modal way)…
yonni
  • 248
  • 2
  • 11
0
votes
1 answer

CMenu not receiving Windows touch messages

In my application when I receive an ON_WM_RBUTTONDOWN() message in a certain window I create a CMenu, populated with some items, and then displayed with TrackPopupMenu(xxx). It has no other interaction with Windows messages to be created. It…
Charlie Hermans
  • 128
  • 2
  • 10
0
votes
0 answers

Failed to intercept WM_LBUTTONUP message with WH_GETMESSAGE or WH_MOUSE_LL

In development of GUI automation service, our team faces with the problem that we can not handle WM_LBUTTONUP message correct. The goal is to intercept WM_LBUTTONUP, disable active window, do our job and show MessageBox with YES and NO buttons: If…
user17939629
0
votes
0 answers

Is it possible to receive WM_POWERBROADCAST message without message loop?

I read in here that WM_POWERBROADCAST messages should be processed inside WindowProc. I tried to capture WM_POWERBROADCAST without a message loop and was not successful. Following is what I tried: static long FAR PASCAL WindowProc(HWND hWnd, UINT…
0
votes
1 answer

How to use SendMessage pass a WM_COMMAND with hwnd?

I got a WM_COMMAND in a button event by Spy++, It looks like: <000116> 001B0A02 S WM_NOTIFY idCtrl:133978 pnmh:0019F9A0 <000117> 001B0A02 R WM_NOTIFY <000118> 001B0A02 S WM_COMMAND wNotifyCode:0000 wID:2 hwndCtl:00020B5A <000119> 001B0A02 R…
Lain
  • 13
  • 2
0
votes
1 answer

dialog procedure message sequencing

I got into some trouble I think caused by message sequencing in a dialog procedure. Trying to avoid more global variables, I added a WM_USER message to my dialog to set the color of a control. The message handling code simply stored the COLORREF in…
Mike D
  • 2,753
  • 8
  • 44
  • 77
0
votes
1 answer

Is there a way to "listen" for a program's outbound system messages?

I'm trying to replicate the behaviour of an automation tool that sends a few system messages to a program with the specified window handle but I'm not sure which messages it's using. Is there a way to listen to a program's outbound system messages?…
Dan
  • 1,163
  • 3
  • 14
  • 28
0
votes
1 answer

Sending WM_KEYUP message to a window gives an OverflowException

I am trying to implement a program that sends the same messages to a window that would be sent if a certain key is continuously pressed. This is part of the code (entire Form1.cs code is here ) for the application: [DllImport("User32.dll")] …
Răzvan Flavius Panda
  • 21,730
  • 17
  • 111
  • 169
0
votes
1 answer

How to extract colors from NM_CUSTOMDRAW message in Win32?

I have a hooked dll with WH_CALLWNDPROC from a x86 program (MSVS 2017). The code goes as follows: extern "C" __declspec(dllexport) LRESULT SysMessageProc(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode < 0) return CallNextHookEx(NULL, nCode,…
user1481126
0
votes
1 answer

C# to C++ CopyData API

I am developing an automation interface program and I looking to enhance capability with a machine software which uses a COPYDATA API aimed at C++. The goal is to control and report status of the machine through my own software. The method uses…
AeroMike
  • 15
  • 7
0
votes
1 answer

Issues with handling ON_WM_NCPAINT() message and OnNCPaint() override. (Overriding default MFC window border) [2020]

I'm attempting to create a "dark mode" theme for my Windows app, and I'm experiencing some inconsistencies with overriding the OnNcPaint() function. Please pardon the giant red box. I'm only coloring it in that way to show the issue. Here's my…
Skewjo
  • 379
  • 3
  • 12
0
votes
1 answer

a question about getting keyboard stroke on context menu

I am filtering keyboard messages delivered to a specific win32 application by hooking GetMessage/PeekMessage, it works fine except for context menu. For example, when i right click blank area in notepad and press P to paste text from clipboard, i am…
herb
  • 139
  • 8
0
votes
1 answer

Get the string of a Windows Message in C#?

I see that I can send strings in Windows Messages. But how do I read them from a processed Windows Message?
Vercas
  • 8,931
  • 15
  • 66
  • 106