Author Topic: Start MINIMIZED, but it won't!  (Read 6556 times)

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1569
  • Karma: +44/-0
Start MINIMIZED, but it won't!
« on: April 20, 2026, 02:18:32 am »
OK, all things considered this is trivial, but kind of annoying.

Part of the IBM CPP 3.65 install is the object to start the on-line help system, which is basically the NetQ application feeding the CPP content.

That object has the following parameters:

1) 'Required Path and file..' => G:\OS2\CMD.EXE
2) 'Optional Parameters...' => /k G:\code\tools\Ibmcpp\BIN\SETENV.CMD CPPHLP36.EXE open index.htm

where:

SETENV.CMD just sets up the enviornment and CPPHLP36.EXE is the NetQ help server itself.

That object is set to: start minimized in OS/2 window and close the window on exit. This works fine.

However, since it is nice to have full control over that help server I created two separate objects which basically enable me to manually START & STOP the server w/o invoking the CPPHLP36.exe itself. Reason here being: sometimes I just shut down my DEV session and wish to re-start later having saved all my pertinent bookmarks, and so when those are re-loaded I need the back end NetQ server up and running.

Those objects have the same setup as the originally installed IBM one:

1) 'Required Path and file..' => G:\OS2\CMD.EXE
2) 'Optional Parameters...' => /k G:\code\tools\Ibmcpp\BIN\SETENV.CMD G:\netqos2\help_server_start.cmd

where:

help_server_start.cmd contains the following:

Code: [Select]
/* This script will fire up the NETQ help system */

/* start the netq server */
'netq start server'

/* now start the HTTP deamon serving the help info */
'G:\NETQOS2\HTTPDL.EXE -r g:\netqos2\httpd.cnf'

exit

However, when I instantiate that object despite the fact that it's SESSION is set to run in OS/2 Windsow, Start minimized and Close on exit, that window just opens up on my Desktop (in the foreground) and doesn't close.

What am I missing here???

It seems like this should be really simple, and yet it escapes me!

Just for shits and giggles I actually went through all the individual components (the CMD files, etc.) adjusting their object settings to do what I want, and yet the result is the same.

How do I force this thing to just flat out 'run in the background' w/o me ever seeing anything?

Steven Levine

  • Full Member
  • ***
  • Posts: 150
  • Karma: +16/-0
Re: Start MINIMIZED, but it won't!
« Reply #1 on: April 20, 2026, 07:09:09 am »
Unless you have modified setenv.cmd, it's going to logically end with

 start G:\netqos2\help_server_start.cmd
 exit

Since this is a cmd.exe batch, the exit will terminate the session.

Since your help_server_start.cmd is REXX, the exit will terminate the REXX script a leave the session running.  To terminate the session, you need to replace the exit with 'exit'.

If you want setenv to start help_server_start.cmd minimized, you need to change the parameters to

 /min G:\netqos2\help_server_start.cmd


Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1569
  • Karma: +44/-0
Re: Start MINIMIZED, but it won't!
« Reply #2 on: April 22, 2026, 03:31:26 am »
Hello Steven,

Unless you have modified setenv.cmd, it's going to logically end with

 start G:\netqos2\help_server_start.cmd
 exit
...

No, not modified other than parhaps me adding that 'mode 80,60' line, and the contents of the original CMD which I am still using are as follows:

Code: [Select]
@ECHO OFF
mode 80,60
SET CXXMAIN=G:\code\tools\Ibmcpp

rem ***********************************************************
rem IBM C and C++ Compilers for OS/2 environment variable settings
rem Licensed Materials - Property of IBM
rem (C) Copyright IBM Corp. 1991, 1997   All Rights Reserved
rem ***********************************************************

SET BEGINLIBPATH=%CXXMAIN%\DLL;%BEGINLIBPATH%
SET DPATH=%CXXMAIN%\HELP;%CXXMAIN%\LOCALE;%DPATH%
SET HELP=%CXXMAIN%\HELP;%HELP%
SET INCLUDE=%CXXMAIN%\INCLUDE;%INCLUDE%
SET IPFC=%CXXMAIN%\BIN;%IPFC%
SET LIB=%CXXMAIN%\LIB;%LIB%
SET CPP_DBG_LANG=CPP
SET LANG=en_us
SET NLSPATHTEMP=%CXXMAIN%\MSG\%%N
SET NLSPATH=%NLSPATHTEMP%;%NLSPATH%
SET NLSPATHTEMP=
SET PATH=%CXXMAIN%\BIN;%PATH%

