|
-
March 19th, 2012, 04:40 AM
#1
Dialog wait...Help me
i am making dialog " please wait ... " :
When i click BUTTON to connect server example :HOSTING ----->show dialog please wait...
and when finish connected auto close dialog.
I maked with Multi thread as in this forum ,but show 2 icon on a program,
and i use ShowWindow to start( has updateWindow,...) ,DestroyWindo to end(close) dialog wait -But error display dialog not normal.
You can help me?
please help me, send me your code example about your dialog wait's .
Thanks so much,
-
March 19th, 2012, 05:02 AM
#2
Re: Dialog wait...Help me
Please, post your code causing the problems. Please, don't forget to use Code tags around code snippets.
Victor Nijegorodov
-
March 19th, 2012, 10:50 PM
#3
Re: Dialog wait...Help me
Code:
CWaitDlg *wDlg = new CWaitDlg(); //CWaitDlg : Class of Dialog IDD_WAITDLG
wDlg->m_Text = _T("Please Wait..."); // m_text is type edit text of Dialog IDD_WAITDLG
wDlg->Create(IDD_WAITDLG,this);
wDlg->CenterWindow();
wDlg->ShowWindow(SW_NORMAL);
wDlg->UpdateWindow();
Sleep(2000); // ****//
wDlg->DestroyWindow();
When i insert " Sleep(2000) // ****// ", i can not move this dialog wait, after 2s ,i can move this window. And when i connect to hostting,it's empty as "not responding",
i think reason is my program,not win system .
-
March 20th, 2012, 01:31 AM
#4
Re: Dialog wait...Help me
It sure is your program that cause the issue. When you enter Sleep from the GUI thread you effectively prevent the message loop from executing.
-
March 20th, 2012, 01:51 AM
#5
Re: Dialog wait...Help me
Sleep() only example that i insert to test, my code connect to server is in Sleep().
When connect to server ,need a few time to finished (have not Sleep() )->but window dialog can't move and show not normal . It' s the same as Sleep.
Have you any way to create other Dialog Wait ?
-
March 20th, 2012, 01:56 AM
#6
Re: Dialog wait...Help me
Well, your thread is busy executing what you have in that "Sleep" block, so it has no time for displaying the dialog.
You could however, move this block into another thread...
Victor Nijegorodov
-
March 21st, 2012, 10:10 PM
#7
Re: Dialog wait...Help me
thanks, i am trying make it by thread ,
-
March 22nd, 2012, 10:44 AM
#8
Re: Dialog wait...Help me
Have you considered using SetTimer / OnTimer?
-
March 22nd, 2012, 01:29 PM
#9
Re: Dialog wait...Help me
The way I normally do this is to create a modeless dialog box with the "Please Wait" message, and display it before doing the task. Then when the task is finished, terminate the modeless dialog.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|