basicpm.pas 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. program BasicPM;
  2. uses
  3. Os2Def, PMWin;
  4. function ClientWindowProc (Window, Msg: cardinal; MP1, MP2: pointer): pointer;
  5. cdecl; export;
  6. var
  7. Li: longint;
  8. Ps: cardinal;
  9. R: TRectL;
  10. P: TPointL;
  11. Rgn: cardinal;
  12. begin
  13. ClientWindowProc := nil;
  14. case Msg of
  15. wm_Paint: begin
  16. PS := WinBeginPaint(Window, 0, nil);
  17. { GpiErase(PS);}
  18. WinEndPaint(PS);
  19. end;
  20. else ClientWindowProc := WinDefWindowProc (Window, Msg, MP1, MP2);
  21. end;
  22. end;
  23. const
  24. idClientWindow = 11000;
  25. WinFlags: cardinal = fcf_TitleBar + fcf_SysMenu + fcf_SizeBorder +
  26. fcf_MinMax + fcf_TaskList + fcf_NoByteAlign;
  27. ClassName = 'MYVIEW';
  28. var
  29. Anchor, MsgQue: cardinal;
  30. Message: TQMsg;
  31. Frame, Client: cardinal;
  32. begin
  33. Anchor := WinInitialize(0);
  34. { It might be beneficial to set the second parameter of the following }
  35. { call to something large, such as 1000. The OS/2 documentation does }
  36. { not recommend this, however } MsgQue := WinCreateMsgQueue(Anchor, 0);
  37. if MsgQue = 0 then Halt (254);
  38. WinRegisterClass (Anchor, ClassName, proc (ClientWindowProc), cs_SizeRedraw,
  39. SizeOf (pointer));
  40. Frame := WinCreateStdWindow (hwnd_Desktop, 0, WinFlags, ClassName,
  41. 'BASIC', 0, 0, idClientWindow, Client);
  42. if (Frame <> 0) then
  43. begin
  44. WinSetWindowPos (Frame, 0, 0, WinQuerySysValue (hwnd_Desktop,
  45. sv_CyScreen) - 200, 200, 200, swp_Move + swp_Size + swp_Activate +
  46. swp_Show);
  47. while WinGetMsg (Anchor, Message, 0, 0, 0) do
  48. WinDispatchMsg (Anchor, Message);
  49. WinDestroyWindow (Frame);
  50. end;
  51. WinDestroyMsgQueue (MsgQue);
  52. WinTerminate (Anchor);
  53. end.