Re: Waiting to thread exit



Thx Scott And Joseph.

Sorry for my stupid questions but I already started to learn threads. I made
everythign like You said and now everything works fine. But I have only one
small problem....

In the method I am creating a therad I have to obtain that thread is
finished. This thread will make a backup of some files and after job is done
it will continue to lauch application
void CMyApp::OnInitInstance()
{
// 1. init etc,
// 2. make backup in thread displaying progress
// 3. if backup made do the res
}

But the problem is that point 3 is started when backup thread is not yet
finished.... How o resolve it ?

Regards
Uzytkownik "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> napisal w
wiadomosci news:uU$zW6l8HHA.484@xxxxxxxxxxxxxxxxxxxxxxx
"Sebastian Warmuz" <sebastian@xxxxxxxxxxx> wrote in message
news:O2KuoVk8HHA.396@xxxxxxxxxxxxxxxxxxxxxxx
Hi I am copyying file in a thread, meanwhile I am displaying a disloag
with progress bar, the problem is that message box is displayed before
copying is finished. Can anyone help me ??

Your code started the copying thread, then immediately displayed the "Copy
Finished" message box. That is why the message box is displayed. Don't
call the message box in the same function that starts the thread. Just
return to MFC after you start the thread so the GUI can process messages
while the copy runs.

Add a message handler in the main GUI :

ON_MESSAGE(WM_USER_THREAD_COPY_FINISHED, OnCopyFinished)

and display the message box in this message hander. For some reason you
posted this message to the copy thread, but you should post it to the GUI
main window and create all of your GUI displays in the main thread.




.



Relevant Pages

  • Re: Simple backup / copy tool with GUI
    ... > I am looking for a simple tool to make backup of a selection of my files ... > GUI program for copying different files to one location and I am pretty ... Have you thought of a script? ... After that I used KCron to burn my data onto a CD every morning and every ...
    (comp.os.linux.misc)
  • Re: LInux Backup Strategy? ... a little long.
    ... >> I can do that with windows, so I don't know what the problem is, assuming ... > You really do not want a GUI to to total backups. ... > Also, once a month I run CRU, which comes free with BRU. ... > the one for my daily BRU backup. ...
    (comp.os.linux.misc)
  • Re: Will XP Backup copy files Uncompressed to another disk?
    ... better than me and help me find a link to the actual GUI download. ... PS - Never did find out if the standard XP backup program would only ... Most disk manufacturers make them available on ... folder/directory structures or hard disk without compressing the ...
    (microsoft.public.windowsxp.general)
  • Re: Will XP Backup copy files Uncompressed to another disk?
    ... better than me and help me find a link to the actual GUI download. ... PS - Never did find out if the standard XP backup program would only ... Most disk manufacturers make them available on ...
    (microsoft.public.windowsxp.general)
  • Re: Can you suggest a nice backup tool?
    ... > a script and let it run every hour or something like that. ... > GUI is the worst you can have with a backup or copy of files. ... I need to consider backing up several important directories. ...
    (alt.os.linux.suse)