UandI
asked on
Creating a Cancel Dialog for lengthy operations
I'm trying to create a dialog that alows to cancel a running report generation.
I've tried alreade to do this with both of the AfxTreads (work thread and UI tread) but always with the result, that the dialog only appears after the report is sucessfully created and displayed in the dialog.
The calling sequence was as follows in the InitInstance() method of the dialog:
//Create Working Dialog
CWorkThread* pWorkThread = (CWorkThread*) AfxBeginThread(RUNTIME_CLA SS(CWorkTh read));
//Create the desired report
readData(m_iReportNo);
return TRUE; // Here ends the init dialog
Does anyone know a better way to do this or maybe the mistake I did?
Thanks for your help
I've tried alreade to do this with both of the AfxTreads (work thread and UI tread) but always with the result, that the dialog only appears after the report is sucessfully created and displayed in the dialog.
The calling sequence was as follows in the InitInstance() method of the dialog:
//Create Working Dialog
CWorkThread* pWorkThread = (CWorkThread*) AfxBeginThread(RUNTIME_CLA
//Create the desired report
readData(m_iReportNo);
return TRUE; // Here ends the init dialog
Does anyone know a better way to do this or maybe the mistake I did?
Thanks for your help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0297/wicked/wicked0297.htm
Download a File Using URLDownloadToCacheFile
http://www.codeguru.com/internet/urlfile.shtm
Download a File Using URLDownloadToCacheFile
http://www.codeguru.com/internet/urlfile.shtm
Hi,
In the main application call the Dialog for Cancelling the report generation and then Read the records. Dont do it in the initinstance() of the dialog cancel dialog.
Try.
All the best,
Bye
Abdij
In the main application call the Dialog for Cancelling the report generation and then Read the records. Dont do it in the initinstance() of the dialog cancel dialog.
Try.
All the best,
Bye
Abdij
Try using CreateThread(...) to call the readData(...) function. That way, it will not block returning from the InitInstance() dialog.
Another possibility is calling the readData() function from the CWorkThread class. I assume CWorkThread is what is controlling the behavior of the dialog box.