Plz Help:In windows programming how to close dialog box?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2007
Posts: 31
Reputation: risa is an unknown quantity at this point 
Solved Threads: 1
risa risa is offline Offline
Light Poster

Plz Help:In windows programming how to close dialog box?

 
0
  #1
Jul 9th, 2007
How to close dialog box if it doesnt hav OK and CANCEL Button in windows programming.the dialog box is shown with DoModal which inturn calls onInitDialog().But how to close it ?does EndDialog hepls and how ?where to call EndDialog?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,406
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1467
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Plz Help:In windows programming how to close dialog box?

 
0
  #2
Jul 9th, 2007
you could set a timer and close the dialog box in the OnTimer() event handler. There may be a couple other options: (1) send a WM_CLOSE message from another window or (2) click the X button in the upper-right corner, assuming you have not removed that too.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 31
Reputation: risa is an unknown quantity at this point 
Solved Threads: 1
risa risa is offline Offline
Light Poster

Re: Plz Help:In windows programming how to close dialog box?

 
0
  #3
Jul 9th, 2007
There is no X button and i want to close this dialog box after a particular thread ends
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,406
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1467
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Plz Help:In windows programming how to close dialog box?

 
0
  #4
Jul 9th, 2007
In that case have the thread that is closing call PostThreadMessage() to send a private message to the DialogBox thread, then in the dialog's PreTranslateMesssage() event handler check for that message and call EndDialog().
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 31
Reputation: risa is an unknown quantity at this point 
Solved Threads: 1
risa risa is offline Offline
Light Poster

Re: Plz Help:In windows programming how to close dialog box?

 
0
  #5
Jul 10th, 2007
ur solution is not helping me frnd......i hav called a thread in onInitDialog of a dialog box(onInitDialog is called from DoModal()) .in the tread i hav done some processing and after it gets completed i need to end this thread(can i use AfxEndThread?) and should b able to catch the ending of thread after DoModal(by checking for GetExitCode()?) and close the dialog box(using EndDialog).Can do this ???
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,406
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1467
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Plz Help:In windows programming how to close dialog box?

 
0
  #6
Jul 10th, 2007
>>i want to close this dialog box after a particular thread ends
That sounds like there is more than one thread in your dialog application program.

Do NOT call AfxEndThread() because you didn't call AfxBeginThread(). If you want the dialog box to exit immediately after processing OnInitDialog() then just simply call EndDialog() at the end of that function.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 31
Reputation: risa is an unknown quantity at this point 
Solved Threads: 1
risa risa is offline Offline
Light Poster

Re: Plz Help:In windows programming how to close dialog box?

 
0
  #7
Jul 10th, 2007
[no there is only one thread (sorry if my statement indicated so)
i hav called thread by using AfxBeginthread in onInitdialog of Dialog box and wants to close this dialog Box only after the thread ends(do i hav to use AfxEndThread inside the thread(at the end) after the thread completes its processing)
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 23
Reputation: wamuti is an unknown quantity at this point 
Solved Threads: 1
wamuti wamuti is offline Offline
Newbie Poster

Re: Plz Help:In windows programming how to close dialog box?

 
0
  #8
Jan 10th, 2008
call the OnOK() function within the dialog. OnOK() is a member of CWnd and that is what the OK button calls. If you have removed the ON button, no worry. Just call the OnOK() yourself within where you want to terminate the Dialog.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 4
Reputation: vidz is an unknown quantity at this point 
Solved Threads: 1
vidz vidz is offline Offline
Newbie Poster

Re: Plz Help:In windows programming how to close dialog box?

 
0
  #9
Jan 10th, 2008
I think it is automatically close when you click any button in the dialog like yes no. But you must add code to each button whatever you want to accomplish with that button.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 1
Reputation: Anitaj is an unknown quantity at this point 
Solved Threads: 0
Anitaj Anitaj is offline Offline
Newbie Poster

Re: Plz Help:In windows programming how to close dialog box?

 
0
  #10
May 30th, 2008
Hi,
i am designing a menu dailog box. clicking on a menu item will open another dailog. i tried using Destroy() and then DoModal for the another menu item. it works well for one time. the second time i click the same menu item, it shows assertion failed. can u please help me
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC