Plz Help:In windows programming how to close dialog box?
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?
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.
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().
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 ???
>>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.
[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)
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.
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
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...