PC Review


Reply
Thread Tools Rate Thread

Controlled Close

 
 
Bjoern
Guest
Posts: n/a
 
      5th Dec 2003
Hi all,
is there a possibility to close an other application in WinCE and c#.net.
In my main programm i want to start an other programm.
After that i want to close this programm. But this programm should not
be close "hard".
1. The underprogramm should execute the closing-event before or
2. The underprogramm should execute my closing-funktion before closing programm.

Then:
1.Start underprogramm with my mainprogramm
2.Controlled close of this underprogramm by close-event or any close-funktion.

Please give me a detailed response.
Thx
 
Reply With Quote
 
 
 
 
Paul G. Tobey [eMVP]
Guest
Posts: n/a
 
      5th Dec 2003
No, there's no way for a random program to assure that it will exit cleanly
as a result of anything in particular that you do from a second executable.
Is the other program yours? If so, you can create a scheme for the
applications to communicate with each other.

Paul T.

"Bjoern" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all,
> is there a possibility to close an other application in WinCE and c#.net.
> In my main programm i want to start an other programm.
> After that i want to close this programm. But this programm should not
> be close "hard".
> 1. The underprogramm should execute the closing-event before or
> 2. The underprogramm should execute my closing-funktion before closing

programm.
>
> Then:
> 1.Start underprogramm with my mainprogramm
> 2.Controlled close of this underprogramm by close-event or any

close-funktion.
>
> Please give me a detailed response.
> Thx



 
Reply With Quote
 
Bjoern
Guest
Posts: n/a
 
      8th Dec 2003
Thank you for your response.
Can you give me a small simple example for a schema in which two programms
communicate together.

Thx
-------------------------------




"Paul G. Tobey [eMVP]" <ptobey_no_spam@instrument_no_spam.com> wrote in message news:<(E-Mail Removed)>...
> No, there's no way for a random program to assure that it will exit cleanly
> as a result of anything in particular that you do from a second executable.
> Is the other program yours? If so, you can create a scheme for the
> applications to communicate with each other.
>
> Paul T.
>
> "Bjoern" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi all,
> > is there a possibility to close an other application in WinCE and c#.net.
> > In my main programm i want to start an other programm.
> > After that i want to close this programm. But this programm should not
> > be close "hard".
> > 1. The underprogramm should execute the closing-event before or
> > 2. The underprogramm should execute my closing-funktion before closing

> programm.
> >
> > Then:
> > 1.Start underprogramm with my mainprogramm
> > 2.Controlled close of this underprogramm by close-event or any

> close-funktion.
> >
> > Please give me a detailed response.
> > Thx

 
Reply With Quote
 
Paul G. Tobey [eMVP]
Guest
Posts: n/a
 
      8th Dec 2003
Program 1
-----------

On startup, fork a new thread which uses CreateEvent() (a Win32 API
function), to create a named event (pick any name that you like). After
creating the event, call WaitForSingleObject() on the event (probably with
no time-out value). If this call returns, exit the program.

In the main thread of the program, do whatever the program is supposed to
do. If it wants to exit, because the process is done or the user clicks the
right button or whatever, call CreateEvent()/SetEvent() on the named event,
causing the second thread to exit the application.

Program 2
-----------

When it wants program 1 to run, P/Invoke CreateProcess(). It can keep the
handle to that program and use that to wait for it to exit, if desired
(using WaitForSingleObject()). Or, it can do whatever it wants and, when
it's time to force program 1 to exit, call CreateEvent() and SetEvent()
(with the same event name, obviously), to cause program 1 to exit.

The declarations for all of these Win32 APIs can be found either in the
newsgroup archives or in the OpenNetCF library (or maybe both)...

Paul T.

"Bjoern" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thank you for your response.
> Can you give me a small simple example for a schema in which two programms
> communicate together.
>
> Thx
> -------------------------------
>
>
>
>
> "Paul G. Tobey [eMVP]" <ptobey_no_spam@instrument_no_spam.com> wrote in

message news:<(E-Mail Removed)>...
> > No, there's no way for a random program to assure that it will exit

cleanly
> > as a result of anything in particular that you do from a second

executable.
> > Is the other program yours? If so, you can create a scheme for the
> > applications to communicate with each other.
> >
> > Paul T.
> >
> > "Bjoern" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Hi all,
> > > is there a possibility to close an other application in WinCE and

c#.net.
> > > In my main programm i want to start an other programm.
> > > After that i want to close this programm. But this programm should not
> > > be close "hard".
> > > 1. The underprogramm should execute the closing-event before or
> > > 2. The underprogramm should execute my closing-funktion before closing

> > programm.
> > >
> > > Then:
> > > 1.Start underprogramm with my mainprogramm
> > > 2.Controlled close of this underprogramm by close-event or any

> > close-funktion.
> > >
> > > Please give me a detailed response.
> > > Thx



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Excel 97 be controlled from VB.NET Nick Dreyer Microsoft Excel Programming 1 21st Jul 2005 04:11 PM
controlled network =?Utf-8?B?UWVsYW1p?= Windows XP Networking 1 2nd Jul 2005 08:17 PM
Controlled access to Wed Dad who want web safety Windows XP Networking 1 18th Jul 2004 01:21 AM
Services Can't Be Controlled Justin Foster Microsoft Windows 2000 1 4th Nov 2003 07:22 PM
Controlled Playback? Help! Peter Microsoft Powerpoint 1 1st Aug 2003 10:57 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:58 AM.