B4J Question Can Run Two of Three Apps Using Shell

cklester

Well-Known Member
Licensed User
I've got a weird thing going on here.

I've created a simple B4J app with three buttons that run other apps via a Shell, plus a fourth "Quit" button.

Two of the app buttons work fine, calling Shell like this:

B4X:
    Dim shl As Shell
    shl.Initialize("shl", "C:\Users\FOADDEV\Programs\HTF License Server Tools\codes_viewer\admin.exe", Null)
    shl.Run(-1)

One of the app buttons does not work. I have confirmed that the app it is calling does run normally from a Windows Explorer window (i.e., when double-clicking the .exe file).

Any clue as to why one of the apps would fail to run while the other two run successfully?
 

Attachments

  • b4x_simple_dialog.png
    b4x_simple_dialog.png
    9.7 KB · Views: 141

Peter Meares

Member
Licensed User
Longtime User
i spent a while trying to get a shell to run twice from B4J non-UI program. Certainly need to define the working directory.
In the end I ran the shell twice but under different names shl1 and shl2, I also needed StartMessageLoop in the right place, and finally after lots more research i needed StopMessageLoop.
This was all due to it being a non-GUI application. Never really understood all the intricacies but it did work.
 
Upvote 0

cklester

Well-Known Member
Licensed User
You posted one snipped but talking about three calls. What is the difference in the calls?
Have you tried to set a working directory?

The only difference in the calls is the path in the shell. That's why I only posted one, as an example.

I have not tried setting a working directory. In each Shell call, I'm providing the full path to the app.

The iNet_Maker.exe and admin.exe calls both work. The log_viewer.exe call does not. There doesn't seem to be any difference in the code to cause this, and the log_viewer.exe runs from Windows Explorer.

Here's all the code for the buttons:

B4X:
Sub bttn_iNetMaker_Click
    Log("Running iNet Maker")
    Dim shl As Shell
    shl.Initialize("shl", "C:\Users\FOADDEV\Programs\iNet System\iNet_maker\iNet_maker.exe", Null)
    shl.Run(-1)
End Sub

Sub bttn_ViewInstallFiles_Click
    Log("Running iNet Viewer")
    Dim shl As Shell
    shl.Initialize("shl", "C:\Users\FOADDEV\Programs\HTF License Server Tools\codes_viewer\admin.exe", Null)
    shl.Run(-1)
End Sub

Sub bttn_ViewLog_Click
    Log("Running Log Viewer")
    Dim shl As Shell
    shl.Initialize("shl", "C:\Users\FOADDEV\Programs\HTF License Server Tools\log_viewer\log_viewer.exe", Null)
    shl.Run(-1)
End Sub

Sub bttn_Quit_Click
    ExitApplication
End Sub
 
Upvote 0
Top