home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
pascal
/
library
/
dos
/
multtsk
/
cpm25d
/
calldos.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-04-28
|
5KB
|
170 lines
{$I cpmswitc.inc}
{$M 5000,0,10000}
{--------------------------------------------------------------------------
CALLDOS.PAS (Demonstrating capabilities of the unit MTPopup.)
This program requires the CPMULTI Multitasking Toolkit and Turbo Pascal
5.0 or later.
January 1994
Copyright (C) 1994 (USA) Copyright (C) 1989-1994
Hypermetrics Christian Philipps Software-Technik
PO Box 9700 Suite 363 Duesseldorfer Str. 316
Austin, TX 78758-9700 D-47447 Moers
Germany
This program executes COMMAND.COM as a task, giving a DOS shell
to the user. Pressing F10 will show the task status window.
---------------------------------------------------------------------------}
program MTPopupDemo;
uses DOS, CRT, CPMulti, MTPopup;
var StatusSem : Pointer;
{-----------------------------------------------------------------------------}
{$F+}
procedure Trigger(P:Pointer);
{ Wait for a keystyroke and turn the status display on or off. }
var PopupHandle : Byte;
begin
PopupHandle := RegisterPopup($00004400);
if PopupHandle = 0 then
begin
Writeln('Error in PopupRegister!');
Halt;
end;
repeat
if NOT PopupWait(PopupHandle) then
begin
Writeln('Error in PopupWait!');
Halt;
end;
if SemGetSignals(StatusSem) > 0 then
SemWait(StatusSem)
else
SemSignal(StatusSem);
until False;
end; {Trigger}
{$F-}
{-----------------------------------------------------------------------------}
procedure Frame (X1,Y1,X2,Y2:Byte);
var N : Byte;
begin
GotoXY(X1,Y1);
Write('╔');
for N := 1 TO X2-X1-1 do
Write('═');
Write('╗');
for N := 1 TO Y2-Y1-1 do
begin
GotoXY(X1,Y1+N);
Write('║');
GotoXY(X2,Y1+N);
Write('║');
end;
GotoXY(X1,Y2);
Write('╚');
for N := 1 TO X2-X1-1 do
Write('═');
Write('╝');
end; { Frame }
{-----------------------------------------------------------------------------}
{$F+}
procedure StatusTask(P:Pointer);
{ Update the status window every second. }
var X, Y : Byte;
begin
repeat
SemWait(StatusSem);
X := WhereX;
Y := WhereY;
Frame(1,17,79,25);
Window(2,18,78,24);
ClrScr;
Writeln;
Writeln('Idle Loop ->');
Writeln('DOS Task ->');
Writeln('MTPopup Task ->');
Writeln('Status Task ->');
Writeln('Hotkey Task ->');
Window(18,18,78,24);
DumpTaskTable;
Write('Turn off by pressing F10 again.');
Window(1,1,80,25);
SemSignal(StatusSem);
GotoXY(X,Y);
Sleep(Seconds(1));
until False;
end; {StatusTask}
{$F-}
{-----------------------------------------------------------------------------}
procedure Copyright;
begin
ClrScr;
Writeln(' Multitasking Popup Unit Version 2.5');
Writeln(' (c) Copyright Christian Philipps Software-Technik');
Writeln(' ──────────────────────────');
Writeln;
end;
{-----------------------------------------------------------------------------}
begin
if CreateSem(StatusSem) <> Sem_OK then
begin
Writeln('Error in CreateSem!');
Halt;
end;
SemClear(StatusSem);
if CreateTask(StatusTask,NIL,Pri_Kernel,300) < 0 then
begin
Writeln('Error in creation of Status task!');
Halt;
end;
if CreateTask(Trigger,NIL,Pri_Kernel,100) < 0 then
begin
Writeln('Error in creation of Trigger task!');
Halt;
end;
Copyright;
Writeln('This program demonstrates several of the capabilities of the Multitasking');
Writeln('Toolkit''s MTPopup unit:');
Writeln(' a) Execution of a DOS application (here COMMAND.COM) as a task');
Writeln(' b) Activation of a task by hotkey');
Writeln(' c) Parallel execution of a DOS task with the other tasks. The others');
Writeln(' can suspend the DOS task when necessary; this is an alternative');
Writeln(' to writing TSR''s.');
Writeln;
Writeln('You can now display a task status window in the lower third of the screen');
Writeln('by pressing the F10 hotkey. The contents of this window are updated every');
Writeln('second; the previous contents of the screen are lost in this demo.');
Writeln('Pressing F10 again turns off the status function.');
Writeln('The demo program is terminated by typing EXIT at the DOS prompt.');
EnablePopups;
CallDos(GetEnv('comspec'),'');
DisablePopups;
Copyright;
end.