|
I can't think of a little api to do it, but it wouldn't be too hard to write a small second program.
A.EXE
fire up B.EXE, and pass B its process handle as a parameter.
B.EXE:
wait for process A to die (for a finite length of time!)
start another A.EXE (perhaps with a "/restarted" flag?)
die!
A.EXE
carry on where you left off.
Iain.
|
|
|
|
|
By writing a wrapper application that calls your application?
Why do you need to do this? Restarting an application programmatically, unless it's a service, is something that I haven't heard of.
|
|
|
|
|
Cyrilix wrote: Why do you need to do this?
Cause when the data in my config file has changed, I need to get the new data. So I thought a restart would be the way to go .... I think I should call the function that reads the config data ... but still a good question I think.
Thanks for your input
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Do you really need to restart ?
You could just re-read the configuration data.
|
|
|
|
|
Hi,
Earlier suggestions about re-reading config data, won't work, see I have a loop that is running, that inserts data. I need to change the ODBC DSN connection string and certain field names that may have changed.
This might cause a problem when a update is busy. So back to my first question ,how to restart the application, and the previous sentance states the need for a restart.
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Programm3r wrote: So back to my first question ,how to restart the application...
What's wrong with Iain's suggestion.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I think that the current instance of your application can start a new one of itself (for instance using CreateProcess) and then exit.
I don't know if it is a viable scenario for you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
you could just pop a message box telling the user to restart the application...
|
|
|
|
|
Hi,
ConnMgrQueryDetailedStatus() API fails due to error in connmgr.exe
Can anyone write a sample code to make use of ConnMgrQueryDetailedStatus()API and retrieve the contents of the structure it fills.
Thanks
|
|
|
|
|
|
I'm developing a winmobile6 application(using emulator).I'm not able to find the return type (HRESULT)on execuuting ConnMgrQueryDetailedStatus().
Its throws a runtime error on executing the API.
"A problem has occurred with connmgr.exe"
|
|
|
|
|
You could trying running a debug logging utility to see if anything is output by the crashing application, such as DebugVew or even setup a Symbol Server to get full call stack information, but you'd have to get it to crash under your debugger for that to help.
Sorry I can't be of more help.
regards,
|
|
|
|
|
|
When you use the Device Manager within Windows to look at any connected devices (i.e. keyboard) it has a 'Device Status' field. Can anyone tell me how I can access this information?
cheers,
Andy
|
|
|
|
|
have a look
DeviceIoControl
Device Management Control Codes
http://msdn2.microsoft.com/en-us/library/aa363226.aspx
|
|
|
|
|
|
As I understand, you will only need the DDK for the headers when you're compiliing the application, not for an end user to run it...
Just make sure to test on a more normal envirnnment before distribution!
Iain.
|
|
|
|
|
Hi,
I have a function which i am trying to optimize.The structure is something like this
for(..)
for(...)
if(cond true)
val = 0;
else
val = 1;
The outer loop repeats for about 600 times and the inner loop 400 times.This structure is repeated in a lot of places in the entire code.I want to know if i can attain some performance gain if i used conditional operator(?) instead of the if-else statements since it is within a loop.
Thanks
AJ
|
|
|
|
|
IMHO no gain.
However, maybe you can improve the overall design to increase performance.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
It seems to me that you would want to break out of the loop as soon as possible. Not having enough info to make an "educated guess", I present you with code based on the "wild-assed guess".
int nVal = 0;
for (int i=...)
{
for (int j=...)
{
nVal = (condition is true) ? 1 : 0;
if (nVal != 0)
{
break;
}
}
if (nVal != 0)
{
break;
}
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello All,
Sorry if this question is off topic. I've just started messing around with C++.
I'm trying to set the Text property of a window using :
<br />
SendMessage(handle,WM_SETTEXT,0,(LPARAM)"Hello");<br />
This works fine. The proplem comes when i try the replace "Hello" with a string
variable like so:
<br />
string s;<br />
s = "Hello";<br />
SendMessage(handle_of_editbox,WM_SETTEXT,0,(LPARAM)s);<br />
I get the following error: "Struct 'std::string' used where a "LPARAM" was expected.
And if i don't use the cast the error says it can not convert string to LPARAM.
How can i avoid this?
Thanks
|
|
|
|
|
SendMessage(handle_of_editbox,WM_SETTEXT,0,(LPARAM)s.c_str());
|
|
|
|
|
You need to do this...
SendMessage(handle_of_editbox,WM_SETTEXT,0,(LPARAM)s.c_str());
so that you print out the contents of the string.
|
|
|
|
|
Thank you both very much. That worked perfectly.
|
|
|
|
|
Hi there,
I am working on a system that sends receive messages via TCP sockets and I need to have a way to inform a service person if the link is down from one application to the other by sending a text message (email, SMS). The application that sends and recive messages in writen in C++ but I am not sure how I can add this feature to it. Also I was thinking if I could have a second application that would watch the first one for connection integrity. Could anyone please give me some help (any tutorial, code sample...)
I appreciate any help.
|
|
|
|