windows-messages

What window messages are triggered when window comes to foreground?

两盒软妹~` 提交于 2019-12-13 02:52:25
问题 What windows messages are triggered (wm_xyz) when an application window goes from background to foreground (or from invisible/minimized to visible/maximised)? 回答1: There's a complex interaction involving: WM_NCHITTEST WM_NCACTIVATE WM_ACTIVATEAPP WM_ACTIVATE WM_MOUSEACTIVATE WM_SETFOCUS WM_SHOWWINDOW WM_NCPAINT WM_PAINT and others, depending on the details of the situation You can learn a lot by using Spy++ (which comes with Visual Studio). If you can provide more detail on what you're trying

Delphi custom message handlers

半腔热情 提交于 2019-12-12 09:56:18
问题 When a user double-clicks a dbgrid, I show a non-modal form. When they close that form, I want to refresh the grid. To accomplish that, I have tried the following: 1 - Define a custom message constant: const WM_REFRESH_MSG = WM_USER + 1; //defined in a globally available unit 2 - In the OnClose event of my non-modal form, I have this: procedure TMyNonModalForm.FormClose(Sender: TObject; var Action: TCloseAction); begin PostMessage(Self.Handle,WM_REFRESH_MSG,0,0); end; 3 - In the private

How/Why does KillTimer invalidate existing WM_TIMER messages?

那年仲夏 提交于 2019-12-12 09:26:28
问题 I was reading this answer to a question about how to schedule a TIMERPROC to run immediately. I was interested in this as I need to run a method immediately after the caller has finished executing its code synchronously. So I came up with this skeleton: Private Sub asyncProc(ByVal HWnd As LongPtr, ByVal message As WindowsMessage, ByVal timerID As LongPtr, ByVal tickCount As Long) Debug.Print "asyncProc called (should be called second)" End Sub Private Sub syncProc() Debug.Print "syncProc

C# Windows (touch -> click/focus) messages between Form and Controls (WM_xxx)

人走茶凉 提交于 2019-12-12 05:28:06
问题 I have a 3rd party open-source control (not important which one really, but its CefSharp's Chromium Web browser [v 43]). Initially, there was a problem where if a form menu was open when you clicked inside the control, the menu was not dismissing itself (as if the control was swallowing the click event). To circumvent this, the sample application suggested intercepting the WM_MOUSEACTIVATE message between the form and the control, and reacting by posting a WM_NCLBUTTONDOWN back to an element

Windows Messaging - trapping calls originating from another API

六眼飞鱼酱① 提交于 2019-12-11 18:49:39
问题 Scenario: We're busy wrapping up a 3rd party's C++ SDK as a DLL to make it simpler for other developers in our organisation to integrate this functionality into their own apps (be it, .net, delphi, etc) The underlying system sends Windows messages to signal events that occur in the system. These events need to be dealt with, as they could potentially signal the state of the system and what can be done next. Question: What would the best way be to handle these messages within the context of

Get WM_INPUT from Unity window

こ雲淡風輕ζ 提交于 2019-12-11 07:27:57
问题 About I am trying to build a custom mouse input for Unity that gets the data directly from the HID. I do this because I want to try if there is any difference (when using my own custom mouse input) to the Unity API that gives me raw mouse input. Also I need to say that everything I am doing right now does not happen within Unity. I want to build an C++ application and then pass the data to Unity (that's not a part of this question). This link (MSDN High-Definition Mouse Movement) shows that

What's wrong with my character set (Win32 API)

心不动则不痛 提交于 2019-12-11 07:23:17
问题 I'm currently learning Win32 using this tutorial , and I have a hard time with my displayed characters. Take for instance this piece of code which adds a menu to my window upon creation: case WM_CREATE: { HMENU hMenu, hSubMenu; HICON hIcon, hIconSm; hMenu = CreateMenu(); hSubMenu = CreatePopupMenu(); AppendMenu(hSubMenu, MF_STRING, ID_FILE_EXIT, "Exit"); AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "File"); hSubMenu = CreatePopupMenu(); AppendMenu(hSubMenu, MF_STRING, ID_STUFF_GO,

Mouse state winapi

你。 提交于 2019-12-11 06:57:32
问题 Is there any way to get mouse state (position, buttons states) using winapi in C++? I don't want to use windows messages (WM_MOUSEMOVE, WM_LBUTTONDOWN, etc). Thank you! 回答1: It sounds like you are looking for GetCursorInfo and GetKeyState. The latter you call with virtual key codes that specify the mouse button of interest. 回答2: If you only need cursor position, you can just use GetCursorPos(). Remember that both GetCursorInfo() and GetCursorPos() return screen coordinates. Use ScreenToClient

Difference between WM_CLOSE and SC_CLOSE

半世苍凉 提交于 2019-12-11 05:37:02
问题 I just want to know what is the difference between these two messaging constants. Which one should I use in WndProc method when overriding, to handle close button message. 回答1: WM_CLOSE is sent as a window message whenever the window is requested to be closed, by any means. SC_CLOSE is sent as a parameter of a WM_SYSCOMMAND message, when the user presses the Close button (or selects Close from the control menu of the window). Which one you listen for is determined by which action(s) you

Weird values from WM_INPUT, casting mistake?

冷暖自知 提交于 2019-12-11 05:08:29
问题 About I am trying to get the raw mouse input of the system into a C# application. I am using WM_INPUT (MSDN link) to get access to the data. To do so I am using the user32.dll. This (stackoverflow link) helped me alot with writing the API Wrapper. Current approach The following snippet shows the WndProc method. rimTypeMouseCount already shows that the windows messages seem to get fetched correctly. When I turn the polling rate of my mouse up or down I can see this also by checking the count -