Analyze the process first:
Click:
Down> up
Double-click:
Down> up> Down> up
Therefore, during the process of clicking and double-clicking, there must be conflicts due to the key delay. In addition, the clicking and double-clicking functions of VC dialog/view are as follows:
On_wm_lbuttondblclk ()
On_wm_lbuttondown ()
By default, they do not handle this latency, so they can only be compiled by themselvesCodeAfter finding the relevant information, sort out the Code as follows:
Void cmouseclickdlg: onlbuttondblclk (uint nflags, cpoint point) <br/>{< br/> // todo: add your message handler code here and/or call default <br/> afxmessagebox ("double click this time! "); // Single click <br/> cdialog: onlbuttondblclk (nflags, point); <br/>}</P> <p> void cmouseclickdlg :: onlbuttondown (uint nflags, cpoint point) <br/>{< br/> // todo: add your message handler code here and/or call default <br/> msgmsg; <br/> dworddwold = gettickcount (); <br/> dworddwnew = 0; </P> <p> while (1) <br/>{< br/> // intercept mouse messages <br/> If (: peekmessage (& MSG, null, 0, 0, pm_remove )) <br/>{< br/>: transl Atemessage (& MSG); <br/>: dispatchmessage (& MSG); <br/> If (MSG. message = wm_lbuttondblclk) <br/> return; <br/>}< br/> dwnew = gettickcount (); </P> <p> // obtain the double-click interval of the system. Of course, you can set the interval .. <br/> If (dwnew-dwold> getdoubleclicktime () <br/> break; <br/>}< br/> afxmessagebox ("Click here! "); <Br/> cdialog: onlbuttondown (nflags, point); <br/>}< br/>
Of course, you can also use setdoubleclicktime to adjust the mouse double-click latency (this option is available in the control panel ).