BUG: BN_DOUBLECLICKED Message Handler Not Hit in MFC Dialog Box (247323)
The information in this article applies to:
- Microsoft Windows CE Toolkit for Visual C++ 6.0, when used with:
- The Microsoft Foundation Classes (MFC)
This article was previously published under Q247323 SYMPTOMS
On Windows CE using the MFC classes, when you add a BN_DOUBLECLICKED message handler for a button on a dialog box or a window, the handler is not called when the button is double-clicked. The handler is called on Microsoft Windows 95, Microsoft Windows 98, Microsoft Windows NT 4.0, and Microsoft Windows 2000.
CAUSE
This problem is due to a bug in the Windows CE operating system.
RESOLUTION
One possible resolution is to add a BN_CLICKED handler for the button. Inside of the handler, use code similar to the following to test whether the button has been clicked in the last few milliseconds:
static BOOL s_bLastClicked = TRUE;
static DWORD s_dwTickCount = 0;
if (s_bLastClicked)
{
DWORD dwTickCount = GetTickCount();
if ((dwTickCount - s_dwTickCount) < 500) //Last click less than 500ms?
{
s_bLastClicked = FALSE; //Was double-clicked, don't test next time...
//Assume a double click...
//Do your double-click code here...
}
s_dwTickCount = dwTickCount;
}
else
s_bLastClicked = TRUE;
Manually adding CS_DBLCLKS to the window class style and adding the BS_NOTIFY style for the button does not help. However, this manual process does allow the message to be sent when running on other platforms besides Windows CE.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 10/17/2003 |
---|
Keywords: | kbBug kbButton KB247323 kbAudDeveloper |
---|
|