windows-messages

What does the Result property of a windows message mean and when and how to use it?

那年仲夏 提交于 2019-12-01 13:23:11
问题 Result property meaning: Specifies the value that is returned to window in response to handling the message But MSDN does not says anymore: http://msdn.microsoft.com/en-us/library/system.windows.forms.message.result%28v=vs.110%29.aspx I will remark this quote words from the user @ Idle_Mind in this question Trying to write a better WndProc Handling: You can set the Result() property to change the way the message is handled. It is just like a winapi function return success value? Zero = true

WM_TOUCH vs WM_POINTER

巧了我就是萌 提交于 2019-12-01 11:32:31
Which one should I use? I'm only using Windows 8.x, so I don't care about the fact that WM_POINTER is not backwards compatible with Windows 7 etc. I also don't care about gestures; only about raw touches. WM_POINTER's only clear advantage seems to be that it unifies touch and mouse input (but that's easy to work around with WM_TOUCH because mouse events can be checked with GetMessageExtraInfo()). Ease of use is also not an issue; I've been using WM_TOUCH already and I'm just wondering if I should switch to WM_POINTER. My overriding concern is latency and efficiency (game-related application).

Problem with WM_ENDSESSION message

强颜欢笑 提交于 2019-12-01 10:41:22
I have a problem with WM_ENDSESSION message. Namely I would like to exit from the main loop of the application (WindowProc) when the WM_ENDSESSION message is sending... So, I wrote something like that: LRESULT CALLBACK windowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { //... case WM_QUERYENDSESSION: return TRUE; case WM_ENDSESSION: if(wParam) PostQuitMessage(0); break; default: return DefWindowProc(hwnd,msg,wParam,lParam); } return 0; } ..., but it doesn't work - application doesn't exit the main loop... I read about WM_QUERYENDSESSION and WM_ENDSESSION on msdn, but

Problem with WM_ENDSESSION message

て烟熏妆下的殇ゞ 提交于 2019-12-01 08:54:58
问题 I have a problem with WM_ENDSESSION message. Namely I would like to exit from the main loop of the application (WindowProc) when the WM_ENDSESSION message is sending... So, I wrote something like that: LRESULT CALLBACK windowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { //... case WM_QUERYENDSESSION: return TRUE; case WM_ENDSESSION: if(wParam) PostQuitMessage(0); break; default: return DefWindowProc(hwnd,msg,wParam,lParam); } return 0; } ..., but it doesn't work -

How to recognize when number, position, or resolution of monitors has changed? [duplicate]

微笑、不失礼 提交于 2019-12-01 08:18:27
This question already has an answer here: How to detect screen resolution change in Delphi? 1 answer I'm building something which needs to detect when things change with the monitor configuration. This includes Monitor added/removed, Monitor position moved (compared to main screen), or when Monitor resolution has changed. The most ideal way would be catching some windows messages, if any, which are triggered when such events occur. This information will be used to keep a real-time record of the monitor sizes/positions at any given time. For example, when a monitor's resolution is increased, my

What message I receive when I kill my program with task manager

我们两清 提交于 2019-12-01 06:19:38
So I have a C++ dll, that I am using in my c# application, for monitoring Windows Messages. I want to know if WM_CLOSE and WM_QUERYENDSESSION are send because I can't see that from a C# application. If I get one of these messages, I want to do some cleanup with my files but the problem is when I kill it with TM the functions don't work. It seams that I don't get the messages. I think the problem is that Task Manager sends a message to the C# app and not to the c++ dll. Some Code: c++: typedef void (*CLOSING_FUNCTION)(); CLOSING_FUNCTION myClosingFunction; typedef void (*SHUTDOWN_FUNCTION)();

Windows API: What is the first message a window is guaranteed to receive?

旧城冷巷雨未停 提交于 2019-12-01 04:09:29
I've been used to thinking that WM_CREATE is the first message a window receives. However, when testing this assumption on a top-level window, it turns out to be false. In my test, WM_MINMAXINFO turned up as the first message. So, what is the first message a window is guaranteed to receive? You answered your own question. I too see WM_GETMINMAXINFO, on Windows XP SP3, followed by WM_NCCREATE, WM_NCCALCSIZE, and finally WM_CREATE before CreateWindowEx() has even returned the handle to the window being created. What garabage' The general answer is that Microsoft is incompetent when it comes to

What message I receive when I kill my program with task manager

妖精的绣舞 提交于 2019-12-01 03:57:00
问题 So I have a C++ dll, that I am using in my c# application, for monitoring Windows Messages. I want to know if WM_CLOSE and WM_QUERYENDSESSION are send because I can't see that from a C# application. If I get one of these messages, I want to do some cleanup with my files but the problem is when I kill it with TM the functions don't work. It seams that I don't get the messages. I think the problem is that Task Manager sends a message to the C# app and not to the c++ dll. Some Code: c++: typedef

VB.NET Send Tab key to another application window

佐手、 提交于 2019-11-30 21:17:38
问题 I want to send "{TAB}" Key to another application window (send the key to the window not to textbox). I tried: SendMessage(hWnd, WM_SETHOTKEY, VK_TAB, 0) Nothing happened. my goal is: send tab key to my application Or other application when the application window is not in focus. ( i know that sendkey is not professional in this case there is no choice (This is the first time that I'm using it).) I made many attempts and I always returned to the same result: Nothing happened. Does anyone know

How do I catch certain events of a form from outside the form?

百般思念 提交于 2019-11-30 20:15:53
I'm working on something which will require monitoring of many forms. From outside the form, and without putting any code inside the form, I need to somehow capture events from these forms, most likely in the form of windows messages. But how would you capture windows messages from outside the class it's related to? My project has an object which wraps each form it is monitoring, and I presume this handling will go in this object. Essentially, when I create a form I want to monitor, I create a corresponding object which in turn gets added to a list of all created forms. Most importantly, when