Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to restart my application from within my application?

Status
Not open for further replies.

julych

Programmer
Dec 21, 2002
14
BG
Is it possible to restart my dialog application from within or should I create an outside object to close it and then to start it again?
 
how would you get it to compile the first time?

(I mean the exe you will loading would be itself and hence not present).

One probable solution would be to keep the reloading function in a dll(?)

/Srikanth

What happens if you’re scared half to death twice?
 
why do you need that?

Ion Filipski
1c.bmp
 
In case that some of the buttons' captions (or other resources)of a dialog application have been changed - is it possible at runtime to set all the resources to their original names/values? I tried with AfxSetResourceHandle(), but nothing happened. So (for now) I chose to restart the application in order to load the original values. It's an awkward decision, but it's the only one for now.
 
If there is an original value which is so important you should save it in a variable. When you need, you will use it at any time for any reasons.

Ion Filipski
1c.bmp
 
Yes, I know that, but it's not a value - there are many values - it's about changing the language of the application, but I don't want to write "an English" file if I have the opportunity to load the orinal resource.
 
Take a look at SetThreadLocale and the use of resource files and LoadString() and such. Create some initialization function for your dialogs. This way you won't need to restart, just reload all resource strings.

Greetings,
Rick
 
a quite cheesey way of doing this would be to get the location of the current .exe, store any settings you want to re-use, then re-launch the exe, then quit the app.

bit of a hack but may work.

Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
Have you had a look at your "OnInitDialog" function. Obviously, this is where the Dialogue gets it's initialisation values before even starting to draw the first dialogue window (refer to MSDN for more info). It should then be possible to add a 'reset' function/button that just calls OnInitDialog function as you would any other. Any additional function you call to setup your dialogue should be called from here when the app starts anyway. If your not doing that, it might be worth moving them.

Have fun...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top