SamGregor
asked on
Catch a button press action
My code is doing a lengthy operation (reading one file and sending the readed bytes to serial port) supported by a dialog with a progress control.
In order to have UPDATE working i have done the following:
// BEGIN MY MESSAGE PROCESSING
//test message pending
MSG lpMsg;
PeekMessage( &lpMsg, NULL,WM_PAINT, WM_RBUTTONDOWN,PM_REMOVE);
switch (lpMsg.message)
{
case WM_PAINT:
dlg.UpdateWindow();
break;
}
The lengthy code is in one Object i´ve created so i have to pass a CDialog reference to it (the reason for dlg).
This piece of code is executed every 200 bytes readed.
In my dialog i have a button so that the user can cancel the operation. Yes, this is the problem.
What to catch to get a cancel and how?
I think i have to make the visual button action!?
// END MY MESSAGE PROCESSING
In order to have UPDATE working i have done the following:
// BEGIN MY MESSAGE PROCESSING
//test message pending
MSG lpMsg;
PeekMessage( &lpMsg, NULL,WM_PAINT, WM_RBUTTONDOWN,PM_REMOVE);
switch (lpMsg.message)
{
case WM_PAINT:
dlg.UpdateWindow();
break;
}
The lengthy code is in one Object i´ve created so i have to pass a CDialog reference to it (the reason for dlg).
This piece of code is executed every 200 bytes readed.
In my dialog i have a button so that the user can cancel the operation. Yes, this is the problem.
What to catch to get a cancel and how?
I think i have to make the visual button action!?
// END MY MESSAGE PROCESSING
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
My enormous thanks for you answer with an example.
ASKER