Enable/Disable a Message :: MFC

kuphryn

Senior member
Jan 7, 2001
400
0
0
Hi.

Is it possible to enable/disable a message from the message for a time interval?

For example, let say I have a program that plays AVI files. For the first ten seconds, I want to disable the open button. I can disable a button. However, I found that if the user clicks on it while it is disabled, the framework keeps the message and class the message handler after I enable the button.

Is it possible to disable a button *completely*, or even better, ignore/unignore a specific message?

Thanks,
Kuphryn
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
There is a Windows API Peek command that allows you to look at messages in your queue.

However, the disabling of a button should prevent the button message from being generated.
You may need to investigate to ensure that you have not generated an end around or another message is being created.
 

Argo

Lifer
Apr 8, 2000
10,045
0
0
Which message are you handling? OnMouseDown or OnBtnClicked? If it's the first, then use should be handling the second message.
 

kuphryn

Senior member
Jan 7, 2001
400
0
0
I think I know the problem. The problem is before Windows draw the dialog box and the disabled button, there is another process that draws and update a progress bar. If the user clicks the button before the progress bar is done, Windows ignores the fact that the button is disabled. Windows then sends the message about the click button after the progress bar is done.

I ultimately need to multithread that portion of the program.

Kuphryn