if $%1$==$$ goto end
start %1 %2 %3 %4 %5 %6 %7 %8 %9
exit
:end

Therefore, given that object parameter setup, what actually ends up hapenning at the end of that SETENV.CMD file is the following:

Code: [Select]
...
start CPPHLP36.EXE open index.htm
exit
...

...Since this is a cmd.exe batch, the exit will terminate the session.

Since your help_server_start.cmd is REXX, the exit will terminate the REXX script a leave the session running.  To terminate the session, you need to replace the exit with 'exit'.

If you want setenv to start help_server_start.cmd minimized, you need to change the parameters to

 /min G:\netqos2\help_server_start.cmd

OK, this makes sense now, thank you!

Here is what I did:
- I added the '/min' parameter to the help_server_start.cmd object

Now I only wish I knew how to shut down HTTPDL.EXE from the CLI, because my help_server_stop.cmd script really should do both: NETQ and HTTP servers. That would be cleaner...

Steven Levine

  • Full Member
  • ***
  • Posts: 150
  • Karma: +16/-0
Re: Start MINIMIZED, but it won't!
« Reply #3 on: April 22, 2026, 10:47:44 am »

From my Kill http server object:

  /c pstat /c | grep HTTPDL & pstat /c | grep HTTPDL && pkill httpdl & delay 3

Thinking about this, it was probably written well over 10 years ago and could be better written using go -cp rather than pstat and grep.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1569
  • Karma: +44/-0
Re: Start MINIMIZED, but it won't!
« Reply #4 on: April 23, 2026, 04:48:10 am »

From my Kill http server object:

  /c pstat /c | grep HTTPDL & pstat /c | grep HTTPDL && pkill httpdl & delay 3

Thinking about this, it was probably written well over 10 years ago and could be better written using go -cp rather than pstat and grep.

You may be right about that, but pstat & grep seem to be two things that just about any OS/2 box probably has, so much better chance of that working for a wider range of folks!

Thank you for that last kill statment, I would have never figured it out.

So what I have now is the following:

1) NETQ and HTTP servers start up with a minimized window
- object parameter string is: '/k G:\code\tools\Ibmcpp\BIN\SETENV.CMD /min G:\netqos2\help_server_start.cmd'

2) NETQ and HTTP servers stop, which also closes the previously minimized START window
- object parameter string is: '/k G:\code\tools\Ibmcpp\BIN\SETENV.CMD G:\netqos2\help_server_stop.cmd'

End Result => clean, I end up right where I started!

FYI - for anyone else that wants something like this:

1) help_server_start.cmd
Code: [Select]
/* This script will START the NETQ help system */

'@echo off'

/* setup the environment - based on setenv2.cmd */
'SET NETQ11MAIN=G:\Netqos2'
'SET PATH=%NETQ11MAIN%;%PATH%'
'SET DPATH=%NETQ11MAIN%;%DPATH%'
'SET BEGINLIBPATH=%NETQ11MAIN%'

'@echo on'

/* start the netq server */
'netq start server'

/* now start the HTTP deamon serving the help info */
'G:\NETQOS2\HTTPDL.EXE -r g:\netqos2\httpd.cnf'

/* exit automatically - close the minimized window - once the STOP script runs */
'exit'

2) help_server_stop.cmd
Code: [Select]
/* This script will STOP the NETQ help system */

/* stop the netq server */
'netq stop server'

/* stop the HTTP server */
'/c pstat /c | grep HTTPDL & pstat /c | grep HTTPDL && pkill httpdl'

/* exit */
'exit'

EDIT
====

What version of GO is the latest one? I have 1.5 here which seems to be circa '95...it has problems with -sm:

Quote
[G:\netqos2]go sm
GO! v1.5 - (c) 1993-95 by Carsten Wimmer <cawim@train.oche.de>

List of Shared Memory:

Handle Selector SegmentSize  Ref  Name
------ -------- ----------- ----- ---->
Message file not found.
SYS1808:
The process has stopped.  The software diagnostic
code (exception code) is  0005.
« Last Edit: April 23, 2026, 04:52:41 am by Dariusz Piatkowski »