home *** CD-ROM | disk | FTP | other *** search
- program Skeleton; { Use this code to cookbook your TSR program. }
-
-
- { You must define four procedures that are passed as parameters to }
- { MakeTSR(). I have named them here as: Startup, Popup, Wrapup, and }
- { OptionComm to suggest their functionality but you can name them }
- { any names you want. The procedure headers must, however, match }
- { the procedure type parameters in MakeTSR(), see tsr.int. }
-
-
- uses crt, tsr, cmdln;
-
- {$M 0,0,0} { Set to the minimum size tolerable to your program }
-
-
- {$F+}
- procedure Startup; { Called when TSR installed. }
- var params : CmdLnParams;
- begin
-
- { The following code explains the tsr unit command line switches. }
-
- clrscr;
- writeln('Skeleton TSR');
- writeln;
- writeln('Press <Alt> P to popup.');
- writeln;
- writeln('At the command line prompt type: ');
- writeln;
- writeln(' Skeleton -r to remove the TSR from memory,');
- writeln(' Skeleton -d to deactivate the TSR in memory,');
- writeln(' Skeleton -a to activate TSR in memory,');
- writeln(' Skeleton -m to force monochrome display,');
- writeln(' Skeleton -c to force color display,');
- writeln(' Skeleton -kcode code is scan code of hotkey,');
- writeln(' Skeleton -sshift shift is shift state of hotkey,');
- writeln(' Skeleton -p to popup TSR.');
- writeln;
- writeln('Run hotkey.exe to determine code and shift.');
-
- { Add any additional options instructions here. }
- { Additional options are specified in the call to MakeTSR() below. }
- { Options issued while installing should be processed here. }
- { Options communicated to resident TSR are processed by OptionComm below. }
- { Psuedo code is presented below for adding "q" as an option. }
- { See cmdln.doc for details. }
-
- writeln(' Skeleton -q an option for your application');
- { Use tsr.TSRandPopupOptions to specify options to CmdLnParams object. }
- params.init(TSRandPopupOptions);
- while (params.getOption <> #0) do begin
- case params.optCh of
- 'r','R': ; { Processed by TSR unit. }
- 'a','A': ; { Processed by TSR unit. }
- 'd','D': ; { Processed by TSR unit. }
- 'm','M': ; { Processed by TSR unit. }
- 'c','C': ; { Processed by TSR unit. }
- 'H','h': ; { Processed by TSR unit. }
- 'p','P': ; { Processed by TSR unit. }
- '?': ; { Processed by TSR unit. }
- 'q','Q': ; { Your application processes this one! }
- end;
- while (params.paramNo <= ParamCount) do begin
- writeln('Argument: ',ParamStr(params.paramNo));
- { Your application should process arguments here. }
- inc(params.paramNo)
- end
- end;
-
- { Any initialization code for your program belongs here. }
-
- end;
- {$F-}
-
-
-
- {$F+}
- procedure Popup; { Called when hotkey pressed. }
- begin
-
- { Place the code you want executed when the hotkey is pressed here. }
-
- { If your TSR is not prepared to popup in graphic modes then don't! }
- if not CrtPlus.TxtScr.IsTextMode then
- exit;
- { Use tsr.TSRcolor to determine color or monochrome operation, e.g. }
- if TSRcolor then begin
- TextColor(BLACK);
- TextBackground(CYAN)
- end
- else begin
- TextColor(BLACK);
- TextBackground(LIGHTGRAY)
- end;
-
-
- end;
- {$F-}
-
-
-
- {$F+}
- procedure Wrapup; { Called when TSR removed from memory. }
- begin
-
- { Any cleanup code you want executed when the TSR is removed belongs here. }
-
- end;
- {$F-}
-
-
-
- {$F+}
- procedure OptionComm(optCh: char; argSeg, argOfs : word); { See notes below. }
- var StrPtr : ^string;
- begin
- if optCh <> #0 then
- write('Option: ',optCh,' ');
- StrPtr := Ptr(argSeg, argOfs);
- if length(StrPtr^) > 0 then
- write('argument: ',StrPtr^);
- writeln;
-
- { Once resident, invoking your TSR with command line switches or arguments }
- { results in a call to this procedure. The code above demonstrates how to }
- { recover that information. See cmdln.doc for further information on }
- { specifying options. The additional options are specified in the call to }
- { MakeTSR() below. }
-
- end;
- {$F-}
-
-
-
- begin
-
- { Additional options belong in first parameter: see cmdln.doc }
-
- MakeTSR('q','Skeleton',25,8,Startup,Popup,Wrapup,OptionComm);
-
- { 25 and 8 are the scan code and shift state for <alt> P. }
- { Run hotkey.exe to find code and state for your hotkey choice. }
-
- end.