Launch, then close a SHELL'd app? 
Author Message
 Launch, then close a SHELL'd app?

Hello,

I started working on an app to take over the launching of a php
script, via a shortcut. The idea was to have this app launch php.exe
w/ the neccessary command line paramters, but to have no visible DOS
box. I wanted to keep it all localizied to the system tray (no Taskbar
display, etc.).

I am using SHELL to launch php w/ the neccessary parameters and to
keeps it's execution hidden.

retval = Shell("C:\PHP\php.exe \test\test.php", vbHide)

However, while launching php and "hiding" it is not a problem I am
wondering how I can efficiently terminate the process (php.exe) when
the app, which called it, is closed.

Thanks.



Thu, 08 Sep 2005 17:01:23 GMT  
 Launch, then close a SHELL'd app?
if this is a windows exe (not dos box app), search my site for the code to
obtain the hwnd from an app started with shell, then use the hwnd returned
to call PostMessage with WM_CLOSE, 0& and ByVal 0& as the last 3 params in
the API.

If this is a dos box app, you can tell the window to close when finished by
using cmd/c to start it, ie ...

cmd = environ$("comspec")
yourexe = php.exe /w /whatever

shell cmd & " /c " & yourexe, <show state constant>

--

Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.


: Hello,
:
: I started working on an app to take over the launching of a php
: script, via a shortcut. The idea was to have this app launch php.exe
: w/ the neccessary command line paramters, but to have no visible DOS
: box. I wanted to keep it all localizied to the system tray (no Taskbar
: display, etc.).
:
: I am using SHELL to launch php w/ the neccessary parameters and to
: keeps it's execution hidden.
:
: retval = Shell("C:\PHP\php.exe \test\test.php", vbHide)
:
: However, while launching php and "hiding" it is not a problem I am
: wondering how I can efficiently terminate the process (php.exe) when
: the app, which called it, is closed.
:
: Thanks.



Thu, 08 Sep 2005 22:54:05 GMT  
 Launch, then close a SHELL'd app?

Quote:
> Hello,

> I started working on an app to take over the launching of a php
> script, via a shortcut. The idea was to have this app launch php.exe
> w/ the neccessary command line paramters, but to have no visible DOS
> box. I wanted to keep it all localizied to the system tray (no Taskbar
> display, etc.).

> I am using SHELL to launch php w/ the neccessary parameters and to
> keeps it's execution hidden.

> retval = Shell("C:\PHP\php.exe \test\test.php", vbHide)

> However, while launching php and "hiding" it is not a problem I am
> wondering how I can efficiently terminate the process (php.exe) when
> the app, which called it, is closed.

> Thanks.

I know the following works for apps in the taskbar, not sure about apps in
systray.

AppActivate retval    'retval returned by Shell.
SendKeys "%{F4}"  'Sends a Alt-F4 which will summarily close app.

I'm sure there are slicker ways to do this using the API, but the above has
worked for me.



Thu, 08 Sep 2005 23:10:22 GMT  
 Launch, then close a SHELL'd app?

Quote:
>if this is a windows exe (not dos box app), search my site for the code to
>obtain the hwnd from an app started with shell, then use the hwnd returned
>to call PostMessage with WM_CLOSE, 0& and ByVal 0& as the last 3 params in
>the API.

php.exe is ran via a DOS box, in Windows.

Quote:

>If this is a dos box app, you can tell the window to close when finished by
>using cmd/c to start it, ie ...

>cmd = environ$("comspec")
>yourexe = php.exe /w /whatever

>shell cmd & " /c " & yourexe, <show state constant>

I will try this asap.. However, when the command line is execute
(php.exe /test/test.php) the program (php.exe) stays active in memory.
It never "finishes" (so to speak), until the user want to terminate
it. Basically it is "hosting" something and that is why it does not
auto terminate after execution.

I just need to be able to force it (php.exe) to close on command, if
possible.

Thanks.



Fri, 09 Sep 2005 02:05:24 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Shell doesn't launch some apps correctly

2. closing dos app's window after shell

3. Problem launching app from VB w/SHELL

4. launching Win95 shell from VB app

5. Setting working directories for apps launched with SHELL

6. Launching App with Shell command

7. Launching Windows 3.x with a VB4 app as shell

8. Detecting when a 'shell'ed application has closed

9. Run App with Shell and close it

10. close a shelled app

11. How to Close a DOS app after running from Shell()

12. Close an app running under Shell function?

 

 
Powered by phpBB® Forum Software