source: trunk/NewView/ViewStub.pas@ 58

Last change on this file since 58 was 57, checked in by RBRi, 19 years ago

more log output; assembler calls removed

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1Program 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
9Uses
10 OS2def,
11 PMShl,
12 PmWin,
13 SysUtils,
14 DebugUnit,
15 CmdLineParameterUnit,
16 StartupUnit;
17
18{$R ViewStub}
19
20var
21 Details: PROGDETAILS;
22 Parameters: pchar;
23
24Const
25 Vendor = 'Aaron Lawrence';
26 BldLevelVersion = '1.1.1';
27 Description = 'NewView Stub';
28
29 // BLDLevel - compatible - mostly
30 EmbeddedVersion: string =
31 '@#'
32 + Vendor
33 + ':'
34 + BldLevelVersion
35 + '#@'
36 + Description
37 + #0;
38
39imports
40 // Alternative declaration of WinStartApp with a more useful type for pszParams
41 FUNCTION _WinStartApp(hwndNotify:HWND;VAR pDetails:PROGDETAILS;pszParams:pchar;
42 Reserved:POINTER;fbOptions:ULONG):HAPP;
43 APIENTRY; 'PMSHAPI' index 119;
44end;
45
46var
47 tmpCmdLine : String;
48 tmpPCharCmdLine : PChar;
49
50Begin
51 LogEvent(LogViewStub, 'Starting' );
52
53 if Startup then
54 begin
55 // Want a new instance.
56
57 tmpCmdLine := nativeOS2GetCmdLineParameter;
58 tmpPCharCmdLine := StrAlloc(length(tmpCmdLine) + 1);
59 StrPCopy(tmpPCharCmdLine, tmpCmdLine);
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 tmpPCharCmdLine, // use these rather than Details parameters,
80 // cause PM was swallowing /? the other way!!
81 nil, // reserved
82 0 );
83
84 StrDispose(tmpPCharCmdLine);
85
86 end;
87 LogEvent(LogViewStub, 'Finished' );
88End.
Note: See TracBrowser for help on using the repository browser.