windows-messages

Get 30th bit of the lParam param in WM_KEYDOWN message

浪尽此生 提交于 2019-12-04 12:29:04
I need to get the 30th bit of the lParam param passed with the WM_KEYDOWN message. This bit as written here allows me to know if the key was pressed before. Is this code right to get it? (lParam >> 30) & 1 I would just use lParam & 0x40000000 . If that's non-zero, then b30 was set (I consider that the thirty first bit of the thirty two, by the way). And there's more likelihood that it will be a {logical-and, compare} operation rather than {shift, logical-and, compare} . Mind you, there's a good chance that a decent compiler would generate the more efficient code anyway even if you used (lParam

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

回眸只為那壹抹淺笑 提交于 2019-12-04 01:14:32
问题 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? 回答1: 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

How can I stop my application from receiving a certain “message”?

北战南征 提交于 2019-12-03 09:31:16
POSSIBLE SOLUTION FOUND! I believe I have found a solution! I will be continuing testing to make sure it DOES in fact work, but I'm hopeful :) I have detailed how I found the solution in EDIT THREE of the question! For anyone wishing to know the full background behind my problem and what I have kind of tried as a result of input from this question, see this: http://pastebin.com/nTrEAkVj I will be editing this frequently (>3 times a day most weekdays) as I progress my research and situation, so keep checking back if you are interested or have some information or knowledge of my issue :) Quick

Disabling desktop composition causes flickering on Tab Control

ε祈祈猫儿з 提交于 2019-12-02 11:19:16
When i disable desktop composition i get flickering/blinking whenever i hover the mouse over the tabs. This only happens when desktop composition is disabled. I have tried to cancel WM_ERASEBKGND message but it doesn't fix the problem. What is the solution to this problem? This is the example that i tried to use for MASM tab control. http://www.dreamincode.net/forums/index.php?app=core&module=attach&section=attach&attach_id=28600 The bin is already compiled. EDIT: After enabling the WS_EX_COMPOSITED flag and added a listview control the frames of listview is not drawn. This only happens if

The name 'WM_DEVICECHANGE' does not exist in the current context

南楼画角 提交于 2019-12-02 01:30:34
问题 I am trying to detect a usb arrival event . I tried to override wndproc() for getting my messages. But I am facing an error by windows messages. The error is : The name 'WM_DEVICECHANGE' does not exist in the current context The name 'DBT_DEVICEARRIVAL' does not exist in the current context Also this is the code I am tried. using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.IO; using Microsoft.Win32.SafeHandles; namespace USBCheckerApp

The name 'WM_DEVICECHANGE' does not exist in the current context

青春壹個敷衍的年華 提交于 2019-12-01 21:57:18
I am trying to detect a usb arrival event . I tried to override wndproc() for getting my messages. But I am facing an error by windows messages. The error is : The name 'WM_DEVICECHANGE' does not exist in the current context The name 'DBT_DEVICEARRIVAL' does not exist in the current context Also this is the code I am tried. using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.IO; using Microsoft.Win32.SafeHandles; namespace USBCheckerApp { public partial class Form1 : Form { bool bDeviceFound = false; public Form1() { InitializeComponent()

Receive Windows Messages in a Service

狂风中的少年 提交于 2019-12-01 21:28:52
问题 I have written a service in VC++. I followed the tutorial here. Now, I am trying to find out how to receive messages like DBT_DEVICEARRIVAL, DBT_DEVICEREMOVECOMPLETE, WM_COPYDATA etc., just like a regular application that has a top level window. When searching for it, I came across this MSDN article In the "Broadcasting Messages" section, in the final paragraphs: Applications receive messages through the window procedure of their top-level windows. Messages are not sent to child windows.

Receive Windows Messages in a Service

岁酱吖の 提交于 2019-12-01 19:45:05
I have written a service in VC++. I followed the tutorial here . Now, I am trying to find out how to receive messages like DBT_DEVICEARRIVAL, DBT_DEVICEREMOVECOMPLETE, WM_COPYDATA etc., just like a regular application that has a top level window. When searching for it, I came across this MSDN article In the "Broadcasting Messages" section, in the final paragraphs: Applications receive messages through the window procedure of their top-level windows. Messages are not sent to child windows. Services can receive messages through a window procedure or their service control handlers. But it is

Preventing Windows shut down

放肆的年华 提交于 2019-12-01 17:58:50
To detect and prevent shutdown the computer I use very simple program. It has only one form and one private procedure like below: TForm3 = class(TForm) private procedure WMQueryEndSession(var Msg : TWMQueryEndSession) ; message WM_QueryEndSession; end; and the implementation procedure TForm3.WMQueryEndSession(var Msg: TWMQueryEndSession); begin Msg.Result := 0; //so I don't want to shutdown while my program is running end; I compiled it Delphi 5 and Delphi 2010. Both of them detect shutdown. But when I compiled in Delphi 2010; after preventing shutdown my program closes. (PC doesn't shutdown)

Preventing Windows shut down

£可爱£侵袭症+ 提交于 2019-12-01 16:39:57
问题 To detect and prevent shutdown the computer I use very simple program. It has only one form and one private procedure like below: TForm3 = class(TForm) private procedure WMQueryEndSession(var Msg : TWMQueryEndSession) ; message WM_QueryEndSession; end; and the implementation procedure TForm3.WMQueryEndSession(var Msg: TWMQueryEndSession); begin Msg.Result := 0; //so I don't want to shutdown while my program is running end; I compiled it Delphi 5 and Delphi 2010. Both of them detect shutdown.