Link to home
Start Free TrialLog in
Avatar of SamGregor
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

Avatar of SamGregor
SamGregor

ASKER

My Thanks for reading the question..
ASKER CERTIFIED SOLUTION
Avatar of prasanth
prasanth

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
My enormous thanks for you answer with an example.