There is some Win OS API call or so that would let one obtain text from the screen
not via obtaining a snapshot and then doing OCR on it, but via API
the idea is to get the text that is under the mouse that the user points to and clicks on.
This is how tools like Babylon (http://www.babylon.com) and 1-Click Answers (http://www.answers.com/main/download_answers_win.jsp) and many others work.
Can someone point me to the right direction to get this functionality?
asked Feb 5, 2009 at 7:59
There is no direct way to obtain text. An application could render text in a zillion different ways (Windows API being one of them), and after it’s rendered — it’s just a bunch of pixels.
A method you could try however is to find the window directly under the mouse and trying to get the text from them. This would work fine on most standard Windows controls (labels, textboxes, etc.) Wouldn’t work on Internet browsers though.
I think the best you can do is make your application such that it supports as many different (common) controls as possible in the above described manner.
answered Feb 5, 2009 at 8:09
Vilx-Vilx-
105k87 gold badges279 silver badges422 bronze badges
You can get the text of every window with the GetWindowText API. The mouse position can be found with the GetCursorPos API.
In Delphi you could use this function (kudos to Peter Below)
Function ChildWindowUnderCursor: HWND;
Var
hw, lasthw: HWND;
pt, clientpt: TPoint;
Begin
Result := 0;
GetCursorPos( pt );
// find top-level window under cursor
hw := WindowFromPoint( pt );
If hw = 0 Then Exit;
// look for child windows in the window recursively
// until we find no new windows
Repeat
lasthw := hw;
clientpt := Pt;
Windows.ScreenToClient( lasthw, clientpt );
// Use ChildwindowfromPoint if app needs to run on NT 3.51!
hw := ChildwindowFromPointEx( lasthw, clientpt, CWP_SKIPINVISIBLE );
Until hw = lasthw;
Result := hw;
End;
Regards,
Lieven
answered Feb 5, 2009 at 8:10
Windows has APIs for accessibility tools like screen-readers for the blind. (Newer versions are also used for other purposes, like UI automation and testing.) It works with many applications, even most browsers which render their own content without using the standard Windows controls. It won’t work with all applications, but it can be used to figure out the text under the mouse in most cases.
The current API is called the Windows Automation API. Describing how to do this in general is beyond the scope of a Stack Overflow answer, so I’ve simply provided a link to the documentation.
The older API that was widely available when this question was first posted is called the Microsoft Active Accessibility API. As with the modern APIs, the scope here is too broad to detail here.
Note that documentation for both APIs is written both for both developers building accessibility tools (like screen readers) as well as for developers writing apps that want to be compatible with those accessibility tools.
The basic idea is that an accessibility tool gets COM interfaces provided by the target application’s window(s), and it can use those interfaces to figure out the controls and their text and how they’re related both logically and spatially. Applications that are composed of standard Windows controls are mostly automatically supported. Applications with custom UI implementations have to do work to provide these interfaces. Fortunately, the important ones, like the mainstream browsers, have done the work to support these interfaces.
answered Oct 27, 2017 at 23:18
Adrian McCarthyAdrian McCarthy
45.7k16 gold badges123 silver badges176 bronze badges
i think its called the clipboard. i am going to bet these programs inject click and double click & keyboard events and then copy items there for inspection. Alternatively, they are gettin jiggy with the windows text controls, and grabbing content that way. i suspect due to security issues, these tools have problems running in vista also.
answered Feb 5, 2009 at 8:07
Scott EverndenScott Evernden
39.2k15 gold badges79 silver badges84 bronze badges
There is some Win OS API call or so that would let one obtain text from the screen
not via obtaining a snapshot and then doing OCR on it, but via API
the idea is to get the text that is under the mouse that the user points to and clicks on.
This is how tools like Babylon (http://www.babylon.com) and 1-Click Answers (http://www.answers.com/main/download_answers_win.jsp) and many others work.
Can someone point me to the right direction to get this functionality?
asked Feb 5, 2009 at 7:59
There is no direct way to obtain text. An application could render text in a zillion different ways (Windows API being one of them), and after it’s rendered — it’s just a bunch of pixels.
A method you could try however is to find the window directly under the mouse and trying to get the text from them. This would work fine on most standard Windows controls (labels, textboxes, etc.) Wouldn’t work on Internet browsers though.
I think the best you can do is make your application such that it supports as many different (common) controls as possible in the above described manner.
answered Feb 5, 2009 at 8:09
Vilx-Vilx-
105k87 gold badges279 silver badges422 bronze badges
You can get the text of every window with the GetWindowText API. The mouse position can be found with the GetCursorPos API.
In Delphi you could use this function (kudos to Peter Below)
Function ChildWindowUnderCursor: HWND;
Var
hw, lasthw: HWND;
pt, clientpt: TPoint;
Begin
Result := 0;
GetCursorPos( pt );
// find top-level window under cursor
hw := WindowFromPoint( pt );
If hw = 0 Then Exit;
// look for child windows in the window recursively
// until we find no new windows
Repeat
lasthw := hw;
clientpt := Pt;
Windows.ScreenToClient( lasthw, clientpt );
// Use ChildwindowfromPoint if app needs to run on NT 3.51!
hw := ChildwindowFromPointEx( lasthw, clientpt, CWP_SKIPINVISIBLE );
Until hw = lasthw;
Result := hw;
End;
Regards,
Lieven
answered Feb 5, 2009 at 8:10
Windows has APIs for accessibility tools like screen-readers for the blind. (Newer versions are also used for other purposes, like UI automation and testing.) It works with many applications, even most browsers which render their own content without using the standard Windows controls. It won’t work with all applications, but it can be used to figure out the text under the mouse in most cases.
The current API is called the Windows Automation API. Describing how to do this in general is beyond the scope of a Stack Overflow answer, so I’ve simply provided a link to the documentation.
The older API that was widely available when this question was first posted is called the Microsoft Active Accessibility API. As with the modern APIs, the scope here is too broad to detail here.
Note that documentation for both APIs is written both for both developers building accessibility tools (like screen readers) as well as for developers writing apps that want to be compatible with those accessibility tools.
The basic idea is that an accessibility tool gets COM interfaces provided by the target application’s window(s), and it can use those interfaces to figure out the controls and their text and how they’re related both logically and spatially. Applications that are composed of standard Windows controls are mostly automatically supported. Applications with custom UI implementations have to do work to provide these interfaces. Fortunately, the important ones, like the mainstream browsers, have done the work to support these interfaces.
answered Oct 27, 2017 at 23:18
Adrian McCarthyAdrian McCarthy
45.7k16 gold badges123 silver badges176 bronze badges
i think its called the clipboard. i am going to bet these programs inject click and double click & keyboard events and then copy items there for inspection. Alternatively, they are gettin jiggy with the windows text controls, and grabbing content that way. i suspect due to security issues, these tools have problems running in vista also.
answered Feb 5, 2009 at 8:07
Scott EverndenScott Evernden
39.2k15 gold badges79 silver badges84 bronze badges
Функция GetWindowText
Функция GetWindowText
копирует текст заголовка определяемого окна (если окно имеет его) в буфер. Если заданное окно является органом управления,
копируется его текст. Однако функция GetWindowText
не может извлекать текст органа управления в другом приложении.
Синтаксис
int GetWindowText(
HWND hWnd, // дескриптор окна или элемента // управления с текстом LPTSTR lpString, // адрес буфера для текста int nMaxCount // максимальное число символов // для копирования
);
Параметры
hWnd
[in] Дескриптор окна или органа управления, содержащего текст.
lpString
[out] Указывает на буфер, который примет текст. Указатель на буфер, который получит текст. Если строка является такой же длины
или длиннее, чем буфер, она обрезается и завершается символом
NULL.
nMaxCount
Устанавливает максимальное число символов для копирования в буфер, включая символ NULL. Если текст превышает это
ограничение, он усекается.
Возвращаемые
значения
Если функция завершается успешно, возвращаемое значение — длина, в символах, скопированной строки, не, включая символа
конца строки (нуль-терминатора). Если у окна нет заголовка или текста, если строка заголовка — пустая строка или, если
дескриптор окна или органа управления недопустимы, возвращаемое значение нулевое. Чтобы получать расширенные данные об
ошибках, вызовите GetLastError.
Эта функция не может извлекать текст из поля элемента редактирования в другой прикладной программе.
Замечания
Если целевое окно находится во владении текущего потока, функция
GetWindowText
вынуждена отправить сообщение WM_GETTEXT
заданному окну или органу управления. Если целевое окно находится во владении другого потока и имеет заголовок
GetWindowText извлекает текст заголовка окна. Если у окна нет
заголовка, возвращаемое значение является нулевой строкой. Это поведение регулируется в соответствии с проектом. Оно
позволяет прикладным программам вызвать функцию
GetWindowText
без зависания программы, если процесс, который владеет целевым окном, зависает. Однако если целевое окно зависаете, и оно
принадлежит вызывающей программе, функция GetWindowText
приведет к зависанию вызывающую программу.
Чтобы извлечь текст из органа управления в другом процессе, отправьте сообщение
WM_GETTEXT непосредственно вместо вызова GetWindowText.
Пример
Пример смотри в статье Отправка
сообщений.
Смотри также
Краткий обзор Окна, GetWindowTextLength,
SetWindowText,
WM_GETTEXT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Используемая библиотека |
|
|
|
|
|
|
|
|
|
|
|
Article catalog
-
-
- I. Introduction
- Second, use Spy ++ Tool Analysis Window
- Third, C # capture the window via the Windows API, get the window text
- Fourth, Appendix: Windows Window Message
-
I. Introduction
Project isUnity
Developed, on the shelvesQQ
Game hall, need to be compatibleXP
system.
QQ
The process of launching the game in the game hall is like this:
1 QQ game hall .exe -------> 2 downloader .exe -------> 3 Unity game .exe
inXP
In the test,Unity game .exe
The operation is as followsError
。
So, we are not sure how many users have encountered this problem, so they need to be reported, and the logic detection is added in the downloader, when the downper is startedUnity
When the game is waiting for 2 seconds, it is judged if there isError
Window, if any, capture this window and take out the text in it, report to the server, and convenient data analysis statistics.
Download device I usedC#
of.Net Framework
The desktop application is done, so how is it?C#
CaptureWindows
The problem of windows, let’s introduce my implementation method.
Second, use Spy ++ Tool Analysis Window
We can useSpy++
Tool analysis window. Here I am using it.Spy++ Lite
Only a few hundred k size, very light.
Spy++ Lite
download:
Extraction code: MTSQ
Spy ++ Lite is a feature-rich programming auxiliary tool for obtaining window handles and analyzing formal structures. 32-bit and 64-bit applications can be detected. You can display the value of the window handle, window style, and class style. You can get the parent window and the brothers window, the sub-window structure and form a handle tree, and adjust the status and behavior of the window, get the program path, screenshots, etc. The software also supports gain list control data, such as task manager, stock market data, etc., also supports getting a tree view, pull-down box, list box, menu data, and font information.
note,.OCX
Document requires registration, registration.OCX
File steps:
(1)COMCTL32.OCX
Document copy toC
In this directory: 32-bit system:c:\WINDOWS\system32
64-bit system:c:\Windows\SysWOW64
I am as follows, because I am32-bit XP
So put it inc:\WINDOWS\system32
in.
(2) Openrun
, Enter the registration command,
32
Bit system:
regsvr32 c:\WINDOWS\system32\COMCTL32.OCX
64
Bit system:
regsvr32 c:\Windows\SysWOW64\COMCTL32.OCX
registration success.
Next, you can runSpy++ Lite
.
useSpy++
analysisError
The information of the window.
According to the above operation, we can know:
Window title isError
Under this window, there is a sub-window, the sub-window title isEdit
The text in the sub-window is:
Failed to initialize Direct3D.
Make sure you have at least DirectX 9.0c installed, have drivers for your
graphics card and have not disabled 3D acceleration
in display settings.
InitializeEngineGraphics failed
What we have to do is to find this sub-window, take out the text, belowC#
Code to implement this logic.
Third, C # capture the window via the Windows API, get the window text
Windows
A lot of packagesAPI
, We can pass theseAPI
To access the window and action window.
Among them, severalAPI
// Find window
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
// Traverse all child windows of the window, call back to Callback
[DllImport("user32.dll")]
public static extern int EnumChildWindows(IntPtr hWndParent, CallBack lpfn, int lParam);
public delegate bool CallBack(IntPtr hwnd, int lParam);
/ / Get the class name of the window
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
/ / Judgment the window visible
[DllImport("user32.dll")]
public static extern bool IsWindowVisible(IntPtr hWnd);
// Get the length of the window text
[DllImport("user32.dll")]
public static extern int GetWindowTextLength(IntPtr hWnd);
/ / Get the window text, the text will put into the StringBuilder, you need to specify the maximum length of the string Nmaxcount
[DllImport("User32.dll", EntryPoint = "GetWindowText")]
private static extern int GetWindowText(IntPtr hwnd, StringBuilder lpString, int nMaxCount);
/ / Send a message to the window
[DllImport("user32.dll", EntryPoint = "SendMessageA")]
public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
/ / Send a message to the window, the data returned by the event is obtained by byte [] array
[DllImport("user32.dll", EntryPoint = "SendMessageA")]
public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, Byte[] lParam);
The full code is as follows:
using System;
using System.Runtime.InteropServices;
using System.Text;
public partial class WindowApiHelper
{
/// <summary>
// / Try to find an Error window and remove the window text
/// </summary>
/// <returns></returns>
public static string TryFindErrorWindowText()
{
string errorText = "";
/ / Find the title of Error
IntPtr mainHandle = FindWindow(null, "Error");
if (mainHandle != IntPtr.Zero)
{
// Enumerate a child form, find the control handle
int i = EnumChildWindows(mainHandle, (h, l) =>
{
StringBuilder sbr = new StringBuilder();
GetClassName(h, sbr, 255);
string classname = sbr.ToString();
/ / Get an Edit sub-window
if ("Edit" == classname)
{
// Is it visible?
if (IsWindowVisible(h))
{
// Remove the window text
int textLen;
textLen = SendMessage(h, WM_GETTEXTLENGTH, 0, 0);
Byte[] byt = new Byte[textLen];
SendMessage(h, WM_GETTEXT, textLen + 1, byt);
errorText = Encoding.Default.GetString(byt);
// Close the Error window
// SendMessage(h, WM_CLOSE , 0, 0);
}
}
return true;
}, 0);
}
return errorText;
}
/*--Windows API------------------------------------------------------------------------------------*/
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern int EnumChildWindows(IntPtr hWndParent, CallBack lpfn, int lParam);
public delegate bool CallBack(IntPtr hwnd, int lParam);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
[DllImport("user32.dll")]
public static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern int GetWindowTextLength(IntPtr hWnd);
[DllImport("User32.dll", EntryPoint = "GetWindowText")]
private static extern int GetWindowText(IntPtr hwnd, StringBuilder lpString, int nMaxCount);
[DllImport("user32.dll", EntryPoint = "SendMessageA")]
public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
[DllImport("user32.dll", EntryPoint = "SendMessageA")]
public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, Byte[] lParam);
const int WM_GETTEXT = 0x000D;
const int WM_GETTEXTLENGTH = 0x000E;
const int WM_CLOSE = 0x10;
/*--Windows API------------------------------------------------------------------------------------*/
}
Fourth, Appendix: Windows Window Message
news | description |
---|---|
WM_CREATE = 0x0001; | Application creates a window |
WM_DESTROY = 0x0002; | One window is destroyed |
WM_MOVE = 0x0003; | Move a window |
WM_SIZE = 0x0005; | Change the size of a window |
WM_ACTIVATE = 0x0006; | A window is activated or lost to activate; |
WM_SETFOCUS = 0x0007; | After getting the focus |
WM_KILLFOCUS = 0x0008; | lose focus |
WM_ENABLE = 0x000A; | Change the Enable status |
WM_SETREDRAW = 0x000B; | Set whether the window is able to redraw |
WM_SETTEXT = 0x000C; | The application sends this message to set the text of a window |
WM_GETTEXT = 0x000D; | The application sends this message to copy the text to the buffer corresponding to the window |
WM_GETTEXTLENGTH = 0x000E; | Get the length of text related to a window (not including empty characters) |
WM_PAINT = 0x000F; | Ask one window to call yourself |
WM_CLOSE = 0x0010; | Send a signal when a window or application is turned off |
WM_QUERYENDSESSION = 0x0011; | When the user selects the end dialog or the program calls the exitwindows function |
WM_QUIT = 0x0012; | Used to end the program to run or when the program calls postquitMessage functions |
WM_QUERYOPEN = 0x0013; | When the user window recovers the previous size position, send this message to an icon. |
WM_ERASEBKGND = 0x0014; | When the window background must be erased (case change in the window) |
WM_SYSCOLORCHANGE = 0x0015; | When the system color changes, send this message to all top windows |
WM_ENDSESSION = 0x0016; | When the system process issues a WM_QueryEndSession message, this message is sent to the application, notifying it to end if the conversation ends |
WM_SHOWWINDOW = 0x0018; | When the hidden or display window is sent to this message to this window |
WM_ACTIVATEAPP = 0x001C; | Send this message which window to the application is activated, which is non-activated |
WM_FONTCHANGE = 0x001D; | Send this message to all top windows when the system’s font resource library changes |
WM_TIMECHANGE = 0x001E; | Send this message to all top windows when the system’s time changes |
WM_CANCELMODE = 0x001F; | Send this message to cancel some of the ongoing touch state (operation) |
WM_SETCURSOR = 0x0020; | If the mouse causes the cursor to move in a window and the mouse input is not captured, send a message to a window. |
WM_MOUSEACTIVATE = 0x0021; | When the cursor is in a non-active window and the user is in pressing a key in the mouse to send this message to the current window. |
WM_CHILDACTIVATE = 0x0022; | Send this message to the MDI child window When the user clicks on this window, or when the window is activated, moved, change the size |
WM_QUEUESYNC = 0x0023; | This message is sent by a computer-based training program, separating the user input message via the HOOK program of WH_Journalpalyback |
WM_GETMINMAXINFO = 0x0024; | This message is sent to the window When it will change the size or position; |
WM_PAINTICON = 0x0026; | Send to the minimization window When it icon will be heavy |
WM_ICONERASEBKGND = 0x0027; | This message is sent to a minimization window, only when it is drawing the background, it must be heavy |
WM_NEXTDLGCTL = 0x0028; | Send this message to a dialog program to change the focus location |
WM_SPOOLERSTATUS = 0x002A; | Whenever the print management queue increases or decreases this message when a job |
WM_DRAWITEM = 0x002B; | This message is sent to the owner of these empty parts when the visual appearance of Button, ComboBox, ListBox, Menu |
WM_MEASUREITEM = 0x002C; | When Button, Combo Box, List Box, List View Control, or Menu Item is created, send this message to the owner of the control |
WM_DELETEITEM = 0x002D; | When the List Box or Combo Box is destroyed or when some items are removed through lb_deleteString, lb_resetcontent, cb_deleteString, or cb_resetcontent message |
WM_VKEYTOITEM = 0x002E; | This message has a LBS_WANTKEYBOARDINPUT style to the owner of it to respond to WM_KeyDown messages |
WM_CHARTOITEM = 0x002F; | This message is sent to his owner by a list box in a lbs_wantkeyboardinput style to respond to WM_CHAR messages. |
WM_SETFONT = 0x0030; | When the text is drawn, the program is sent this message to get the color you want to use. |
WM_GETFONT = 0x0031; | Application Send this message to get the current control to draw the text |
WM_SETHOTKEY = 0x0032; | The application sends this message to let a window associated with a hotkey |
WM_GETHOTKEY = 0x0033; | The application sends this message to determine if the hotkey is associated with a window. |
WM_QUERYDRAGICON = 0x0037; | This message is sent to the minimization window, when this window will be dragged and the icon is not defined in its class, the application can return a handle of an icon or cursor, when the user drags and drop icon, the system displays this icon or cursor. |
WM_COMPAREITEM = 0x0039; | Send this message to determine the relative position of the new item added in ComboBox or Listbox |
WM_COMPACTING = 0x0041; | There is already very few memory |
WM_WINDOWPOSCHANGING = 0x0046; | Send this message to call the SETWINDOWPOS function or other window management functions when the size and location of the window will be changed. |
WM_WINDOWPOSCHANGED = 0x0047; | Send this message to call the SETWINDOWPOS function or other window management functions when the size and location of the window have been changed. |
WM_POWER = 0x0048; (for 16-bit Windows) | This message will be sent when the system will enter the pause state |
WM_COPYDATA = 0x004A; | Send this message when an application passes data to another application |
WM_CANCELJOURNAL = 0x004B; | Submit this message to the program when a user cancels the program log activation status |
WM_NOTIFY = 0x004E; | When a control is or if this control needs to get some information, send this message to its parent window. |
WM_INPUTLANGCHANGEREQUEST = 0x0050; | When the user selects some kind of input language, or the hotkey change in the input language |
WM_INPUTLANGCHANGE = 0x0051; | This message is sent to the most affected top window when the platform has been changed. |
WM_TCARD = 0x0052; | This message is sent to the application when the program has initialized the Windows Help routine. |
WM_HELP = 0x0053; | This message displays the user presses F1. If a menu is activated, send this message and this window is associated with the menu, otherwise send a window with focus, if there is no focus, just send this message to the current Activated window |
WM_USERCHANGED = 0x0054; | When the user has already logged in or exits, the message is sent to all windows, and the system updates the user’s specific setting information when the user logins or exits, and the system will send this message immediately when the user update settings; |
WM_NOTIFYFORMAT = 0x0055; | Public controls, custom controls, and their parent windows to determine that the control is using ansi or a Unicode structure in the WM_NOTIFY message, using this control to make each other to communicate with its parent controls |
WM_CONTEXTMENU = 0x007B; | When you click on a window, you can send this message to this window. |
WM_STYLECHANGING = 0x007C; | When the calling setWindowlong function will change this message to that window when you want to change the style of one or more windows. |
WM_STYLECHANGED = 0x007D; | This message is sent to that window when calling the style of a setWindowlong function one or more windows. |
WM_DISPLAYCHANGE = 0x007E; | Send this message to all windows when the resolution of the display changes |
WM_GETICON = 0x007F; | This message is sent to a window to return a handle of a large icon or a small icon with a window; |
WM_SETICON = 0x0080; | The program sends this message to let a new large icon or small icon associated with a window; |
WM_NCCREATE = 0x0081; | This message is sent before the WM_CREATE message is sent when a window is created first. |
WM_NCDESTROY = 0x0082; | This message notifies a window, non-customer district is destroying |
WM_NCCALCSIZE = 0x0083; | This message must be sent when a customer area of a window must be verified |
WM_NCHITTEST = 0x0084; | Move the mouse, hold down or release the mouse |
WM_NCPAINT = 0x0085; | The program sends this message to a window when it (window) is drawn; |
WM_NCACTIVATE = 0x0086; | This message is sent to a window only when its non-customer area needs to be changed to display is activated or inactive; |
WM_GETDLGCODE = 0x0087; | Send this message to a control associated with the dialog program, the Widdows Control orientation key, and Tab keys enters this control, by responding to the WM_GETDLGCODE message, the application can treat him as a special input control and can handle it |
WM_NCMOUSEMOVE = 0x00A0; | When the cursor is moving this message when moving in a window’s non-customer zone, the non-client area is: the title bar of the form and the side frame of the window |
WM_NCLBUTTONDOWN = 0x00A1; | This message submits this message when the cursor is in the non-client area of a window. |
WM_NCLBUTTONUP = 0x00A2; | When the user releases the left mouse button, the cursor is sent to the non-client zone ten; |
WM_NCLBUTTONDBLCLK = 0x00A3; | When the user doubles the left mouse button, the spectrum is sent to this message in the non-client zone ten. |
WM_NCRBUTTONDOWN = 0x00A4; | When the user presses the mouse button, the cursor is sent to this message when the cursor is in the non-client district of the window. |
WM_NCRBUTTONUP = 0x00A5; | When the user releases the right mouse button, the cursor is sent to the window’s non-client district. |
WM_NCRBUTTONDBLCLK = 0x00A6; | When the user doubles the mouse button, the cursor is sent in the non-client zone ten. |
WM_NCMBUTTONDOWN = 0x00A7; | When the user presses the mouse button while the cursor is also sent this message when the cursor is in the non-client district of the window. |
WM_NCMBUTTONUP = 0x00A8; | When the user releases the mouse button while the cursor is also sent to the window’s non-client district |
WM_NCMBUTTONDBLCLK = 0x00A9; | When the user doubles the mouse button, the cursor is sent to this message when the cursor is in the non-client district of the window. |
WM_KEYDOWN = 0x0100; | Press a button |
WM_KEYUP = 0x0101; | Release a key |
WM_CHAR = 0x0102; | Press a key and issue WM_KEYDOWN, WM_KEYUP message |
WM_DEADCHAR = 0x0103; | Send this message to the window with focus when translating the WM_KEYUP message with the TranslateMessage function |
WM_SYSKEYDOWN = 0x0104; | Submit this message to the window with focus when the user holds down the Alt button. |
WM_SYSKEYUP = 0x0105; | When the user releases a button while the Alt key is pressed, submit this message to the window with focus. |
WM_SYSCHAR = 0x0106; | When the WM_SYSKEYDOWN message is translated by the translateMessage function, submit this message to the window with focus. |
WM_SYSDEADCHAR = 0x0107; | When the WM_SYSKEYDOWN message is translated by the translateMessage function, send this message to the window with focus. |
WM_INITDIALOG = 0x0110; | Send this message before a dialog program is displayed, usually use this message to initialize the control and perform other tasks. |
WM_COMMAND = 0x0111; | When the user chooses a menu command item or when a control sends a message to its parent window, a shortcut is translated |
WM_SYSCOMMAND = 0x0112; | When a user selects a command to the window menu or when the user selects maximizes or minimizes the message, the window will receive this message. |
WM_TIMER = 0x0113; | Timer event occurs |
WM_HSCROLL = 0x0114; | When a window standard horizontal scroll bar generates a scrolling event to send this message to that window, also sent to the control with it |
WM_VSCROLL = 0x0115; | When a window standard vertical scroll bar generates a scrolling event to send this message to that window, send it to the control with it. |
WM_INITMENU = 0x0116; | When a menu will be activated, this message is sent, which occurs in a user menu bar or presses a menu button, which allows the program to change the menu before display |
WM_INITMENUPOPUP = 0x0117; | When a drop-down menu or submenu will be sent to send this message when it is activated, it allows the program to change the menu before it is displayed, not to change all |
WM_MENUSELECT = 0x011F; | When the user selects a menu item, send this message to the owner of the menu (generally the window) |
WM_MENUCHAR = 0x0120; | When the menu has been activated by the user (different from the accelerator), send this message to the owner of the menu; |
WM_ENTERIDLE = 0x0121; | When a modal dialog or menu enters an air-loaded state, send this message to its owner, a modal dialog or menu into the no-load state is the column that does not have a message after processing one or more previous messages. Neutralize |
WM_CTLCOLORMSGBOX = 0x0132; | Send this message to the owner window of the message box before drawing the message box, by responding to this message, the owner window can set the text and background color of the message box with the handle of the given related display device. |
WM_CTLCOLOREDIT = 0x0133; | When a editing control will be drawn, send this message to its parent window; by responding to this message, the owner window can set the text and background color of the edit box by using the handle of the given related display device. |
WM_CTLCOLORLISTBOX = 0x0134; | When a list box control will send this message to its parent window before being drawn; by responding to this message, the owner window can set the text and background color of the list box by using the handle of the given related display device. |
WM_CTLCOLORBTN = 0x0135; | When a button control will send this message to its parent window; by responding to this message, the owner window can set the text and background color of the button with the handle of the given related display device. |
WM_CTLCOLORDLG = 0x0136; | When a dialog control will send this message to the parent window before drawn; by responding to this message, the owner window can set the text background color of the dialog box by using the handle of the given related display device. |
WM_CTLCOLORSCROLLBAR= 0x0137; | When a scroll strip control will send this message to its parent window; by responding to this message, the owner window can set the background color of the scroll bar by using the handle of the given related display device. |
WM_CTLCOLORSTATIC = 0x0138; | When a static control will be drawn, send this message to its parent window; by responding to this message, the owner window can set the text and background color of the static control by using the handle of the given related display device. |
WM_MOUSEMOVE = 0x0200; | Move mouse |
WM_LBUTTONDOWN = 0x0201; | Press the left mouse button |
WM_LBUTTONUP = 0x0202; | Release the left mouse button |
WM_LBUTTONDBLCLK = 0x0203; | Double-click the left mouse button |
WM_RBUTTONDOWN = 0x0204; | Press the right mouse button |
WM_RBUTTONUP = 0x0205; | Right click |
WM_RBUTTONDBLCLK = 0x0206; | Double-click the right mouse button |
WM_MBUTTONDOWN = 0x0207; | Press the mouse button |
WM_MBUTTONUP = 0x0208; | Release mouse button |
WM_MBUTTONDBLCLK = 0x0209; | Double click on the mouse button |
WM_MOUSEWHEEL = 0x020A; | Send this message when the mouse wheel is rotated, the current focus control |
WM_PARENTNOTIFY = 0x0210; | When the MDI sub-window is created or destroyed, or the user presses the mouse button and the cursor will send this message to its parent window on the child window. |
WM_ENTERMENULOOP = 0x0211; | Send this message to notify the application’s main window That has entered the menu loop mode |
WM_EXITMENULOOP = 0x0212; | Send this message to notify the application’s main window That has exited menu loop mode |
WM_SIZING = 532; | When the user is adjusting the window size to the window; you can monitor the window size and location through this message application can also modify them. |
WM_CAPTURECHANGED = 533; | Send this message to the window When it lost the captured mouse; |
WM_MOVING = 534; | When the user sends this message while moving the window, you can monitor the window size and location or modify them; |
WM_POWERBROADCAST = 536; | This message is sent to the application to inform it about power management events; |
WM_DEVICECHANGE = 537; | This message is sent to the application or device driver when the hardware configuration change of the device changes |
WM_MDICREATE = 0x0220; | The application sends this message to a multi-document customer window to create an MDI sub-window |
WM_MDIDESTROY = 0x0221; | The application sends this message to the multi-document customer window to close a MDI sub-window |