Multiple Applications and Shell issue

I am having issues with using one application, Program A, to launch another, Program B, and then using Program B to launch a shell. The code is written so that the shell in Program B opens as soon as the application opens. If I run Program B by itself, the shell opens fine and will run in the background until I close Program B. However, if I run Program A first and use it to open Program B, the shell will open for a second and then close immediately.

This is the code that I am currently using to launch Program B, although I have tried launching it via a shell but still have the same issue as mentioned above.

[code]dim f as folderitem

f = new folderitem ("C:\Program Files\Program B\Program B.exe)[/code]

This is the code that I am using to initialize and launch the shell.

[code] shell1 = new Shell
shell1.mode = 2 //I have tried running this in mode 1 and get the same issue

shell1.Execute(“ShellProgram”, Val1 + " 1")[/code]

I am unsure as to what could be causing this issue and would greatly appreciate any help I could get.

[quote=203032:@Daniel Warren]I am having issues with using one application, Program A, to launch another, Program B, and then using Program B to launch a shell. The code is written so that the shell in Program B opens as soon as the application opens. If I run Program B by itself, the shell opens fine and will run in the background until I close Program B. However, if I run Program A first and use it to open Program B, the shell will open for a second and then close immediately.

This is the code that I am currently using to launch Program B, although I have tried launching it via a shell but still have the same issue as mentioned above.

[code]dim f as folderitem

f = new folderitem ("C:\Program Files\Program B\Program B.exe)[/code]

This is the code that I am using to initialize and launch the shell.

[code] shell1 = new Shell
shell1.mode = 2 //I have tried running this in mode 1 and get the same issue

shell1.Execute(“ShellProgram”, Val1 + " 1")[/code]

I am unsure as to what could be causing this issue and would greatly appreciate any help I could get.[/quote]

You may want to use f.launch instead.

http://documentation.xojo.com/index.php/FolderItem.Launch

Odd. Can you provide us the source? I can check it out and see why this happens.

When the shell terminates the Completed event gets raised.
Please check in this event the ErrorCode and Result properties of the shell.

[quote=203040:@Michel Bujardet]You may want to use f.launch instead.

http://documentation.xojo.com/index.php/FolderItem.Launch[/quote]
I am using f.launch, I just forget to put it in the included code. My mistake.

[quote=203050:@Maurizio Rossi]When the shell terminates the Completed event gets raised.
Please check in this event the ErrorCode and Result properties of the shell.[/quote]
I am not getting an error code and the result of the shell is blank.

The code is:

[code]dim f as folderitem

f = new folderitem ("C:\Program Files\Program B\Program B.exe)

f.launch[/code]

It is contained in a push button, so it is only running when I click it

It is also worth mentioning that Program A was written in Xojo2015r2.2 and Program B was written in REAL Studio 2011

Hi Daniel,
where are you declaring the shell variable?
Maybe the variable gets destroyed before the shell has completed?

The issue appeared to be a permissions issue and I have resolved it. Thank you all for the help.