Click here to Skip to main content
15,902,447 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: I need help about how to use OpenSSL library. Pin
cperdana28-Mar-10 20:00
cperdana28-Mar-10 20:00 
GeneralLonghorn programming and WinFX Pin
Snyp8-Nov-03 10:03
Snyp8-Nov-03 10:03 
GeneralI want to open NEXT or PREV file. with button control Pin
gaesabal8-Nov-03 8:58
gaesabal8-Nov-03 8:58 
GeneralRe: I want to open NEXT or PREV file. with button control Pin
Antti Keskinen8-Nov-03 10:44
Antti Keskinen8-Nov-03 10:44 
QuestionHow do I handle Single and Double Mouse Clicks? Pin
jasonmgeorge8-Nov-03 8:30
jasonmgeorge8-Nov-03 8:30 
AnswerRe: How do I handle Single and Double Mouse Clicks? Pin
Antti Keskinen8-Nov-03 9:58
Antti Keskinen8-Nov-03 9:58 
GeneralRe: How do I handle Single and Double Mouse Clicks? Pin
jasonmgeorge8-Nov-03 10:33
jasonmgeorge8-Nov-03 10:33 
GeneralRe: How do I handle Single and Double Mouse Clicks? Pin
Antti Keskinen8-Nov-03 11:06
Antti Keskinen8-Nov-03 11:06 
If you need to have specific, unconditionally seperate handlers for the single-click and the double-click, then I think you should consider a completely different approach: capture the mouse and monitor it's clicks. If a click is made, and another click is not made in the next 20-50 ms, then a custom WM_LBUTTONDOWN message is generated, otherwise, a custom WM_LBUTTONDBLCLK message is made.

Doing this MFC-way would mean resorting to a little more than an outright hack..

This means that in addition the standard WM_ handlers, you must create more UINTs for custom WM_ messages, such as WM_CUSTOM_L/RBUTTONDOWN and WM_CUSTOM_L/RBUTTONDBLCLK (this would mean four new UINTs), which your application then handles. In the standard handlers, you calculate the time span between clicks, and determine the custom message based on these calculations.

A bit more work, but doable, I think. For example, add two timers, both with a custom WM_CUSTOM_TIMER1/2 message applied, to your application, which you start and stop with the clicks. When a WM_L/RBUTTONDOWN message is received, the timer is started. If a new message of same type is received and the timer is still running, then the timer is stopped and a WM_CUSTOM_L/RBUTTONDBLCLK message is generated. If the timer is allowed to run to it's first 'WM_CUSTOM_TIMER1/2' handler, it generates the WM_CUSTOM_L/RBUTTONDOWN and stops itself.

In addition to this, you should override the WindowProc member function to get a direct access to the window procedure and message handling of your application. Alternatively, you can also write the required message map entries manually. Use ON_MESSAGE ( <Message ID>, <function name> ) entries in the map.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
AnswerRe: How do I handle Single and Double Mouse Clicks? Pin
Michael Dunn8-Nov-03 14:30
sitebuilderMichael Dunn8-Nov-03 14:30 
GeneralBITMAPV4HEADER &amp; BITMAPV5HEADER Pin
John R. Shaw8-Nov-03 7:34
John R. Shaw8-Nov-03 7:34 
GeneralRe: BITMAPV4HEADER &amp; BITMAPV5HEADER Pin
J. Dunlap8-Nov-03 13:22
J. Dunlap8-Nov-03 13:22 
GeneralWindows Address Book Pin
PJ Arends8-Nov-03 7:17
professionalPJ Arends8-Nov-03 7:17 
GeneralRe: Windows Address Book Pin
cmk8-Nov-03 9:45
cmk8-Nov-03 9:45 
GeneralRe: Windows Address Book Pin
PJ Arends9-Nov-03 6:58
professionalPJ Arends9-Nov-03 6:58 
GeneralRe: Windows Address Book Pin
Peter Molnar8-Nov-03 9:45
Peter Molnar8-Nov-03 9:45 
GeneralRe: Windows Address Book Pin
PJ Arends9-Nov-03 6:59
professionalPJ Arends9-Nov-03 6:59 
Questionhow to find the number of same items in two STL vectors Pin
hesham_16820018-Nov-03 6:47
hesham_16820018-Nov-03 6:47 
AnswerRe: how to find the number of same items in two STL vectors Pin
ZoogieZork8-Nov-03 8:03
ZoogieZork8-Nov-03 8:03 
GeneralSend Sms using visaul c++ 6 Pin
nolanl8-Nov-03 3:04
nolanl8-Nov-03 3:04 
GeneralRe: Send Sms using visaul c++ 6 Pin
Peter Molnar8-Nov-03 5:28
Peter Molnar8-Nov-03 5:28 
GeneralRe: Send Sms using visaul c++ 6 Pin
nolanl9-Nov-03 23:31
nolanl9-Nov-03 23:31 
GeneralCButton declaration Pin
Ahmed Galal8-Nov-03 2:30
Ahmed Galal8-Nov-03 2:30 
GeneralRe: CButton declaration Pin
Antti Keskinen8-Nov-03 12:05
Antti Keskinen8-Nov-03 12:05 
GeneralRe: CButton declaration Pin
Ahmed Galal8-Nov-03 12:11
Ahmed Galal8-Nov-03 12:11 
Generalclass with static functions and variables Pin
Kuniva8-Nov-03 0:00
Kuniva8-Nov-03 0:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.