Click here to Skip to main content
15,897,291 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: "Wave" buffer -> "A - law" buffer Transforming Question Pin
IsaacLitingjun24-Mar-05 15:31
IsaacLitingjun24-Mar-05 15:31 
GeneralProblem with ActiveX Container Pin
Faisal Sajjad23-Mar-05 22:13
Faisal Sajjad23-Mar-05 22:13 
GeneralPlease help me! Pin
dSolariuM23-Mar-05 22:02
dSolariuM23-Mar-05 22:02 
GeneralRe: Please help me! Pin
toxcct23-Mar-05 22:15
toxcct23-Mar-05 22:15 
GeneralRe: Please help me! Pin
Rahim Rattani23-Mar-05 23:24
Rahim Rattani23-Mar-05 23:24 
GeneralRe: Please help me! Pin
Cedric Moonen23-Mar-05 23:31
Cedric Moonen23-Mar-05 23:31 
GeneralRe: Please help me! Pin
toxcct24-Mar-05 1:01
toxcct24-Mar-05 1:01 
GeneralDisabling dialog button from within the ON_BN_CLICKED handler Pin
Daniele Godi23-Mar-05 21:44
Daniele Godi23-Mar-05 21:44 
Hi all,

I have a problem. I need to start a long computing work when the user clicks a dialog button. During this time the button needs to be disabled. The following simple code doesn't work. Despite the fact that the button changes state from enable to disabled (grayed), it actually gets the mouse inputs. Some of you knows the reason? I wasn't able to disable this button and then I had to write a workaround.

Thanks,

Daniele Godi

///////////////////////////////////////////////////////////////
Sample code

void CMyDlg::OnBnClickedButton1()
{
// disable the button
m_ctrlButton1.EnableWindow(FALSE);

BeginWaitCursor();

DoSomeLongWork();

EndWaitCursor();

// workaround, I have to remove manually the mouse input from
// the message queue
if (::GetInputState())
{
MSG msg;

while ( ::PeekMessage( &msg, NULL, NULL, NULL, PM_NOREMOVE ) )
{
// found a mouse message, remove it
if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST))
{
::PeekMessage( &msg, NULL, NULL, NULL, PM_REMOVE);
}
else
{
if ( !::AfxGetThread()->PumpMessage() )

{
// if FALSE exit both dialog and application
EndDialog(FALSE);
::PostQuitMessage( -1 );
return;
}
}
}
}

m_ctrlButton1.EnableWindow(TRUE);

return;
}



Daniele Godi
GeneralRe: Disabling dialog button from within the ON_BN_CLICKED handler Pin
toxcct23-Mar-05 22:09
toxcct23-Mar-05 22:09 
GeneralRe: Disabling dialog button from within the ON_BN_CLICKED handler Pin
qrverona24-Mar-05 2:19
qrverona24-Mar-05 2:19 
GeneralRe: Disabling dialog button from within the ON_BN_CLICKED handler Pin
toxcct24-Mar-05 2:24
toxcct24-Mar-05 2:24 
GeneralRe: Disabling dialog button from within the ON_BN_CLICKED handler Pin
24-Mar-05 3:21
suss24-Mar-05 3:21 
GeneralRe: Disabling dialog button from within the ON_BN_CLICKED handler Pin
Daniele Godi29-Mar-05 23:05
Daniele Godi29-Mar-05 23:05 
GeneralRe: Disabling dialog button from within the ON_BN_CLICKED handler Pin
Member 52815523-Mar-05 22:22
Member 52815523-Mar-05 22:22 
GeneralRe: Disabling dialog button from within the ON_BN_CLICKED handler Pin
qrverona24-Mar-05 2:19
qrverona24-Mar-05 2:19 
Generaldll signature. Pin
oustar23-Mar-05 21:42
oustar23-Mar-05 21:42 
GeneralRe: dll signature. Pin
gP_t_gr823-Mar-05 22:16
gP_t_gr823-Mar-05 22:16 
QuestionHow to obtain the inserted row's ID (database) Pin
Abyss23-Mar-05 21:22
Abyss23-Mar-05 21:22 
GeneralExport Member function / class Pin
Steve Messer23-Mar-05 21:15
Steve Messer23-Mar-05 21:15 
GeneralRe: Export Member function / class Pin
David Crow24-Mar-05 5:43
David Crow24-Mar-05 5:43 
GeneralRe: Export Member function / class Pin
Steve Messer24-Mar-05 7:01
Steve Messer24-Mar-05 7:01 
GeneralRe: Export Member function / class Pin
cmk24-Mar-05 8:34
cmk24-Mar-05 8:34 
GeneralRe: Export Member function / class Pin
Steve Messer24-Mar-05 8:41
Steve Messer24-Mar-05 8:41 
GeneralRe: Export Member function / class Pin
cmk24-Mar-05 10:17
cmk24-Mar-05 10:17 
GeneralRe: Export Member function / class Pin
cmk24-Mar-05 10:24
cmk24-Mar-05 10:24 

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.