Re: EndDialog hangs on Core2Duo system
Alex wrote:
Sorry, was my mistake. The dialog is not created in the worker thread. But as
the dialog is updated in the worker thread, it is a design failure.
I will rewrite the code concerning the uploading process and the progress
bar.
What I should achieve:
The main window shows some information about the loaded binary file - CRC,
Compilation date, type of microprocessor, ... - and about the connected
embedded system ( CRC, microprocessor, ... ).
When a valid binary file is loaded and the user is connected with on of our
door controllers, he will be able to program the system with the new binary
file. During the upload, the programm shall not be closed nor should any
other action be performed.
When the Upload process is started, i will open the dialog with the progress
bar showing the state of the upload. The upload thread will send messages
indicating how much percent of the file have been uploaded.
UWM_UPDATE_PERCENT
Inputs: WPARAM: ignored, 0
LPARAM: (LPARAM) (int i)
Result: LRESULT:
Logically void, 0, always
Where - in which message_map - do I have to register the
UWM_UPDATED_PERCENT? In the dialog class?
BEGIN_MESSAGE_MAP(CMyDialog)
ON_REGISTERED_MESSAGE(UWM_UPDATE_PERCENT,OnUpdatePercent)
END_MESSAGE_MAP()
In my worker thread i will have:
while( bolUploadInProgress)
{
//.....
intCurrentPercent = .....
SendMessage( UWM_UPDATE_PERCENT, wParam, (LPARAM) intCurrentPercent)
}
Is this correct or am I missing something?
Alex:
Many people (not me) would tell you to use PostMessage() here. If you
use SendMessage() you can use the return value to implement a Cancel
feature (if appropriate in your situation).
--
David Wilkinson
Visual C++ MVP