Hi Sal,
I suppose the problem is that while you are attending the Event B, the messages for this window are not being dispatched. So they are being queued and dispathched after you finish to attend the Event B and you have enabled the button A again. Something like that:
- OnBnClickedButtonB
- buttonA.EnableWindow(FALSE)
(mouse events for the window are being queued and not dispatched)
- buttonA.EnableWindow(TRUE)
- ~OnBnClickedButtonB
(the application dispatch queued events so the button is enabled again)
This is not just a problem with a CBitmapButton...it should happed with any other button (I haven't tried myself).
A possible workaround could be dispatching mouse events for this window before enabling the button again...although I didn't like too much do this kind of thigs...maybe someone can give you a better solution:
void CMyDlg::OnBnClickedButtonB()
{
m_buttonA.EnableWindow(FALSE);
//Process button B clicked event
MSG msg;
while(PeekMessage( &msg,
GetSafeHwnd(),
WM_MOUSEFIRST,
WM_MOUSELAST,
PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
m_buttonA.EnableWindow(TRUE);
}
Hope this help!
Javier