Click here to Skip to main content
15,850,359 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I click a button software must terminate but is there a way software terminates and then restarts?

What I have tried:

I tried to repete OnInitDialog but software crashes;
<pre>

void CDlgEstimateTime::OnStnClickedSttext()
{
	

	bool b;
    b= OnInitDialog();
}
Posted
Updated 12-Oct-22 6:34am
Comments
CHill60 12-Oct-22 10:18am    
You would have to have something else watching for it and restarting if finished. Or have it scheduled to start on a regular basis but self-terminate if there is already an instance running.
Member 14594285 12-Oct-22 11:52am    
thanks for idea

I've written a simple program that relaunches an executable if it exits. See
robust-services-core/src/launcher[^].
 
Share this answer
 
v2
Never mind. The solution is obviously inappropriate for this poster.
 
Share this answer
 
v3
That is probably not a good way to do it as OnInitDialog is designed to be called in response to the WM_INITDIALOG message. And that in turn is initiated by the call to DialogBox(Param). You need to have a separate function the resets your startup parameters/values which you can call in response to your special button.
 
Share this answer
 
I put an other dialog and I close principal dialog and then I reopen dialog
 
Share this answer
 
Comments
CHill60 13-Oct-22 5:12am    
Your post said that you wanted to restart the program not just close a dialog box! Try to be more precise with your questions and you get more appropriate answers

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900