mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-30 00:11:31 +01:00
* PM samples
This commit is contained in:
parent
796eb74580
commit
b52543426b
@ -1,11 +1,13 @@
|
|||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
|
||||||
Copyright (c) 1993,94 by Florian Kl„mpfl
|
Copyright (c) 1993,94 by Florian Kl„mpfl
|
||||||
|
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
{ Demonstrationsprogramm zu FPKPascal unter OS/2 }
|
{ Sample program for FPC under OS/2 }
|
||||||
{ traditionelles Hello world-Porgamm (PM-Version) }
|
{ Classic Hello world in PM version }
|
||||||
|
|
||||||
program pmdemo1;
|
program pmdemo1;
|
||||||
|
|
||||||
@ -23,11 +25,11 @@ program pmdemo1;
|
|||||||
FCF_MINBUTTON+FCF_MAXBUTTON+FCF_SHELLPOSITION+
|
FCF_MINBUTTON+FCF_MAXBUTTON+FCF_SHELLPOSITION+
|
||||||
FCF_TASKLIST+FCF_MENU;
|
FCF_TASKLIST+FCF_MENU;
|
||||||
|
|
||||||
function clientwndproc(window : cardinal;msg : longint;mp1,mp2 : cardinal) :
|
function clientwndproc(window : cardinal;msg : longint;mp1,mp2 : pointer) :
|
||||||
cardinal;export;
|
pointer;export;
|
||||||
|
|
||||||
const
|
const
|
||||||
text = 'Hello world by OS/2 and FPKPascal';
|
text = 'Hello world by OS/2 and FPC';
|
||||||
|
|
||||||
var
|
var
|
||||||
ps : cardinal;
|
ps : cardinal;
|
||||||
@ -36,7 +38,7 @@ program pmdemo1;
|
|||||||
begin
|
begin
|
||||||
{clientwndproc:=nil; }
|
{clientwndproc:=nil; }
|
||||||
case msg of
|
case msg of
|
||||||
{WM_CREATE : DosBeep(200,500);}
|
{ WM_CREATE : DosBeep(200,500);}
|
||||||
WM_PAINT : begin
|
WM_PAINT : begin
|
||||||
ps:=WinBeginPaint(window,0,nil);
|
ps:=WinBeginPaint(window,0,nil);
|
||||||
WinQueryWindowRect(window,@rcl);
|
WinQueryWindowRect(window,@rcl);
|
||||||
@ -47,7 +49,7 @@ program pmdemo1;
|
|||||||
{101 : DosBeep(4500,1000);}
|
{101 : DosBeep(4500,1000);}
|
||||||
109 : WinPostMsg(0,WM_QUIT,nil,nil);
|
109 : WinPostMsg(0,WM_QUIT,nil,nil);
|
||||||
201 : WinMessageBox(cardinal(1),cardinal(1),
|
201 : WinMessageBox(cardinal(1),cardinal(1),
|
||||||
'HelloPM von FPKPascal',
|
'HelloPM from FPC',
|
||||||
'šber',0,MB_ICONEXCLAMATION+MB_MOVEABLE);
|
'šber',0,MB_ICONEXCLAMATION+MB_MOVEABLE);
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
@ -58,10 +60,10 @@ program pmdemo1;
|
|||||||
begin
|
begin
|
||||||
ab:=WinInitialize(0);
|
ab:=WinInitialize(0);
|
||||||
mq:=WinCreateMsgQueue(ab,0);
|
mq:=WinCreateMsgQueue(ab,0);
|
||||||
WinRegisterClass(ab,'HELLOPM',@clientwndproc,4,0);
|
WinRegisterClass(ab,'HELLOPM',proc(@clientwndproc),4,0);
|
||||||
frame:=WinCreateStdWindow(cardinal(1),WS_VISIBLE,@frameflags,'HELLOPM',
|
frame:=WinCreateStdWindow(cardinal(1),WS_VISIBLE,@frameflags,'HELLOPM',
|
||||||
'PMDemo 1',WS_VISIBLE,0,1,@client);
|
'PMDemo 1',WS_VISIBLE,0,1,@client);
|
||||||
while (WinGetMsg(ab,@msg,0,0,0)<>0) do
|
while WinGetMsg(ab,@msg,0,0,0) do
|
||||||
WinDispatchMsg(ab,@msg);
|
WinDispatchMsg(ab,@msg);
|
||||||
WinDestroyWindow(frame);
|
WinDestroyWindow(frame);
|
||||||
WinDestroyMsgQueue(mq);
|
WinDestroyMsgQueue(mq);
|
||||||
@ -69,7 +71,10 @@ program pmdemo1;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.1 1999-06-02 16:01:35 hajny
|
Revision 1.2 1999-08-10 14:33:51 hajny
|
||||||
|
* PM samples
|
||||||
|
|
||||||
|
Revision 1.1 1999/06/02 16:01:35 hajny
|
||||||
* changes by Ramon Bosque
|
* changes by Ramon Bosque
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
58
rtl/os2/tests/basicpm.pas
Normal file
58
rtl/os2/tests/basicpm.pas
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
program BasicPM;
|
||||||
|
|
||||||
|
uses
|
||||||
|
Os2Def, PMWin;
|
||||||
|
|
||||||
|
function ClientWindowProc (Window, Msg: cardinal; MP1, MP2: pointer): pointer;
|
||||||
|
cdecl; export;
|
||||||
|
var
|
||||||
|
Li: longint;
|
||||||
|
Ps: cardinal;
|
||||||
|
R: TRectL;
|
||||||
|
P: TPointL;
|
||||||
|
Rgn: cardinal;
|
||||||
|
begin
|
||||||
|
ClientWindowProc := nil;
|
||||||
|
case Msg of
|
||||||
|
wm_Paint: begin
|
||||||
|
PS := WinBeginPaint(Window, 0, nil);
|
||||||
|
{ GpiErase(PS);}
|
||||||
|
WinEndPaint(PS);
|
||||||
|
end;
|
||||||
|
else ClientWindowProc := WinDefWindowProc (Window, Msg, MP1, MP2);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
idClientWindow = 11000;
|
||||||
|
WinFlags: cardinal = fcf_TitleBar + fcf_SysMenu + fcf_SizeBorder +
|
||||||
|
fcf_MinMax + fcf_TaskList + fcf_NoByteAlign;
|
||||||
|
ClassName = 'MYVIEW';
|
||||||
|
|
||||||
|
var
|
||||||
|
Anchor, MsgQue: cardinal;
|
||||||
|
Message: TQMsg;
|
||||||
|
Frame, Client: cardinal;
|
||||||
|
begin
|
||||||
|
Anchor := WinInitialize(0);
|
||||||
|
{ It might be beneficial to set the second parameter of the following }
|
||||||
|
{ call to something large, such as 1000. The OS/2 documentation does }
|
||||||
|
{ not recommend this, however } MsgQue := WinCreateMsgQueue(Anchor, 0);
|
||||||
|
if MsgQue = 0 then Halt (254);
|
||||||
|
WinRegisterClass (Anchor, ClassName, proc (ClientWindowProc), cs_SizeRedraw,
|
||||||
|
SizeOf (pointer));
|
||||||
|
Frame := WinCreateStdWindow (hwnd_Desktop, 0, WinFlags, ClassName,
|
||||||
|
'BASIC', 0, 0, idClientWindow, Client);
|
||||||
|
if (Frame <> 0) then
|
||||||
|
begin
|
||||||
|
WinSetWindowPos (Frame, 0, 0, WinQuerySysValue (hwnd_Desktop,
|
||||||
|
sv_CyScreen) - 200, 200, 200, swp_Move + swp_Size + swp_Activate +
|
||||||
|
swp_Show);
|
||||||
|
while WinGetMsg (Anchor, Message, 0, 0, 0) do
|
||||||
|
WinDispatchMsg (Anchor, Message);
|
||||||
|
|
||||||
|
WinDestroyWindow (Frame);
|
||||||
|
end;
|
||||||
|
WinDestroyMsgQueue (MsgQue);
|
||||||
|
WinTerminate (Anchor);
|
||||||
|
end.
|
||||||
Loading…
Reference in New Issue
Block a user