Request for help: Create Harbour EXE as true Windows EXE ?

56 views
Skip to first unread message

John Ward

unread,
Jan 26, 2020, 5:49:36 PM1/26/20
to Harbour Minigui
So I am really confused and need some help.  I hope the explanation below is clear.

Background: I have the minigui package installed and I am using that to build my Harbour EXEs.

However for my tests, I am just using hbmk2 to create the EXE (with no minigui libraries).

The test.prg is plain and basically waits for 10 seconds and then terminates.

If I compile test.prg with hbmk2 (no switches) to create TEST1.EXE.  I run TEST1.EXE from windows 10 CMD prompt:
The EXE runs in the current CMD session window and waits for the EXE to finish before the prompt is returned.

If I compile the same test.prg with hbmk2 and use the switch -gui switch to create TEST2.EXE. Then run the TEST2.EXE from windows 10 CMD prompt:
TEST2.EXE is launched in a separate window, and the CMD prompt where I ran TEST2.EXE immediately returns.

The above results and what I would expect based on my understanding of Harbour GT.

The problem is that I need to run the resulting Harbour EXE from a .bat file (or a .CMD file) wrapper.

So I created test2.bat with the following 2 lines:
TEST2.EXE
tasklist /nh /fi "imagename eq TEST2.EXE"

I am not getting the expected results.

Though manually running TEST2.EXE from a CMD prompt launches TEST2.EXE in a separate window and the CMD prompt immediately returns (while the TEST2.EXE code runs), the same does not happen from the batch file.  

When run from a .bat file (or even a .cmd file) the batch file waits until the TEST2.EXE is finished before it runs tasklist (the next line in the batch file.)

I hope the explanation I provided is clear and makes sense.

Can anyone explain why the batch file waits, and does not run the EXE as a separate process (like it seems to do when ran manually from the CMD prompt)?

Does anyone know of a Harbour work-around to get the expected results?

The only batch file work-around I have been able to figure out is changing the first line in the batch file to:
start TEST2.EXE

Thank you in advance for those who take the time to read and respond!

- John


Ivanil Marcelino

unread,
Feb 21, 2020, 10:55:06 AM2/21/20
to Harbour Minigui
//Begin
start OnchangeBrowse.exe
call tasklist /nh /fi "imagename eq OnchangeBrowse.exe"
pause
//End

Reply all
Reply to author
Forward
0 new messages