WM_MOUSEFIRST = $0200;
WM_MOUSEMOVE = $0200;
WM_LBUTTONDOWN = $0201;
WM_LBUTTONUP = $0202; WM_RBUTTONDOWN = $0204;
WM_RBUTTONUP = $0205;按一下笔记本左键,收到的是 $0201 -> $0202 -> $0200 三个消息按一下笔记本右键,收到的是 $0204 -> $0205 两个消息
WM_MOUSEMOVE = $0200;
WM_LBUTTONDOWN = $0201;
WM_LBUTTONUP = $0202; WM_RBUTTONDOWN = $0204;
WM_RBUTTONUP = $0205;按一下笔记本左键,收到的是 $0201 -> $0202 -> $0200 三个消息按一下笔记本右键,收到的是 $0204 -> $0205 两个消息
解决方案 »
- 出现 xxx.exe raised exception class EInoutError with message 'I/O error 104'错误。求救!
- 如何判断视频文件格式?不是通过后缀名!
- 寻求高手指点指点
- 如何从baidu贴吧的cgi-bin/genimg中取验证码可用图片 idhttp、WebBrowser``或者随便什么控件都好```
- 怎么退出EXCEL,要完全关闭后台进程!
- 急,急,急。。。。
- 请问有谁知道,我在对动态创建的combobox与Label进行拖动,拖动任何一个时另一个也一起动,就像是Label与Combobox是捆在一起的一样?还有
- 我已经愁得两晚没睡觉了啊!!各位高人,如何利用一个query对多表更新???
- 在TRichEdit中如何插入图片???
- 高手请进,Ado问题,急急急!
- 【CSDN开心辞典】第一个答对者得90分,其余均分
- TeeChart中的对象分散加载
如GetMessage(msg, 0, WM_MOUSEFIRST, WM_MOUSELAST )
雙擊的話,windows自己判斷時間差產生消息:
Only windows that have the CS_DBLCLKS style can receive WM_LBUTTONDBLCLK messages, which the system generates whenever the user presses, releases, and again presses the left mouse button within the system's double-click time limit. Double-clicking the left mouse button actually generates a sequence of four messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_LBUTTONUP. 其實WM_MOUSEFIRST是WM_MOUSEMOVE的別名,你可以參考messages單元部分的申明
是指双击??左键双击 $0203 -> $0202 -> $0200 三个
右键双击 $0206 -> $0205 两个
之所以測試出,左鍵單擊或雙擊會有$0200。應與你的測試方式有關。
首先,窗口最開始不是active,雖然沒有移動cursor,但也還是可以接收到$0200;
其次,你嘗試先右鍵單擊或雙擊,然后再單擊或雙擊左鍵,看看結果如何?
與雙擊是沒有關系的。
討論到現在,問題的焦點是,為何單擊時也會有WM_MOUSEMOVE?
這個問題也有人討論過,但似乎都沒有滿意的答案。
MSDN解釋WM_MOUSEMOVE說,when cursor move才產生...
我想,這是不是硬件上多做的行為?
先去查證看看
最后那个测过,不是WM_mousemove,那么应该是WM_MOUSEFIRST
Why do I get spurious WM_MOUSEMOVE messages?
In order to understand this properly, it helps to know where WM_MOUSEMOVE messages come from. When the hardware mouse reports an interrupt, indicating that the physical mouse has moved, Windows determines which thread should receive the mouse move message and sets a flag on that thread's input queue that says, "The mouse moved, in case anybody cares." (Other stuff happens, too, which we will ignore here for now. In particular, if a mouse button event arrives, a lot of bookkeeping happens to preserve the virtual input state.) When that thread calls a message retrieval function like GetMessage, and the "The mouse moved" flag is set, Windows inspects the mouse position and does the work that is commonly considered to be part of mouse movement: Determining the window that should receive the message, changing the cursor, and determining what type of message to generate (usually WM_MOUSEMOVE or perhaps WM_NCMOUSEMOVE). If you understand this, then you already see the answer to the question, "Why does my program not receive all mouse messages if the mouse is moving too fast?" If your program is slow to call GetMessage, then multiple mouse interrupts may arrive before your program calls GetMessage to pick them up. Since all that happens when the mouse interrupt occurs is that a flag is set, if two interrupts happen in succession without a message retrieval function being called, then the second interrupt will merely set a flag that is already set, which has no effect. The net effect is that the first interrupt acts as if it has been "lost" since nobody bothered to pick it up. You should also see the answer to the question, "How fast does Windows deliver mouse movement messages?" The answer is, "As fast as you want." If you call GetMessage frequently, then you get mouse messages frequently; if you call GetMessage rarely, then you get mouse messages rarely. Okay, so back to the original question, "Why do I get spurious WM_MOUSEMOVE messages?" Notice that the delivery of a mouse message includes lots of work that is typically thought of as being part of mouse movement. Often, Windows wants to do that follow-on work even though the mouse hasn't actually moved. The most obvious example is when a window is shown, hidden or moved. When that happens, the mouse cursor may be over a window different from the window it was over previously (or in the case of a move, it may be over a different part of the same window). Windows needs to recalculate the mouse cursor (for example, the old window may have wanted an arrow but the new window wants a pointy finger), so it artificially sets the "The mouse moved, in case anybody cares" flag. This causes all the follow-on work to happen, a side-effect of which is the generation of a spurious WM_MOUSEMOVE message. So if your program wants to detect whether the mouse has moved, you need to add a check in your WM_MOUSEMOVE that the mouse position is different from the position reported by the previous WM_MOUSEMOVE message.
http://blogs.msdn.com/oldnewthing/archive/2003/10/01/55108.aspx
看似能说明在用ALT+TAB时收到的wm_mouse
首先,窗口最開始不是active,雖然沒有移動cursor,但也還是可以接收到$0200;
其次,你嘗試先右鍵單擊或雙擊,然后再單擊或雙擊左鍵