Windows Shell issues

It seems when you use a shell to launch an app and you close the shell, the app keeps running.
Works fine with OS X (calling close or nil quits the shell AND the app running) but it doesn’t for Windows.

I did found some threads here at Xojo forum about this and there is a ‘solution’ to force quit the shell for 32bit apps.
The app I launch in the shell is 64bit and it doesn’t quit (didn’t try with a 32bit version though).

For me it is unclear if this is a Xojo issue (some say it is, some say it isn’t). Can someone clarify this?

Anyhow, I am stuck converting my app to Windows because I need this to work. Bummer.

[quote=120112:@Christoph De Vocht]It seems when you use a shell to launch an app and you close the shell, the app keeps running.
Works fine with OS X (calling close or nil quits the shell AND the app running) but it doesn’t for Windows.

I did found some threads here at Xojo forum about this and there is a ‘solution’ to force quit the shell for 32bit apps.
The app I launch in the shell is 64bit and it doesn’t quit (didn’t try with a 32bit version though).

For me it is unclear if this is a Xojo issue (some say it is, some say it isn’t). Can someone clarify this?

Anyhow, I am stuck converting my app to Windows because I need this to work. Bummer.[/quote]

Which app is this ? Anyway to experiment for you ?

It is makeiso.exe
Mostly used for patching video files or creating dvd iso files.

But you can use any app to see the problem.

Will make a small example later today and post it here.

I understand what is going on : your app is not set to terminate by itself, so you have to do it.
This is done through two command line options :

  • Get the list of running apps : tasklist
  • In the shell.result, look for the line with makeiso.exe and the process id next to it on the line
  • run taskkill /PID 1234 where 1234 is the process ID for the task. That will close the app.

These commands are the equivalent of ps aux and kill 1234 on Mac

[quote=120133:@Michel Bujardet]Get the list of running apps : tasklist
In the shell.result, look for the line with makeiso.exe and the process id next to it on the line
run taskkill /PID 1234 where 1234 is the process ID for the task. That will close the app.
These commands are the equivalent of ps aux and kill 1234 on Mac[/quote]

Yes, this is possibility but it would be much ‘cleaner’ when you use .close to quit the app you started in the shell. As it works within OS X.

As said, I will make an small example and file a feedback case.

[quote=120331:@Christoph De Vocht]Yes, this is possibility but it would be much ‘cleaner’ when you use .close to quit the app you started in the shell. As it works within OS X.

As said, I will make an small example and file a feedback case.[/quote]

The topic came up before and what I gave you is the solution found. Not everything is going to work like OS X …

That said, it never hurts to post a well documented feedback.

[quote=120331:@Christoph De Vocht]Yes, this is possibility but it would be much ‘cleaner’ when you use .close to quit the app you started in the shell. As it works within OS X.

As said, I will make an small example and file a feedback case.[/quote]
On OS X a shell is a child process
And the behavior of such a thing on OS X & Linux is that child processes die when the parent dies

Not so on Windows - although there may be an option to make them behave this way
I dont know

It’s a slight bit more convoluted, but there is a way:

WaitForSingleObject function

[quote=120344:@Norman Palardy]Not so on Windows - although there may be an option to make them behave this way
I dont know[/quote]

Any luck with this?

No since I never made any commitment to look
I have a zillion things to do already

Did you try Tims suggestion ?

If you have not done so, the only way to make sure this is addressed is to file a feature request…

For windows you can also do this:

  // More info: http://msdn.microsoft.com/en-us/library/ateytk4a%28v=vs.84%29.aspx
  
  Dim oShell, oRes As OLEObject
  Dim n As Integer
  
  oShell = NEW OLEObject ("WScript.Shell")
  oRes = oShell.exec("calc.exe")
    
  n = MsgBox("Close calc?", 32)
  If n = 1 Then
    //user pressed OK
    oRes.Terminate
    oShell = Nil
  End If