1 | Program ViewStub;
|
---|
2 |
|
---|
3 | // Small stub program that uses the GlobalFilelist to decide
|
---|
4 | // whether to launch a new instance of newview.exe, or activate
|
---|
5 | // an existing one.
|
---|
6 |
|
---|
7 | // Becomes view.exe.
|
---|
8 |
|
---|
9 | Uses
|
---|
10 | OS2def, PMShl, PmWin,
|
---|
11 | StartupUnit;
|
---|
12 |
|
---|
13 | {$R ViewStub}
|
---|
14 |
|
---|
15 | var
|
---|
16 | Details: PROGDETAILS;
|
---|
17 | Parameters: pchar;
|
---|
18 |
|
---|
19 | Const
|
---|
20 | Vendor = 'Aaron Lawrence';
|
---|
21 | BldLevelVersion = '1.1.1';
|
---|
22 | Description = 'NewView Stub';
|
---|
23 |
|
---|
24 | // BLDLevel - compatible - mostly
|
---|
25 | EmbeddedVersion: string =
|
---|
26 | '@#'
|
---|
27 | + Vendor
|
---|
28 | + ':'
|
---|
29 | + BldLevelVersion
|
---|
30 | + '#@'
|
---|
31 | + Description
|
---|
32 | + #0;
|
---|
33 |
|
---|
34 | imports
|
---|
35 | // Alternative declaration of WinStartApp with a more useful type for pszParams
|
---|
36 | FUNCTION _WinStartApp(hwndNotify:HWND;VAR pDetails:PROGDETAILS;pszParams:pchar;
|
---|
37 | Reserved:POINTER;fbOptions:ULONG):HAPP;
|
---|
38 | APIENTRY; 'PMSHAPI' index 119;
|
---|
39 | end;
|
---|
40 |
|
---|
41 | Begin
|
---|
42 | if Startup then
|
---|
43 | begin
|
---|
44 | // Want a new instance.
|
---|
45 |
|
---|
46 | // Get address of parameters, ignoring first (exename).
|
---|
47 | ASM
|
---|
48 | MOV ESI, SYSTEM.ArgStart // Get start of parameters
|
---|
49 |
|
---|
50 | // read over exe name (until first null byte)
|
---|
51 | !rrloop:
|
---|
52 | LODSB
|
---|
53 | CMP AL,0
|
---|
54 | JNE !rrloop
|
---|
55 |
|
---|
56 | MOV Parameters, ESI
|
---|
57 | End;
|
---|
58 |
|
---|
59 | // set up details for launching newview
|
---|
60 | With Details do
|
---|
61 | begin
|
---|
62 | Length := Sizeof( Details );
|
---|
63 | progt.progc := PROG_PM;
|
---|
64 | progt.fbVisible := SHE_VISIBLE;
|
---|
65 | pszTitle := 'Help Viewer';
|
---|
66 | pszExecutable := 'newview.exe';
|
---|
67 | pszParameters := nil; // Parameters; // copy our parameters
|
---|
68 | pszStartupDir := ''; // current dir
|
---|
69 | pszIcon := nil; // default
|
---|
70 | pszEnvironment := nil; // default
|
---|
71 | swpInitial.fl := SWP_ACTIVATE;
|
---|
72 | swpInitial.hwndInsertBehind := HWND_TOP;
|
---|
73 | end;
|
---|
74 |
|
---|
75 | _WinStartApp( NULLHANDLE, // no notify window
|
---|
76 | Details,
|
---|
77 | Parameters, // use these rather than Details parameters,
|
---|
78 | // cause PM was swallowing /? the other way!!
|
---|
79 | nil, // reserved
|
---|
80 | 0 );
|
---|
81 | end;
|
---|
82 | End.
|
---|