The program was rather one of my first experiences in C, so please take it into account. It is not too sophisticated, but at least does what it was built for.
The command-line format looks as follows:
wOpen {options} {program} {...program options...}
If you`re typing some options too often, you can put them into a environment variable. That variable is treated exactly as command-line, except that it is processed before command-line. So, say, if you don`t like ANSI colored output (see below), you can put
set WOPEN=-a-
into your CONFIG.SYS file. Following options are available:
Default state of switches: -a+ -d- -oc+ -ov- -ox- -om- -ob- -to
wOpen -to -f10,18 -p200,100 t-mail.exe -c
This command will run "t-mail.exe -c" in a OS/2 windowed session, with 10x18 font size, window will be placed at 200,100 position.
wOpen -s40,25 -p,,300,100 -f8,8 -oc- *
This command will open a OS/2 windowed session at 40x25 cells size, with 8x8 font and with a 300x100 pixel size. The window will not be automatically closed.
wOpen -ob -s60,20 -p10,10,488,186 -f8,8 *
This will open a background OS/2 session with a 60x20 size, placed at 10,10, with a size of 488,186 pixels (this is a *real* value, more on that later) and with a 8x8 font.
Window position/size relations are a bit tricky. First, the X coordinate is always rounded to nearest 8 divisor (even on 256- 64K- 16M- color modes -- hey, IBM, wake up!). For example, if you`ll try the command:
wopen -p0,0,800,400 -f8,8 *you`ll get a window with X ~= 0 (rounded to 8 since window border added a bit to your 0) and Y somewhere in the middle of the screen (on my 1024x768 resolution). Why?
The answer is that for some unknown reason, when the internals of a VIO window are resized, the top-left corner of the window is unchanged while lower-left corner moves. This is a contradiction to the PM paradigm which counts coordinates from lower-left corner, but who in IBM cares anyway?!
There are a number of approaches for setting window sizes. First is, of course, try-and-see method :-) I`m often using it when I`m too lazy to multiply some numbers. Other approach is to multiply window size in cells with font dimenstion, then add border size. For example, a 60x20 window with a 8x8 font will have the following size:
Width = 60 * 8 + 4 + 4 = 488 Height = 20 * 8 + 4 + 4 + 18 = 186
4 is the border width/height (this depends of your scheme palette), 18 is the height of titlebar.
And the third approach is to launch a window, set its position/size manually (say using a mouse) and then query them. It can be done with a utility called PMMon - a nice tool for any programmer, but not for consumer :-)