Starting another Instance from the perivious Instance
C.Baskaran -- baski@ddeorg.soft.net
Tuesday, February 04, 1997
Environment: VC++ 4.2-flat , NT 3.51
In my application I want to start the another instance while
closing the previous instance.
The intension behind is , I am having two applications , Server S/w
and Client S/w both communicate by means of Winsocket .The client S/w
will start to execute when the system is started.Server S/w will
interact with Client S/w and get the user request information.
If server S/w is closed by the user , It will send a message
to the Client S/w.After Receiving this, Client S/w will close it's
Running instance and it has to start another instance.I am not using
Shellexecut() inside my application , because I restrict my Client S/w
to run only one instance at a time by using Finwindow() Implementation.
How to start another instance after closing the perivious instance,
Without any user intervention.
regards
Baski
Bing Hou -- hou@tfn.com
Wednesday, February 05, 1997
[Mini-digest: 2 responses]
Since you're using FindWindow to prevent the second instance from being created.
It is not trivial to successfully start another instance while you're exiting,
'cause the main frame's window is unwantingly hanging around.(MFC hides it, do
you don't see it)
As a better approach, I'd suggest you use a Mutex. For your client s/w, the
start and close flows are something like the following.
Start up:
mutex exist?
|yes |no
| |
exit create mutex and create instance
Shut down:
close mutex
|
check flag - set when rcv'd CLOSE msg from server
|yes |no
| |
start another instance exit
The mutex in this case gives you much more flexible control. And it's easy to
use.
Bing Hou
hou@tfn.com
------------------------------------------------------------------------
Recall it as often as you wish, a happy memory never wears out.
______________________________ Reply Separator _________________________________
Subject: Starting another Instance from the perivious Instance
Author: "C.Baskaran" at Internet
Date: 2/4/97 4:54 PM
Environment: VC++ 4.2-flat , NT 3.51
In my application I want to start the another instance while
closing the previous instance.
The intension behind is , I am having two applications , Server S/w
and Client S/w both communicate by means of Winsocket .The client S/w
will start to execute when the system is started.Server S/w will
interact with Client S/w and get the user request information.
If server S/w is closed by the user , It will send a message
to the Client S/w.After Receiving this, Client S/w will close it's
Running instance and it has to start another instance.I am not using
Shellexecut() inside my application , because I restrict my Client S/w
to run only one instance at a time by using Finwindow() Implementation.
How to start another instance after closing the perivious instance,
Without any user intervention.
regards
Baski
-----From: Sandeep
I had the same problem as yours in my previous project. But then instead
of starting a new instance, I kept the current instance of the client
but initialized everything and closed all the running threads except the
main thread. And then restarted the thread that requests the connection
to the server.
Hope you can do the same.
Sandeep
C.Baskaran wrote:
>
> Environment: VC++ 4.2-flat , NT 3.51
>
> In my application I want to start the another instance while
> closing the previous instance.
> The intension behind is , I am having two applications , Server S/w
> and Client S/w both communicate by means of Winsocket .The client S/w
> will start to execute when the system is started.Server S/w will
> interact with Client S/w and get the user request information.
>
> If server S/w is closed by the user , It will send a message
> to the Client S/w.After Receiving this, Client S/w will close it's
> Running instance and it has to start another instance.I am not using
> Shellexecut() inside my application , because I restrict my Client S/w
> to run only one instance at a time by using Finwindow() Implementation.
>
> How to start another instance after closing the perivious instance,
> Without any user intervention.
>
> regards
> Baski
| Вернуться в корень Архива
|