[mfc] start/stop other process
-
hello, i want to start and stop other process (win32 vc++ application without gui) in a mfc dialog application. please tell me how to do that ? for stopping, i read that TerminateProcess() can be used but it should be used in extreme circumstances. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used. so is it safe to use it ??
-
hello, i want to start and stop other process (win32 vc++ application without gui) in a mfc dialog application. please tell me how to do that ? for stopping, i read that TerminateProcess() can be used but it should be used in extreme circumstances. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used. so is it safe to use it ??
Hello,
rahuljin wrote:
want to start and stop other process (win32 vc++ application without gui)
What kind of an application are you developing? You can use ShellExecute[^] to create a process. Or if you want more options and possibly control over the spawned process, there is CreateProcess[^] No, you shouldn't be using TerminateProcess(), but again if you say what kind of application are you writing (and if you have written the spawned process as well), a better alternative might be suggested to you.
It is a crappy thing, but it's life -^ Carlo Pallini
-
Hello,
rahuljin wrote:
want to start and stop other process (win32 vc++ application without gui)
What kind of an application are you developing? You can use ShellExecute[^] to create a process. Or if you want more options and possibly control over the spawned process, there is CreateProcess[^] No, you shouldn't be using TerminateProcess(), but again if you say what kind of application are you writing (and if you have written the spawned process as well), a better alternative might be suggested to you.
It is a crappy thing, but it's life -^ Carlo Pallini
mfc application creates some text files which are used by other win32 c++ program. if i try to access the files through mfc application while win32 c++ program running, it causes the crash of the mfc application (beacuse i dont used any 'if' for file open and i cant). i used the createprocess() and it is working great.
-
Hello,
rahuljin wrote:
want to start and stop other process (win32 vc++ application without gui)
What kind of an application are you developing? You can use ShellExecute[^] to create a process. Or if you want more options and possibly control over the spawned process, there is CreateProcess[^] No, you shouldn't be using TerminateProcess(), but again if you say what kind of application are you writing (and if you have written the spawned process as well), a better alternative might be suggested to you.
It is a crappy thing, but it's life -^ Carlo Pallini
-
please tell me how to use TerminateProcess() function. if there is an alternative for this function, please suggest.
-
mfc application creates some text files which are used by other win32 c++ program. if i try to access the files through mfc application while win32 c++ program running, it causes the crash of the mfc application (beacuse i dont used any 'if' for file open and i cant). i used the createprocess() and it is working great.
rahuljin wrote:
mfc application creates some text files which are used by other win32 c++ program. if i try to access the files through mfc application while win32 c++ program running, it causes the crash of the mfc application (beacuse i dont used any 'if' for file open and i cant).
I don't understand this. If you could explain me better, and tell me what exactly are you trying to achieve, I may be able to help you.
It is a crappy thing, but it's life -^ Carlo Pallini
-
rahuljin wrote:
mfc application creates some text files which are used by other win32 c++ program. if i try to access the files through mfc application while win32 c++ program running, it causes the crash of the mfc application (beacuse i dont used any 'if' for file open and i cant).
I don't understand this. If you could explain me better, and tell me what exactly are you trying to achieve, I may be able to help you.
It is a crappy thing, but it's life -^ Carlo Pallini
i created the win32 c++ application long back when i dont have any idea of mfc. it is working fine. with mfc, i create a gui which accept the some content and save them in text files. these text files are then used by the win32 application. win32 application runs at startup of windows and it takes the information from the files and starts using it (it is socket application so it will not read the file again until it receives some information for the ip which is saved in the text file). so i want to restart the win32 application when closing mfc application so that win32 application can use the updated text files. actually i want to use TerminateProcess() and then start it with CreateProcess() function. but i read that TerminateProcess() can create problem with DLL structure.