944,217 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 4874
  • C++ RSS
Jul 9th, 2007
0

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

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
risa is offline Offline
31 posts
since Jul 2007
Jul 9th, 2007
0

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

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,966 posts
since Aug 2005
Jul 9th, 2007
0

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

There is no X button and i want to close this dialog box after a particular thread ends
Reputation Points: 10
Solved Threads: 1
Light Poster
risa is offline Offline
31 posts
since Jul 2007
Jul 9th, 2007
0

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

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().
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,966 posts
since Aug 2005
Jul 10th, 2007
0

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

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 ???
Reputation Points: 10
Solved Threads: 1
Light Poster
risa is offline Offline
31 posts
since Jul 2007
Jul 10th, 2007
0

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

>>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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,966 posts
since Aug 2005
Jul 10th, 2007
0

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

[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)
Reputation Points: 10
Solved Threads: 1
Light Poster
risa is offline Offline
31 posts
since Jul 2007
Jan 10th, 2008
0

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

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.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
wamuti is offline Offline
23 posts
since Jan 2008
Jan 10th, 2008
0

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

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.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
vidz is offline Offline
4 posts
since Jan 2008
May 30th, 2008
0

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

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Anitaj is offline Offline
1 posts
since May 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Problem in Inheritance
Next Thread in C++ Forum Timeline: My sales terminal program





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC