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