home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vppmhlp1.zip / os2pmapi.pas < prev    next >
Pascal/Delphi Source File  |  1996-11-03  |  384KB  |  9,581 lines

  1. {█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█}
  2. {█                                                       █}
  3. {█      Virtual Pascal Runtime Library.  Version 1.1a    █}
  4. {█      OS/2 Presentation Manager API interface          █}
  5. {█      ─────────────────────────────────────────────────█}
  6. {█      Copyright (C) 1995 fPrint UK Ltd                 █}
  7. {█                                                       █}
  8. {▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀}
  9.  
  10. {$X+,T-,Cdecl+,AlignRec-,OrgName+}
  11.  
  12. unit Os2PmApi;
  13.  
  14. interface
  15.  
  16. uses Os2Def;
  17.  
  18. {----[ PMWIN ]----}
  19.  
  20. { General Window Management types and constants }
  21.  
  22. type
  23.   MParam    = Longint;
  24.   PMParam   = ^MParam;
  25.   MResult   = Longint;
  26.   PMResult  = ^MResult;
  27.  
  28. { Macros to make an MParam from standard types }
  29.  
  30. function mpFromp( p : Pointer ) : MParam; inline;
  31. begin
  32.   mpFromp := Longint( p );
  33. end;
  34.  
  35. function mpFromHwnd(H : HWnd) : MParam; inline;
  36. begin
  37.   mpFromHwnd := Longint( H );
  38. end;
  39.  
  40. function mpFromChar(ch : Char) : MParam; inline;
  41. begin
  42.   mpFromChar := Longint(Ch);
  43. end;
  44.  
  45. function mpFromShort(s : Word) : MParam; inline;
  46. begin
  47.   mpFromShort := s;
  48. end;
  49.  
  50. function mpFrom2Short(s1,s2 : SmallWord) : MParam; inline;
  51. begin
  52.   mpFrom2Short := s1 or (s2 shl 16);
  53. end;
  54.  
  55. function mpFromSh2Ch(s : SmallWord; ch1, ch2 : Char) : MParam; inline;
  56. begin
  57.   mpFromSh2Ch := s or (ord(ch1) OR ord(ch2) shl 8) shl 16;
  58. end;
  59.  
  60. function mpFromLong(l : Long) : MParam; inline;
  61. begin
  62.   mpFromLong := l;
  63. end;
  64.  
  65. { Macros to extract standard types from an mParam }
  66.  
  67. function pVoidFromMP(mp : mParam) : Pointer; inline;
  68. begin
  69.   pVoidFromMP := Pointer(mp);
  70. end;
  71.  
  72. function HwndFromMP(mp : MParam) : Hwnd ; inline;
  73. begin
  74.   HwndFromMP := Hwnd(mp);
  75. end;
  76.  
  77. function Char1FromMP(mp : MParam) : Char ; inline;
  78. begin
  79.   Char1FromMP := Char(mp);
  80. end;
  81.  
  82. function Char2FromMP(mp : MParam) : Char ; inline;
  83. begin
  84.   Char2FromMP := Char(mp shr 8);
  85. end;
  86.  
  87. function Char3FromMP(mp : MParam) : Char ; inline;
  88. begin
  89.   Char3FromMP := Char(mp shr 16);
  90. end;
  91.  
  92. function Char4FromMP(mp : MParam) : Char ; inline;
  93. begin
  94.   Char4FromMP := Char(mp shr 24);
  95. end;
  96.  
  97. function Short1FromMP(mp : MParam) : UShort ; inline;
  98. begin
  99.   Short1FromMP := UShort(mp);
  100. end;
  101.  
  102. function Short2FromMP(mp : MParam) : UShort ; inline;
  103. begin
  104.   Short2FromMP := UShort(mp shr 16);
  105. end;
  106.  
  107. function LongFromMP(mp : MParam) : ULong; inline;
  108. begin
  109.   LongFromMP := ULong(mp);
  110. end;
  111.  
  112. { Macros to make an MResult from standard types }
  113.  
  114. function MRFromP(p : Pointer) : MResult; inline;
  115. begin
  116.   MRFromP := MResult(p);
  117. end;
  118.  
  119. function MRFromShort(s : SmallWord) : MResult; inline;
  120. begin
  121.   MRFromShort := MResult(s);
  122. end;
  123.  
  124. function MRFrom2Short(s1, s2 : SmallWord) : MResult; inline;
  125. begin
  126.   MRFrom2Short := MResult(s1 OR s2 shl 16);
  127. end;
  128.  
  129. function MRFromLong(l : Long) : MResult; inline;
  130. begin
  131.   MRFromLong := MResult(l);
  132. end;
  133.  
  134. { Macros to extract standard types from an MResult }
  135.  
  136. function pVoidFromMR(mr : MResult) : Pointer; inline;
  137. begin
  138.   pVoidFromMR := Pointer(mr);
  139. end;
  140.  
  141. function Short1FromMR(mr : MResult) : SmallWord; inline;
  142. begin
  143.   Short1FromMR := SmallWord(mr);
  144. end;
  145.  
  146. function Short2FromMR(mr : MResult) : SmallWord; inline;
  147. begin
  148.   Short2FromMR := SmallWord(mr shr 16);
  149. end;
  150.  
  151. function LongFromMR(mr : MResult) : Long; inline;
  152. begin
  153.   LongFromMR := Long(mr);
  154. end;
  155.  
  156.  
  157. { This is the standard function definition for window procedures.             }
  158. { Typically they are named like "XxxxxxxxWndProc", where the prefix           }
  159. { "Xxxxxxxxx" is replaced by some name descriptive of the window procedure    }
  160. { being declared.  Window procedures must be EXPORTED in the definitions      }
  161. { file used by the linker.                                                    }
  162.  
  163. type
  164.   { Note: This function must use the cdecl calling convention }
  165.   FnWp = function(Wnd: HWnd; Msg: ULong; Mp1,Mp2: MParam): MResult;
  166.  
  167. { Predefined window handles }
  168. const
  169.   hwnd_Desktop                  = HWnd(1);
  170.   hwnd_Object                   = HWnd(2);
  171.   hwnd_Top                      = HWnd(3);
  172.   hwnd_Bottom                   = HWnd(4);
  173.   hwnd_ThreadCapture            = HWnd(5);
  174.  
  175. { Standard Window Classes }
  176.   wc_Frame                      = PChar($FFFF0001);
  177.   wc_ComboBox                   = PChar($FFFF0002);
  178.   wc_Button                     = PChar($FFFF0003);
  179.   wc_Menu                       = PChar($FFFF0004);
  180.   wc_Static                     = PChar($FFFF0005);
  181.   wc_EntryField                 = PChar($FFFF0006);
  182.   wc_ListBox                    = PChar($FFFF0007);
  183.   wc_ScrollBar                  = PChar($FFFF0008);
  184.   wc_TitleBar                   = PChar($FFFF0009);
  185.   wc_Mle                        = PChar($FFFF000A);
  186.   { 000B to 000F reserved}
  187.   wc_AppStat                    = PChar($FFFF0010);
  188.   wc_KbdStat                    = PChar($FFFF0011);
  189.   wc_Pecic                      = PChar($FFFF0012);
  190.   wc_Dbe_kkPopup                = PChar($FFFF0013);
  191.   { 0014 to 001f reserved}
  192.   wc_SpinButton                 = PChar($FFFF0020);
  193.   { 0021 to 0024 reserved}
  194.   wc_Container                  = PChar($FFFF0025);
  195.   wc_Slider                     = PChar($FFFF0026);
  196.   wc_ValueSet                   = PChar($FFFF0027);
  197.   wc_NoteBook                   = PChar($FFFF0028);
  198.   { 0029 to 002c used by PEN }
  199.   wc_PenFirst                   = PChar($FFFF0029);
  200.   wc_PenLast                    = PChar($FFFF002C);
  201.   { 002D to 003F reserved}
  202.   wc_mmpmFirst                  = PChar($FFFF0040);
  203.   wc_CircularSlider             = PChar($FFFF0041);
  204.   wc_mmpmLast                   = PChar($FFFF004F);
  205.  
  206. { Standard Window Styles }
  207.   ws_Visible                    = $80000000;
  208.   ws_Disabled                   = $40000000;
  209.   ws_ClipChildren               = $20000000;
  210.   ws_ClipSiblings               = $10000000;
  211.   ws_ParentClip                 = $08000000;
  212.   ws_SaveBits                   = $04000000;
  213.   ws_SyncPaint                  = $02000000;
  214.   ws_Minimized                  = $01000000;
  215.   ws_Maximized                  = $00800000;
  216.   ws_Animate                    = $00400000;
  217.  
  218. { Dialog manager styles }
  219.   ws_Group                      = $00010000;
  220.   ws_TabStop                    = $00020000;
  221.   ws_MultiSelect                = $00040000;
  222.  
  223. { Class styles }
  224.   cs_MoveNotify                 = $00000001;
  225.   cs_SizeRedraw                 = $00000004;
  226.   cs_HitTest                    = $00000008;
  227.   cs_Public                     = $00000010;
  228.   cs_Frame                      = $00000020;
  229.   cs_ClipChildren               = $20000000;
  230.   cs_ClipSiblings               = $10000000;
  231.   cs_ParentClip                 = $08000000;
  232.   cs_SaveBits                   = $04000000;
  233.   cs_SyncPaint                  = $02000000;
  234.  
  235. function WinRegisterClass(Ab: Hab; ClassName: PChar; WndProc: FnWp;
  236.   flStyle,cbWindowData: ULong): Bool;
  237. function WinDefWindowProc(Wnd: HWnd; Msg: ULong; Mp1,Mp2: MParam): MResult;
  238. function WinDestroyWindow(Wnd: HWnd): Bool;
  239. function WinShowWindow(Wnd: HWnd; fShow: Bool): Bool;
  240. function WinQueryWindowRect(Wnd: HWnd; var R: RectL): Bool;
  241. function WinGetPS(Wnd: HWnd): Hps;
  242. function WinReleasePS(PS: Hps): Bool;
  243. function WinEndPaint(PS: Hps): Bool;
  244. function WinGetClipPS(Wnd: HWnd; WndClip: HWnd; Flags: ULong): Hps;
  245. function WinIsWindowShowing(Wnd: HWnd): Bool;
  246. function WinBeginPaint(Wnd: HWnd; PS: Hps; R: PRectL): Hps;
  247. function WinOpenWindowDC(Wnd: HWnd): Hdc;
  248. function WinScrollWindow(Wnd: HWnd; dX, dY: Long; Scroll: PRectL; Clip: PRectL;
  249.   RgnUpdate: HRgn; Update: PRectL; rgfsw: ULong): Long;
  250.  
  251. { WinGetClipPS flags }
  252. const
  253.   psf_LockWindowUpdate          = $0001;
  254.   psf_ClipUpwards               = $0002;
  255.   psf_ClipDownwards             = $0004;
  256.   psf_ClipSiblings              = $0008;
  257.   psf_ClipChildren              = $0010;
  258.   psf_ParentClip                = $0020;
  259.  
  260. { WinScrollWindow flags }
  261.   sw_ScrollChildren             = $0001;
  262.   sw_InvalidateRgn              = $0002;
  263.  
  264. function WinFillRect(PS: Hps; var R: RectL; Color: Long): Bool;
  265.  
  266. { WinInitialize/WinTerminate Interface declarations }
  267.  
  268. type
  269.   PQVersData = ^QVersData;
  270.   QVersData = record
  271.     Environment: SmallWord;
  272.     Version:     SmallWord;
  273.   end;
  274.  
  275. const
  276.   qv_OS2                        = $0000;
  277.   qv_CMS                        = $0001;
  278.   qv_TSO                        = $0002;
  279.   qv_TSOBatch                   = $0003;
  280.   qv_OS400                      = $0004;
  281.  
  282. function WinQueryVersion(AB: Hab): ULong;
  283. function WinInitialize(Options: ULong): Hab;
  284. function WinTerminate(AB: Hab): Bool;
  285. function WinQueryAnchorBlock(Wnd: HWnd): Hab;
  286. function WinCreateWindow(Parent: HWnd; Cls: PChar; Name: PChar; Style: ULong;
  287.   X,Y,cX,cY: Long; Owner: HWnd; InsertBehind: HWnd; Id: ULong;
  288.   CtlData,PresParams: Pointer): HWnd;
  289. function WinEnableWindow(Wnd: HWnd; Enable: Bool): Bool;
  290. function WinIsWindowEnabled(Wnd: HWnd): Bool;
  291. function WinEnableWindowUpdate(Wnd: HWnd; Enable: Bool): Bool;
  292. function WinIsWindowVisible(Wnd: HWnd): Bool;
  293. function WinQueryWindowText(Wnd: HWnd; BufferMax: Long; Buffer: PChar): Long;
  294. function WinSetWindowText(Wnd: HWnd; Text: PChar): Bool;
  295. function WinQueryWindowTextLength(Wnd: HWnd): Long;
  296. function WinWindowFromID(Parent: HWnd; Id: ULong): HWnd;
  297. function WinIsWindow(AB: Hab; Wnd: HWnd): Bool;
  298. function WinQueryWindow(Wnd: HWnd; Cmd: Long): HWnd;
  299. function WinMultWindowFromIDs(Parent: HWnd; PRgHWnd: PHWnd;
  300.    idFirst,idLast: ULong): Long;
  301.  
  302. { WinQueryWindow codes }
  303. const
  304.   qw_Next                       = 0;
  305.   qw_Prev                       = 1;
  306.   qw_Top                        = 2;
  307.   qw_Bottom                     = 3;
  308.   qw_Owner                      = 4;
  309.   qw_Parent                     = 5;
  310.   qw_NextTop                    = 6;
  311.   qw_PrevTop                    = 7;
  312.   qw_FrameOwner                 = 8;
  313.  
  314. function WinSetParent(Wnd: HWnd; NewParent: HWnd; Redraw: Bool): Bool;
  315. function WinIsChild(Wnd: HWnd; Parent: HWnd): Bool;
  316. function WinSetOwner(Wnd: HWnd; NewOwner: HWnd): Bool;
  317. function WinQueryWindowProcess(Wnd: HWnd; Pid: PPid; Tid: PTid): Bool;
  318. function WinQueryObjectWindow(Desktop: HWnd): HWnd;
  319. function WinQueryDesktopWindow(AB: Hab; DC: Hdc): HWnd;
  320.  
  321. { Window positioning functions }
  322. { WinSetMultWindowPos record   }
  323. type
  324.   PSwp = ^Swp;
  325.   Swp = record
  326.     Fl:               ULong;
  327.     cY:               Long;
  328.     cX:               Long;
  329.     y:                Long;
  330.     x:                Long;
  331.     HWndInsertBehind: HWnd;
  332.     Wnd:              HWnd;
  333.     ulReserved1:      ULong;
  334.     ulReserved2:      ULong;
  335.   end;
  336.  
  337. function WinSetWindowPos(Wnd: HWnd; InsertBehind: HWnd; X,Y,cX,cY: Long;
  338.   Flags: ULong): Bool;
  339. function WinSetMultWindowPos(AB: Hab; var Swap: Swp; Count: ULong): Bool;
  340. function WinQueryWindowPos(Wnd: HWnd; var Swap: Swp): Bool;
  341.  
  342. { Values returned from wm_AdjustWindowPos and passed to wm_WindowPosChanged }
  343. const
  344.   awp_Minimized                 = $00010000;
  345.   awp_Maximized                 = $00020000;
  346.   awp_Restored                  = $00040000;
  347.   awp_Activate                  = $00080000;
  348.   awp_Deactivate                = $00100000;
  349.  
  350. { WinSetWindowPos flags }
  351.   swp_Size                      = $0001;
  352.   swp_Move                      = $0002;
  353.   swp_Zorder                    = $0004;
  354.   swp_Show                      = $0008;
  355.   swp_Hide                      = $0010;
  356.   swp_NoRedraw                  = $0020;
  357.   swp_NoAdjust                  = $0040;
  358.   swp_Activate                  = $0080;
  359.   swp_Deactivate                = $0100;
  360.   swp_ExtStateChange            = $0200;
  361.   swp_Minimize                  = $0400;
  362.   swp_Maximize                  = $0800;
  363.   swp_Restore                   = $1000;
  364.   swp_FocusActivate             = $2000;
  365.   swp_FocusDeactivate           = $4000;
  366.   swp_NoAutoClose               = $8000;   { Valid in ProgDetails record only }
  367.  
  368. { Window painting }
  369.  
  370. function WinUpdateWindow(Wnd: HWnd): Bool;
  371. function WinInvalidateRect(Wnd: HWnd; R: PRectL; IncludeChildren: Bool): Bool;
  372. function WinInvalidateRegion(Wnd: HWnd; Rgn: HRgn; IncludeChildren: Bool): Bool;
  373.  
  374. { Drawing helpers }
  375.  
  376. function WinInvertRect(PS: Hps; R: PRectL): Bool;
  377. function WinDrawBitmap(PS: Hps; BitMap: HBitMap; Src,Dest: PRectL;
  378.   ForeColor,BackColor: Long; Flags: ULong): Bool;
  379.  
  380. { WinDrawBitMap flags }
  381. const
  382.   dbm_Normal                    = $0000;
  383.   dbm_Invert                    = $0001;
  384.   dbm_HalfTone                  = $0002;
  385.   dbm_Stretch                   = $0004;
  386.   dbm_ImageAttrs                = $0008;
  387.  
  388. function WinDrawText(PS: Hps; TextLen: Long; Text: PChar; var R: RectL;
  389.   ForeColor,BackColor: Long; Flags: ULong): Long;
  390.  
  391. { WinDrawText() codes: from dt_Left to dt_ExternalLeading, the codes are   }
  392. { designed to be OR'ed with ss_Text to create variations of the basic text }
  393. { static item.                                                             }
  394. const
  395.   dt_Left                       = $0000;
  396.   dt_QueryExtent                = $0002;
  397.   dt_UnderScore                 = $0010;
  398.   dt_StrikeOut                  = $0020;
  399.   dt_TextAttrs                  = $0040;
  400.   dt_ExternalLeading            = $0080;
  401.   dt_Center                     = $0100;
  402.   dt_Right                      = $0200;
  403.   dt_Top                        = $0000;
  404.   dt_VCenter                    = $0400;
  405.   dt_Bottom                     = $0800;
  406.   dt_HalfTone                   = $1000;
  407.   dt_Mnemonic                   = $2000;
  408.   dt_WordBreak                  = $4000;
  409.   dt_EraseRect                  = $8000;
  410.  
  411. function WinDrawBorder(PS: Hps; var R: RectL; cX,cY: Long;
  412.   ForeColor,BackColor: Long; Flags: ULong): Bool;
  413.  
  414. { WinDrawBorder flags }
  415. const
  416.   db_PatCopy                    = $0000;
  417.   db_PatInvert                  = $0001;
  418.   db_DestInvert                 = $0002;
  419.   db_AreaMixMode                = $0003;
  420.   db_Rop                        = $0007;
  421.   db_Interior                   = $0008;
  422.   db_AreaAttrs                  = $0010;
  423.   db_Standard                   = $0100;
  424.   db_DlgBorder                  = $0200;
  425.  
  426. { Resource loading functions }
  427.  
  428. function WinLoadString(AB: Hab; Module: HModule; Id: ULong; MaxLen: Long;
  429.   Buffer: PChar): Long;
  430. function WinLoadMessage(AB: Hab; Module: HModule; Id: ULong; MaxLen: Long;
  431.   Buffer: PChar): Long;
  432.  
  433. function WinSetActiveWindow(Desktop: HWnd; Wnd: HWnd): Bool;
  434.  
  435. { wm_Create record }
  436. type
  437.   PCreateStruct = ^CreateStruct;
  438.   CreateStruct = record
  439.     pPresParams:      Pointer;
  440.     pCtlData:         Pointer;
  441.     Id:               ULong;
  442.     HWndInsertBehind: HWnd;
  443.     HWndOwner:        HWnd;
  444.     cY:               Long;
  445.     cX:               Long;
  446.     y:                Long;
  447.     x:                Long;
  448.     flStyle:          ULong;
  449.     pszText:          PChar;
  450.     pszClass:         PChar;
  451.     HWndParent:       HWnd;
  452.   end;
  453.  
  454. { WinQueryClassInfo record }
  455.   PClassInfo = ^ClassInfo;
  456.   ClassInfo = record
  457.     flClassStyle:    ULong;
  458.     pfnWindowProc:   FnWp;
  459.     cbWindowData:    ULong;
  460.   end;
  461.  
  462. function WinSubclassWindow(Wnd: HWnd; WndProc: FnWp): Pointer;
  463. function WinQueryClassName(Wnd: HWnd; MaxLen: Long; Buffer: PChar): Long;
  464. function WinQueryClassInfo(AB: Hab; ClassName: PChar; var ClassInf: ClassInfo): Bool;
  465. function WinQueryActiveWindow(Desktop: HWnd): HWnd;
  466. function WinIsThreadActive(AB: Hab): Bool;
  467. function WinQuerySysModalWindow(Desktop: HWnd): HWnd;
  468. function WinSetSysModalWindow(Desktop: HWnd; Wnd: HWnd): Bool;
  469. function WinQueryWindowUShort(Wnd: HWnd; Index: Long): UShort;
  470. function WinSetWindowUShort(Wnd: HWnd; Index: Long; us: UShort): Bool;
  471. function WinQueryWindowULong(Wnd: HWnd; Index: Long): ULong;
  472. function WinSetWindowULong(Wnd: HWnd; Index: Long; ul: ULong): Bool;
  473. function WinQueryWindowPtr(Wnd: HWnd; Index: Long): Pointer;
  474. function WinSetWindowPtr(Wnd: HWnd; Index: Long; P: Pointer): Bool;
  475. function WinSetWindowBits(Wnd: HWnd; Index: Long; flData,flMask: ULong): Bool;
  476.  
  477. { Standard WinQueryWindowUShort/ULong indices }
  478. const
  479.   qws_User                      =  0;
  480.   qws_Id                        = -1;
  481.   qws_Min                       = -1;
  482.  
  483.   qwl_User                      =  0;
  484.   qwl_Style                     = -2;
  485.   qwp_PFnWp                     = -3;
  486.   qwl_Hmq                       = -4;
  487.   qwl_Reserved                  = -5;
  488.   qwl_Min                       = -6;
  489.  
  490. { wc_Frame WinQueryWindowUShort/ULong indices }
  491.   qwl_HHeap                     = $0004;
  492.   qwl_HWndFocusSave             = $0018;
  493.   qwl_DefButton                 = $0040;
  494.   qwl_PSscBlk                   = $0048;
  495.   qwl_PFepBlk                   = $004C;
  496.   qwl_PStatBlk                  = $0050;
  497.  
  498.   qws_Flags                     = $0008;
  499.   qws_Result                    = $000A;
  500.   qws_XRestore                  = $000C;
  501.   qws_YRestore                  = $000E;
  502.   qws_cXRestore                 = $0010;
  503.   qws_cYRestore                 = $0012;
  504.   qws_XMinimize                 = $0014;
  505.   qws_YMinimize                 = $0016;
  506.  
  507. { Window enumeration }
  508. type
  509.   HEnum = LHandle;
  510.  
  511. function WinBeginEnumWindows(Wnd: HWnd): HEnum;
  512. function WinGetNextWindow(Enum: HEnum): HWnd;
  513. function WinEndEnumWindows(Enum: HEnum): Bool;
  514. function WinWindowFromPoint(Wnd: HWnd; var Point: PointL; Children: Bool): HWnd;
  515. function WinMapWindowPoints(FromWin: HWnd; ToWin: HWnd; var Point: PointL; Count: Long): Bool;
  516.  
  517. { More window painting functions }
  518.  
  519. function WinValidateRect(Wnd: HWnd; R: PRectL; IncludeChildren: Bool): Bool;
  520. function WinValidateRegion(Wnd: HWnd; Rgn: HRgn; IncludeChildren: Bool): Bool;
  521. function WinWindowFromDC(DC: Hdc): HWnd;
  522. function WinQueryWindowDC(Wnd: HWnd): Hdc;
  523. function WinGetScreenPS(Desktop: HWnd): Hps;
  524. function WinLockWindowUpdate(Desktop: HWnd; LockUpdate: HWnd): Bool;
  525. function WinLockUpSystem(Ab: Hab): Bool;
  526. function WinUnlockSystem(AB: Hab; Password: PChar): Bool;
  527. function WinLockVisRegions(Desktop: HWnd; Lock: Bool): Bool;
  528. function WinQueryUpdateRect(Wnd: HWnd; var R: RectL): Bool;
  529. function WinQueryUpdateRegion(Wnd: HWnd; Rgn: HRgn): Long;
  530. function WinExcludeUpdateRegion(PS: Hps; Wnd: HWnd): Long;
  531.  
  532. { QMsg record }
  533. type
  534.   PQMsg = ^QMsg;
  535.   QMsg = record
  536.     HWnd:     HWnd;
  537.     Msg:      ULong;
  538.     Mp1:      MParam;
  539.     Mp2:      MParam;
  540.     Time:     ULong;
  541.     ptl:      PointL;
  542.     Reserved: ULong;
  543.   end;
  544.  
  545. { Standard Window Messages }
  546. const
  547.   wm_Null                       = $0000;
  548.   wm_Create                     = $0001;
  549.   wm_Destroy                    = $0002;
  550.   wm_Enable                     = $0004;
  551.   wm_Show                       = $0005;
  552.   wm_Move                       = $0006;
  553.   wm_Size                       = $0007;
  554.   wm_AdjustWindowPos            = $0008;
  555.   wm_CalcValidRects             = $0009;
  556.   wm_SetWindowParams            = $000A;
  557.   wm_QueryWindowParams          = $000B;
  558.   wm_HitTest                    = $000C;
  559.   wm_Activate                   = $000D;
  560.   wm_SetFocus                   = $000F;
  561.   wm_SetSelection               = $0010;
  562. { Language support Winproc }
  563.   wm_PPaint                     = $0011;
  564.   wm_PSetFocus                  = $0012;
  565.   wm_PSysColorChange            = $0013;
  566.   wm_PSize                      = $0014;
  567.   wm_PActivate                  = $0015;
  568.   wm_PControl                   = $0016;
  569.   wm_Command                    = $0020;
  570.   wm_SysCommand                 = $0021;
  571.   wm_Help                       = $0022;
  572.   wm_Paint                      = $0023;
  573.   wm_Timer                      = $0024;
  574.   wm_Sem1                       = $0025;
  575.   wm_Sem2                       = $0026;
  576.   wm_Sem3                       = $0027;
  577.   wm_Sem4                       = $0028;
  578.   wm_Close                      = $0029;
  579.   wm_Quit                       = $002A;
  580.   wm_SysColorChange             = $002B;
  581.   wm_SysValueChanged            = $002D;
  582.   wm_AppTerminateNotify         = $002E;
  583.   wm_PresParamChanged           = $002F;
  584. { Control notification messages }
  585.   wm_Control                    = $0030;
  586.   wm_VScroll                    = $0031;
  587.   wm_HScroll                    = $0032;
  588.   wm_InitMenu                   = $0033;
  589.   wm_MenuSelect                 = $0034;
  590.   wm_MenuEnd                    = $0035;
  591.   wm_DrawItem                   = $0036;
  592.   wm_MeasureItem                = $0037;
  593.   wm_ControlPointer             = $0038;
  594.   wm_QueryDlgCode               = $003A;
  595.   wm_InitDlg                    = $003B;
  596.   wm_SubstituteString           = $003C;
  597.   wm_MatchMnemonic              = $003D;
  598.   wm_SaveApplication            = $003E;
  599.  
  600. { Reserve a range of messages for help manager. This range includes     }
  601. { public messages, defined below, and private ones, which need to be    }
  602. { reserved here to prevent clashing with application messages           }
  603.   wm_HelpBase                   = $0F00; { Start of msgs for help manager }
  604.   wm_HelpTop                    = $0FFF; { End of msgs for help manager   }
  605.   wm_User                       = $1000;
  606.  
  607. { wm_Command msg source codes }
  608.   cmdsrc_PushButton             = 1;
  609.   cmdsrc_Menu                   = 2;
  610.   cmdsrc_Accelerator            = 3;
  611.   cmdsrc_FontDlg                = 4;
  612.   cmdsrc_FileDlg                = 5;
  613.   cmdsrc_PrintDlg               = 6;
  614.   cmdsrc_ColorDlg               = 7;
  615.   cmdsrc_Other                  = 0;
  616.  
  617. { The following record is used to access the wm_Command, wm_Help, and   }
  618. { wm_SysCommand message parameters:                                     }
  619.  
  620. type
  621.   PCmdMsgMp1 = ^CommandMsgMp1;  { Mp1 }
  622.   CommandMsgMp1 = record
  623.     Cmd:    SmallWord;
  624.     Unused: SmallWord;
  625.   end;
  626.  
  627.   PCmdMsgMp2 = ^CommandMsgMp2;  { Mp2 }
  628.   CommandMsgMp2 = record
  629.     Source: SmallWord;
  630.     fMouse: SmallWord;
  631.   end;
  632.  
  633. { The following record is used by the WinQueryQueueInfo routine }
  634.  
  635.   PMqInfo = ^MqInfo;
  636.   MqInfo = record
  637.     cb:        ULong;
  638.     Pid:       Pid;
  639.     Tid:       Tid;
  640.     CMsgs:     ULong;
  641.     pReserved: Pointer;
  642.   end;
  643.  
  644. function WinSendMsg(Wnd: HWnd; Msg: ULong; Mp1,Mp2: MParam): MResult;
  645. function WinCreateMsgQueue(AB: Hab; CMsg: Long): Hmq;
  646. function WinDestroyMsgQueue(Mq: Hmq): Bool;
  647. function WinQueryQueueInfo(Mq: Hmq; var Mqi: MqInfo; cbCopy: ULong): Bool;
  648. function WinCancelShutdown(Mq: Hmq; CancelAlways: Bool): Bool;
  649. function WinGetMsg(AB: Hab; var Msg: QMsg; Filter: HWnd;
  650.   msgFilterFirst,msgFilterLast: ULong): Bool;
  651. function WinPeekMsg(AB: Hab; var Msg: QMsg; HWndFilter: HWnd;
  652.   msgFilterFirst,msgFilterLast,Flags: ULong): Bool;
  653. function WinDispatchMsg(AB: Hab; var Msg: QMsg): MResult;
  654. function WinPostMsg(Wnd: HWnd; Msg: ULong; Mp1,Mp2: MParam): Bool;
  655. function WinRegisterUserMsg(AB: Hab; MsgId: ULong;
  656.   DataType1,Dir1,DataType2,Dir2,DataTypeR: Long): Bool;
  657. function WinRegisterUserDataType(AB: Hab; DataType,Count: Long;
  658.   Types: PLong): Bool;
  659. function WinSetMsgMode(AB: Hab; ClassName: PChar; Control: Long): Bool;
  660. function WinSetSynchroMode(AB: Hab; Mode: Long): Bool;
  661.  
  662. { WinPeekMsg constants }
  663. const
  664.   pm_Remove                     = $0001;
  665.   pm_NoRemove                   = $0000;
  666.  
  667. { WinRegisterUserDatatype datatypes are declared in the PmTypes unit }
  668.  
  669. { WinRegisterUserMsg direction codes }
  670.   rum_In                        = 1;
  671.   rum_Out                       = 2;
  672.   rum_InOut                     = 3;
  673.  
  674. { WinSetMsgMode constants }
  675.   smd_Delayed                   = $0001;
  676.   smd_Immediate                 = $0002;
  677.  
  678. { WinSetSynchroMode constants }
  679.   ssm_Synchronous               = $0001;
  680.   ssm_Asynchronous              = $0002;
  681.   ssm_Mixed                     = $0003;
  682.  
  683. { wm_CalcValidRects return flags }
  684.   cvr_AlignLeft                 = $0001;
  685.   cvr_AlignBottom               = $0002;
  686.   cvr_AlignRight                = $0004;
  687.   cvr_AlignTop                  = $0008;
  688.   cvr_Redraw                    = $0010;
  689.  
  690. { wm_HitTest return codes }
  691.   ht_Normal                     =  0;
  692.   ht_Transparent                = -1;
  693.   ht_Discard                    = -2;
  694.   ht_Error                      = -3;
  695.  
  696. { wm_Set/QueryWindowParams record and flags }
  697. type
  698.   PWndParams = ^WndParams;
  699.   WndParams = record
  700.     fsStatus:     ULong;
  701.     cchText:      ULong;
  702.     pszText:      PChar;
  703.     cbPresParams: ULong;
  704.     pPresParams:  Pointer;
  705.     cbCtlData:    ULong;
  706.     pCtlData:     Pointer;
  707.   end;
  708.  
  709. const
  710.   wpm_Text                      = $0001;
  711.   wpm_CtlData                   = $0002;
  712.   wpm_PresParams                = $0004;
  713.   wpm_CChText                   = $0008;
  714.   wpm_CbCtlData                 = $0010;
  715.   wpm_CbPresParams              = $0020;
  716.  
  717. function WinInSendMsg(AB: Hab): Bool;
  718. function WinBroadcastMsg(Wnd: HWnd; Msg: ULong; Mp1,Mp2: MParam; rgf: ULong): Bool;
  719.  
  720. { WinBroadcastMsg codes }
  721. const
  722.   bmsg_Post                     = $0000;
  723.   bmsg_Send                     = $0001;
  724.   bmsg_PostQueue                = $0002;
  725.   bmsg_Descendants              = $0004;
  726.   bmsg_FrameOnly                = $0008;
  727.  
  728. function WinWaitMsg(AB: Hab; msgFirst,msgLast: ULong): Bool;
  729. function WinQueryQueueStatus(Desktop: HWnd): ULong;
  730.  
  731. { WinQueryQueueStatus constants }
  732. const
  733.   qs_Key                        = $0001;
  734.   qs_MouseButton                = $0002;
  735.   qs_MouseMove                  = $0004;
  736.   qs_Mouse                      = $0006;  { qs_MouseMove or qs_MouseButton }
  737.   qs_Timer                      = $0008;
  738.   qs_Paint                      = $0010;
  739.   qs_PostMsg                    = $0020;
  740.   qs_Sem1                       = $0040;
  741.   qs_Sem2                       = $0080;
  742.   qs_Sem3                       = $0100;
  743.   qs_Sem4                       = $0200;
  744.   qs_SendMsg                    = $0400;
  745.  
  746. function WinQueryMsgPos(AB: Hab; var Point: PointL): Bool;
  747. function WinQueryMsgTime(AB: Hab): ULong;
  748.  
  749. type
  750.   HEv  = ULong;
  751.   HMtx = ULong;
  752.   HMux = ULong;
  753.  
  754. function WinWaitEventSem(EvSem: HEv; Timeout: ULong): ApiRet;
  755. function WinRequestMutexSem(MtxSem: HMtx; Timeout: ULong): ApiRet;
  756. function WinWaitMuxWaitSem(MuxSem: HMux; Timeout: ULong; pulUser: PULong): ApiRet;
  757. function WinPostQueueMsg(Mq: Hmq; Msg: ULong; Mp1,Mp2: MParam): Bool;
  758.  
  759. { WinSetMsgInterest/WinSetClassMsgInterest constants }
  760. const
  761.   smim_All                      = $0EFF;
  762.   smi_NoInterest                = $0001;
  763.   smi_Interest                  = $0002;
  764.   smi_Reset                     = $0004;
  765.   smi_AutoDispatch              = $0008;
  766.  
  767. function WinSetMsgInterest(Wnd: HWnd; MsgClass: ULong; Control: Long): Bool;
  768. function WinSetClassMsgInterest(AB: Hab; ClassName: PChar; MsgClass: ULong;
  769.   Control: Long): Bool;
  770.  
  771. { Keyboard and mouse }
  772.  
  773. function WinSetFocus(Desktop: HWnd; SetFocus: HWnd): Bool;
  774. function WinFocusChange(Desktop: HWnd; SetFocus: HWnd; flFocusChange: ULong): Bool;
  775.  
  776. const
  777.   fc_NoSetFocus                 = $0001;
  778.   fc_NoBringToTop               = fc_NoSetFocus;
  779.   fc_NoLoseFocus                = $0002;
  780.   fc_NoBringTopFirstWindow      = fc_NoLoseFocus;
  781.   fc_NoSetActive                = $0004;
  782.   fc_NoLoseActive               = $0008;
  783.   fc_NoSetSelection             = $0010;
  784.   fc_NoLoseSelection            = $0020;
  785.  
  786.   qfc_NextInChain               = $0001;
  787.   qfc_Active                    = $0002;
  788.   qfc_Frame                     = $0003;
  789.   qfc_SelectActive              = $0004;
  790.   qfc_PartOfChain               = $0005;
  791.  
  792.   wm_VrnDisabled                = $007E;
  793.   wm_VrnEnabled                 = $007F;
  794.  
  795. function WinSetVisibleRegionNotify(Wnd: HWnd; fEnable: Bool): Bool;
  796. function WinQueryVisibleRegion(Wnd: HWnd; Rgn: HRgn): ULong;
  797. function WinSetCapture(Desktop: HWnd; Wnd: HWnd): Bool;
  798. function WinQueryCapture(Desktop: HWnd): HWnd;
  799. function WinCheckInput(AB: Hab): Bool;
  800.  
  801. { Mouse input messages}
  802. const
  803.   wm_MouseFirst                 = $0070;
  804.   wm_MouseLast                  = $0079;
  805.   wm_ButtonClickFirst           = $0071;
  806.   wm_ButtonClickLast            = $0079;
  807.   wm_MouseMove                  = $0070;
  808.   wm_Button1Down                = $0071;
  809.   wm_Button1Up                  = $0072;
  810.   wm_Button1DblClk              = $0073;
  811.   wm_Button2Down                = $0074;
  812.   wm_Button2Up                  = $0075;
  813.   wm_Button2DblClk              = $0076;
  814.   wm_Button3Down                = $0077;
  815.   wm_Button3Up                  = $0078;
  816.   wm_Button3DblClk              = $0079;
  817.   wm_ExtMouseFirst              = $0410;
  818.   wm_ExtMouseLast               = $0419;
  819.   wm_Chord                      = $0410;
  820.   wm_Button1MotionStart         = $0411;
  821.   wm_Button1MotionEnd           = $0412;
  822.   wm_Button1Click               = $0413;
  823.   wm_Button2MotionStart         = $0414;
  824.   wm_Button2MotionEnd           = $0415;
  825.   wm_Button2Click               = $0416;
  826.   wm_Button3MotionStart         = $0417;
  827.   wm_Button3MotionEnd           = $0418;
  828.   wm_Button3Click               = $0419;
  829.   { Messages $041A - $041F are reserved }
  830.   wm_MouseTranslateFirst        = $0420;
  831.   wm_MouseTranslateLast         = $0428;
  832.   wm_BeginDrag                  = $0420;
  833.   wm_EndDrag                    = $0421;
  834.   wm_SingleSelect               = $0422;
  835.   wm_Open                       = $0423;
  836.   wm_ContextMenu                = $0424;
  837.   wm_ContextHelp                = $0425;
  838.   wm_TextEdit                   = $0426;
  839.   wm_BeginSelect                = $0427;
  840.   wm_EndSelect                  = $0428;
  841.   wm_Pickup                     = $0429;
  842.   wm_PenFirst                   = $04C0;
  843.   wm_PenLast                    = $04FF;
  844.   wm_mmpmFirst                  = $0500;
  845.   wm_mmpmLast                   = $05FF;
  846.  { Messages 0x0BD0 - 0x0BFF are reserved }
  847.  { for bidirectional language support.   }
  848.   wm_BiDi_First                 = $0BD0;
  849.   wm_BiDi_Last                  = $0BFF;
  850.  
  851. function WinQueryFocus(Desktop: HWnd): HWnd;
  852.  
  853. { Key/Character input messages }
  854. const
  855.   wm_Char                       = $007A;
  856.   wm_VioChar                    = $007B;
  857.  
  858. { wm_Char fs field bits }
  859.   kc_None                       = $0000;    { Reserved }
  860.   kc_Char                       = $0001;
  861.   kc_VirtualKey                 = $0002;
  862.   kc_ScanCode                   = $0004;
  863.   kc_Shift                      = $0008;
  864.   kc_Ctrl                       = $0010;
  865.   kc_Alt                        = $0020;
  866.   kc_KeyUp                      = $0040;
  867.   kc_PrevDown                   = $0080;
  868.   kc_LoneKey                    = $0100;
  869.   kc_DeadKey                    = $0200;
  870.   kc_Composite                  = $0400;
  871.   kc_InvalidComp                = $0800;
  872.   kc_Toggle                     = $1000;
  873.   kc_InvalidChar                = $2000;
  874.   kc_DbcsRsrvd1                 = $4000;
  875.   kc_DbcsRsrvd2                 = $8000;
  876.  
  877. { The following record is used to access the wm_MouseMove, and wm_Button }
  878. { message parameters                                                     }
  879. type
  880.   PMseMsgMp1 = ^MouseMsgMp1;    { Mp1 }
  881.   MouseMsgMp1 = record
  882.     X: SmallWord;
  883.     Y: SmallWord;
  884.   end;
  885.  
  886.   PMseMsgMp2 = ^MouseMsgMp2;    { Mp2 }
  887.   MouseMsgMp2 = record
  888.     codeHitTest: SmallWord;
  889.     fsInp:       SmallWord;     { Input flags }
  890.   end;
  891.  
  892.   pMseMsg = ^MseMsg;
  893.   MseMsg  = Record
  894.     X: SmallWord;
  895.     Y: SmallWord;
  896.     codeHitTest: SmallWord;
  897.     fsInp:       SmallWord;     { Input flags }
  898.   end;
  899.  
  900.   PChrMsgMp1 = ^CharMsgMp1;     { Mp1 }
  901.   CharMsgMp1 = record
  902.     fs:         SmallWord;
  903.     cRepeat:    Byte;
  904.     ScanCode:   Byte;
  905.   end;
  906.  
  907.   PChrMsgMp2 = ^CharMsgMp2;     { Mp2 }
  908.   CharMsgMp2 = record
  909.     Chr:        SmallWord;
  910.     VKey:       SmallWord;
  911.   end;
  912.  
  913. { !! Note, that pChrMsg, pCharMsg and pMouseMsg ONLY works if the procedure }
  914. { !!       passed mp1 and mp2 are declared as cdecl.                        }
  915.   pChrMsg = ^ChrMsg;
  916.   ChrMsg = record
  917.     fs:         SmallWord;
  918.     cRepeat:    Byte;
  919.     ScanCode:   Byte;
  920.     Chr:        SmallWord;
  921.     VKey:       SmallWord;
  922.   end;
  923.  
  924. function pCharMsg( pmsg : Pointer ) : pChrMsg; inline;
  925. begin
  926.   pCharMsg := ptr( Longint(pmsg) + Sizeof(mParam) );
  927. end;
  928.  
  929. function pMouseMsg( pmsg : Pointer ) : pMseMsg; inline;
  930. begin
  931.   pMouseMsg := ptr( Longint(pmsg) + Sizeof(mParam) );
  932. end;
  933.  
  934. const
  935.   inp_None                      = $0000;
  936.   inp_Kbd                       = $0001;
  937.   inp_Mult                      = $0002;
  938.   inp_Res2                      = $0004;
  939.   inp_Shift                     = $0008;
  940.   inp_Ctrl                      = $0010;
  941.   inp_Alt                       = $0020;
  942.   inp_Res3                      = $0040;
  943.   inp_Res4                      = $0080;
  944.   inp_Ignore                    = $FFFF;
  945.  
  946. { Virtual key values }
  947.   vk_Button1                    = $01;
  948.   vk_Button2                    = $02;
  949.   vk_Button3                    = $03;
  950.   vk_Break                      = $04;
  951.   vk_BackSpace                  = $05;
  952.   vk_Tab                        = $06;
  953.   vk_BackTab                    = $07;
  954.   vk_NewLine                    = $08;
  955.   vk_Shift                      = $09;
  956.   vk_Ctrl                       = $0A;
  957.   vk_Alt                        = $0B;
  958.   vk_AltGraf                    = $0C;
  959.   vk_Pause                      = $0D;
  960.   vk_CapsLock                   = $0E;
  961.   vk_Esc                        = $0F;
  962.   vk_Space                      = $10;
  963.   vk_PageUp                     = $11;
  964.   vk_PageDown                   = $12;
  965.   vk_End                        = $13;
  966.   vk_Home                       = $14;
  967.   vk_Left                       = $15;
  968.   vk_Up                         = $16;
  969.   vk_Right                      = $17;
  970.   vk_Down                       = $18;
  971.   vk_PrintScrn                  = $19;
  972.   vk_Insert                     = $1A;
  973.   vk_Delete                     = $1B;
  974.   vk_ScrlLock                   = $1C;
  975.   vk_NumLock                    = $1D;
  976.   vk_Enter                      = $1E;
  977.   vk_SysRq                      = $1F;
  978.   vk_F1                         = $20;
  979.   vk_F2                         = $21;
  980.   vk_F3                         = $22;
  981.   vk_F4                         = $23;
  982.   vk_F5                         = $24;
  983.   vk_F6                         = $25;
  984.   vk_F7                         = $26;
  985.   vk_F8                         = $27;
  986.   vk_F9                         = $28;
  987.   vk_F10                        = $29;
  988.   vk_F11                        = $2A;
  989.   vk_F12                        = $2B;
  990.   vk_F13                        = $2C;
  991.   vk_F14                        = $2D;
  992.   vk_F15                        = $2E;
  993.   vk_F16                        = $2F;
  994.   vk_F17                        = $30;
  995.   vk_F18                        = $31;
  996.   vk_F19                        = $32;
  997.   vk_F20                        = $33;
  998.   vk_F21                        = $34;
  999.   vk_F22                        = $35;
  1000.   vk_F23                        = $36;
  1001.   vk_F24                        = $37;
  1002.   vk_EndDrag                    = $38;
  1003.   vk_Menu                       = VK_F10;
  1004.   vk_DbcsFirst                  = $0080;
  1005.   vk_DbcsLast                   = $00ff;
  1006.   vk_UserFirst                  = $0100;
  1007.   vk_UserLast                   = $01ff;
  1008.  
  1009. function WinGetKeyState(Desktop: HWnd; VKey: Long): Long;
  1010. function WinGetPhysKeyState(Desktop: HWnd; Sc: Long): Long;
  1011. function WinEnablePhysInput(Desktop: HWnd; Enable: Bool): Bool;
  1012. function WinIsPhysInputEnabled(Desktop: HWnd): Bool;
  1013. function WinSetKeyboardStateTable(Desktop: HWnd; pKeyStateTable: Pointer; fSet: Bool): Bool;
  1014.  
  1015. { Journal Notification messages }
  1016. const
  1017.   wm_JournalNotify              = $007C;
  1018.   { Define the valid commands (lParm1) for journal notify message }
  1019.   jrn_QueueStatus               = $00000001;
  1020.   jrn_PhysKeyState              = $00000002;
  1021.  
  1022. { Dialog Manager }
  1023.  
  1024. function WinGetDlgMsg(Dlg: HWnd; var Msg: QMsg): Bool;
  1025. function WinLoadDlg(Parent,Owner: HWnd; DlgProc: FnWp; Module: HModule;
  1026.   IdDlg: ULong; CreateParams: Pointer): HWnd;
  1027. function WinDlgBox(Parent,Owner: HWnd; DlgProc: FnWp; Module: HModule;
  1028.   idDlg: ULong; CreateParams: Pointer): ULong;
  1029. function WinDismissDlg(Dlg: HWnd; Result: ULong): Bool;
  1030. function WinQueryDlgItemShort(Dlg: HWnd; IdItem: ULong; Result: Pointer;
  1031.   Signed: Bool): Bool;
  1032. function WinSetDlgItemShort(Dlg: HWnd; IdItem: ULong; Value: SmallWord;
  1033.   Signed: Bool): Bool;
  1034. function WinSetDlgItemText(Dlg: HWnd; IdItem: ULong; Text: PChar): Bool;
  1035. function WinQueryDlgItemText(Dlg: HWnd; IdItem: ULong; BufferMax: Long;
  1036.   Buffer: PChar): ULong;
  1037. function WinQueryDlgItemTextLength(Dlg: HWnd; IdItem: ULong): Long;
  1038. function WinDefDlgProc(Dlg: HWnd; Msg: ULong; Mp1,Mp2: MParam): MResult;
  1039.  
  1040. { Special item IDs }
  1041. const
  1042.   did_Ok                        = 1;
  1043.   did_Cancel                    = 2;
  1044.   did_Error                     = $FFFF;
  1045.  
  1046. function WinAlarm(Desktop: HWnd; rgfType: ULong): Bool;
  1047.  
  1048. { WinAlarm Codes }
  1049. const
  1050.   wa_Warning                    = 0;
  1051.   wa_Note                       = 1;
  1052.   wa_Error                      = 2;
  1053.   wa_CWinAlarms                 = 3;    { count of valid alarms }
  1054.  
  1055. function WinMessageBox(Parent,Owner: HWnd; Text,Caption: PChar;
  1056.   IdWindow,Style: ULong): ULong;
  1057.  
  1058. const
  1059.   max_MBDText                   = 71;
  1060.  
  1061. type
  1062.   PMB2D = ^MB2D;
  1063.   MB2D = record
  1064.     achText:  array[0..MAX_MBDTEXT] of Char;    { Text of the button. eg. "~Cancel"    }
  1065.     idButton:  ULong;                           { Button ID returned when user chooses }
  1066.     { button }
  1067.     flStyle:  Long;                             { Button style or'ed with internal     }
  1068.     { styles }
  1069.   end;
  1070.  
  1071.   PMB2Info = ^MB2Info;
  1072.   MB2Info = record
  1073.     cb:         ULong;                  { Size of fixed part of structure          }
  1074.     hIcon:      HPointer;               { Icon handle                              }
  1075.     cButtons:   ULong;                  { Number of buttons                        }
  1076.     flStyle:    ULong;                  { Icon style flags (mb_IconQuestion, etc..)}
  1077.     hwndNotify: HWnd;                   { Reserved                                 }
  1078.     mb2d:       array[0..0] of MB2D;    { Array of button definitions              }
  1079.   end;
  1080.  
  1081.    { WinMessageBox2                                                }
  1082.    {                                                               }
  1083.    { Parameters: hwndParent   - handle of the parent window.       }
  1084.    {             hwndOwner    - handle of the owner window.        }
  1085.    {             pszText      - message text.                      }
  1086.    {             pszCaption   - title of the message box.          }
  1087.    {             idWindow     - Message box id                     }
  1088.    {             mb2info      - pointer to button/icon info        }
  1089.  
  1090. function WinMessageBox2(hwndParent,hwndOwner: HWnd; Text,Caption: PChar;
  1091.   idWindow: ULong; mb2info: PMB2Info): ULong;
  1092.  
  1093. { Message box types }
  1094. const
  1095.   mb_Ok                         = $0000;
  1096.   mb_OkCancel                   = $0001;
  1097.   mb_RetryCancel                = $0002;
  1098.   mb_AbortRetryIgnore           = $0003;
  1099.   mb_YesNo                      = $0004;
  1100.   mb_YesNoCancel                = $0005;
  1101.   mb_Cancel                     = $0006;
  1102.   mb_Enter                      = $0007;
  1103.   mb_EnterCancel                = $0008;
  1104.  
  1105.   mb_NoIcon                     = $0000;
  1106.   mb_CUANotification            = $0000;
  1107.   mb_IconQuestion               = $0010;
  1108.   mb_IconExclamation            = $0020;
  1109.   mb_CUAWarning                 = $0020;
  1110.   mb_IconAsterisk               = $0030;
  1111.   mb_IconHand                   = $0040;
  1112.   mb_CUACritical                = $0040;
  1113.   mb_CustomIcon                 = $0080;
  1114.   mb_Query                      = mb_IconQuestion;
  1115.   mb_Warning                    = mb_CUAWarning;
  1116.   mb_Information                = mb_IconAsterisk;
  1117.   mb_Critical                   = mb_CUACritical;
  1118.   mb_Error                      = mb_Critical;
  1119.  
  1120.   mb_DefButton1                 = $0000;
  1121.   mb_DefButton2                 = $0100;
  1122.   mb_DefButton3                 = $0200;
  1123.  
  1124.   mb_ApplModal                  = $0000;
  1125.   mb_SystemModal                = $1000;
  1126.   mb_Help                       = $2000;
  1127.   mb_Moveable                   = $4000;
  1128.  
  1129.   { Message box return codes }
  1130.   mbid_Ok                       = 1;
  1131.   mbid_Cancel                   = 2;
  1132.   mbid_Abort                    = 3;
  1133.   mbid_Retry                    = 4;
  1134.   mbid_Ignore                   = 5;
  1135.   mbid_Yes                      = 6;
  1136.   mbid_No                       = 7;
  1137.   mbid_Help                     = 8;
  1138.   mbid_Enter                    = 9;
  1139.   mbid_Error                    = $FFFF;
  1140.  
  1141. { Dialog codes: returned by wm_QueryDlgCode msg }
  1142.   dlgc_EntryField               = $0001; { Entry field item understands em_SetSel) }
  1143.   dlgc_Button                   = $0002; { Button item                             }
  1144.   dlgc_RadioButton              = $0004; { Radio button                            }
  1145.   dlgc_Static                   = $0008; { Static item                             }
  1146.   dlgc_Default                  = $0010; { Default push button                     }
  1147.   dlgc_PushButton               = $0020; { Normal (Non-default) push button        }
  1148.   dlgc_CheckBox                 = $0040; { Check box button control                }
  1149.   dlgc_ScrollBar                = $0080; { Scroll bar                              }
  1150.   dlgc_Menu                     = $0100; { Menu                                    }
  1151.   dlgc_TabOnClick               = $0200;
  1152.   dlgc_MLE                      = $0400; { Multiple Line Entry                     }
  1153.  
  1154. function WinProcessDlg(Dlg: HWnd): ULong;
  1155. function WinSendDlgItemMsg(Dlg: HWnd; IdItem: ULong; Msg: ULong;
  1156.   Mp1,Mp2: MParam): MResult;
  1157. function WinMapDlgPoints(Dlg: HWnd; var PrgWPtL: PointL; Count: ULong;
  1158.   CalcWindowCoords: Bool): Bool;
  1159. function WinEnumDlgItem(Dlg: HWnd; Wnd: HWnd; Code: ULong): HWnd;
  1160. function WinSubstituteStrings(Wnd: HWnd; Src: PChar; DestMax: Long;
  1161.   Dest: PChar): Long;
  1162.  
  1163. { WinEnumDlgItem constants }
  1164. const
  1165.   edi_FirstTabItem              = 0;
  1166.   edi_LastTabItem               = 1;
  1167.   edi_NextTabItem               = 2;
  1168.   edi_PrevTabItem               = 3;
  1169.   edi_FirstGroupItem            = 4;
  1170.   edi_LastGroupItem             = 5;
  1171.   edi_NextGroupItem             = 6;
  1172.   edi_PrevGroupItem             = 7;
  1173.  
  1174. { Dialog template definitions }
  1175. type
  1176.   PDlgTItem = ^DlgTItem;
  1177.   DlgTItem = record
  1178.     fsItemStatus:    SmallWord;
  1179.     cChildren:       SmallWord;
  1180.     cchClassName:    SmallWord;
  1181.     offClassName:    SmallWord;
  1182.     cchText:         SmallWord;
  1183.     offText:         SmallWord;
  1184.     flStyle:         ULong;
  1185.     X:               SmallInt;
  1186.     Y:               SmallInt;
  1187.     cX:              SmallInt;
  1188.     cY:              SmallInt;
  1189.     id:              SmallWord;
  1190.     offPresParams:   SmallWord;
  1191.     offCtlData:      SmallWord;
  1192.   end;
  1193.  
  1194. { Dialog Template structure }
  1195.  PDlgTemplate = ^DlgTemplate;
  1196.  DlgTemplate = record
  1197.    cbTemplate:             SmallWord;
  1198.    dtype:                  SmallWord;
  1199.    codepage:               SmallWord;
  1200.    offadlgti:              SmallWord;
  1201.    fsTemplateStatus:       SmallWord;
  1202.    iItemFocus:             SmallWord;
  1203.    coffPresParams:         SmallWord;
  1204.    adlgti:                 DlgTItem;
  1205.  end;
  1206.  
  1207. function WinCreateDlg(Parent,Owner: HWnd; DlgProc: FnWp; var Dlg: DlgTemplate;
  1208.   CreateParams: Pointer): HWnd;
  1209.  
  1210. { Static Control Manager }
  1211.  
  1212. { Static control styles:                                                 }
  1213. {  NOTE: the top 9 bits of the LOWORD of the window flStyle are used for }
  1214. {  dt_* flags.  The lower 7 bits are for SS_* styles.  This gives us up  }
  1215. {  to 128 distinct static control types (we currently use 11 of them).   }
  1216. const
  1217.   ss_Text                       = $0001;
  1218.   ss_GroupBox                   = $0002;
  1219.   ss_Icon                       = $0003;
  1220.   ss_BitMap                     = $0004;
  1221.   ss_FgndRect                   = $0005;
  1222.   ss_HalfToneRect               = $0006;
  1223.   ss_BkgndRect                  = $0007;
  1224.   ss_FgndFrame                  = $0008;
  1225.   ss_HalfToneFrame              = $0009;
  1226.   ss_BkgndFrame                 = $000A;
  1227.   ss_SysIcon                    = $000B;
  1228.   ss_AutoSize                   = $0040;
  1229.  
  1230. { Static control messages }
  1231.   SM_SETHANDLE                  = $0100;
  1232.   SM_QUERYHANDLE                = $0101;
  1233.  
  1234. { Button control styles }
  1235.   bs_PushButton                 = 0;
  1236.   bs_CheckBox                   = 1;
  1237.   bs_AutoCheckBox               = 2;
  1238.   bs_RadioButton                = 3;
  1239.   bs_AutoRadioButton            = 4;
  1240.   bs_3State                     = 5;
  1241.   bs_Auto3State                 = 6;
  1242.   bs_UserButton                 = 7;
  1243.   bs_PrimaryStyles              = $000F;
  1244.   bs_BitMap                     = $0040;
  1245.   bs_Icon                       = $0080;
  1246.   bs_Help                       = $0100;
  1247.   bs_SysCommand                 = $0200;
  1248.   bs_Default                    = $0400;
  1249.   bs_NoPointerFocus             = $0800;
  1250.   bs_NoBorder                   = $1000;
  1251.   bs_NoCursorSelect             = $2000;
  1252.   bs_AutoSize                   = $4000;
  1253.  
  1254. type
  1255.   PBtnCData = ^BtnCData;
  1256.   BtnCData = record
  1257.     cb:            SmallWord;
  1258.     fsCheckState:  SmallWord;
  1259.     fsHiliteState: SmallWord;
  1260.     hImage:        LHandle;
  1261.   end;
  1262.  
  1263. { User button record (passed in wm_Control msg }
  1264.   PUserButton = ^UserButton;
  1265.   UserButton = record
  1266.     HWnd:       HWnd;
  1267.     Hps:        Hps;
  1268.     fsState:    ULong;
  1269.     fsStateOld: ULong;
  1270.   end;
  1271.  
  1272. { Button control messages }
  1273. const
  1274.   bm_Click                      = $0120;
  1275.   bm_QueryCheckIndex            = $0121;
  1276.   bm_QueryHilite                = $0122;
  1277.   bm_SetHilite                  = $0123;
  1278.   bm_QueryCheck                 = $0124;
  1279.   bm_SetCheck                   = $0125;
  1280.   bm_SetDefault                 = $0126;
  1281.  
  1282. { Button notification codes }
  1283.   bn_Clicked                    = 1;
  1284.   bn_DblClicked                 = 2;
  1285.   bn_Paint                      = 3;
  1286.  
  1287. { bn_Paint button draw state codes (must be in high byte) }
  1288.   bds_Hilited                   = $0100;
  1289.   bds_Disabled                  = $0200;
  1290.   bds_Default                   = $0400;
  1291.  
  1292. { Entry field styles }
  1293.   es_Left                       = $00000000;
  1294.   es_Center                     = $00000001;
  1295.   es_Right                      = $00000002;
  1296.   es_AutoScroll                 = $00000004;
  1297.   es_Margin                     = $00000008;
  1298.   es_AutoTab                    = $00000010;
  1299.   es_ReadOnly                   = $00000020;
  1300.   es_Command                    = $00000040;
  1301.   es_UnReadable                 = $00000080;
  1302.   es_AutoSize                   = $00000200;
  1303.   es_Any                        = $00000000;
  1304.   es_Sbcs                       = $00001000;
  1305.   es_Dbcs                       = $00002000;
  1306.   es_Mixed                      = $00003000;
  1307.  
  1308. { combo box styles }
  1309.   cbs_Simple                    = $0001;
  1310.   cbs_DropDown                  = $0002;
  1311.   cbs_DropDownList              = $0004;
  1312.  
  1313. { Use this bit for drop down combo boxes that do not want to       }
  1314. { receive a cbn_Enter on a single click in their list boxes.       }
  1315. { This is for compatibility with releases prior to OS/2 2.0 which  }
  1316. { did not send this message                                        }
  1317.   cbs_Compatible                = $0008;
  1318.  
  1319. { The following edit and listbox styles may be used in conjunction }
  1320. { with cbs_ styles es_AutoTab es_Any es_Sbcs es_Dbcs es_Mixed ls_HorzScroll }
  1321. { IDs of combobox entry field and listbox.                         }
  1322.   cbid_List                     = $029A;
  1323.   cbid_Edit                     = $029B;
  1324.  
  1325.   cbm_ShowList                  = $0170;
  1326.   cbm_Hilite                    = $0171;
  1327.   cbm_IsListShowing             = $0172;
  1328.  
  1329.   cbn_EfChange                  = 1;
  1330.   cbn_EfScroll                  = 2;
  1331.   cbn_MemError                  = 3;
  1332.   cbn_LbSelect                  = 4;
  1333.   cbn_LbScroll                  = 5;
  1334.   cbn_ShowList                  = 6;
  1335.   cbn_Enter                     = 7;
  1336.  
  1337. function WinCheckButton(Dlg: HWnd; id: ULong; CheckState: ULong): ULong; inline;
  1338. begin
  1339.   WinCheckButton := WinSendDlgItemMsg(Dlg, id, bm_SetCheck, CheckState, 0);
  1340. end;
  1341.  
  1342. function WinQueryButtonCheckstate(hwndDlg : HWnd; id : ULong) : ULong; inline;
  1343. begin
  1344.   WinQueryButtonCheckstate :=
  1345.     ULong( WinSendDlgItemMsg(hwndDlg, id, BM_QUERYCHECK, 0, 0) );
  1346. end;
  1347.  
  1348. function WinEnableControl(hwndDlg: HWnd; id: ULong; fEnable: Bool): Bool; Inline;
  1349. begin
  1350.   WinEnableControl := WinEnableWindow( WinWindowFromID(hwndDlg, id), fEnable);
  1351. end;
  1352.  
  1353. function WinIsControlEnabled(hwndDlg: HWnd; id: ULong) : Bool; Inline;
  1354. begin
  1355.   WinIsControlEnabled := WinIsWindowEnabled(WinWindowFromID(hwndDlg, id));
  1356. end;
  1357.  
  1358. type
  1359.   PEntryFData = ^EntryFData;
  1360.   EntryFData = record
  1361.     cb:           SmallWord;
  1362.     cchEditLimit: SmallWord;
  1363.     ichMinSel:    SmallWord;
  1364.     ichMaxSel:    SmallWord;
  1365.   end;
  1366.  
  1367. { Entry Field messages }
  1368. const
  1369.   em_QueryChanged               = $0140;
  1370.   em_QuerySel                   = $0141;
  1371.   em_SetSel                     = $0142;
  1372.   em_SetTextLimit               = $0143;
  1373.   em_Cut                        = $0144;
  1374.   em_Copy                       = $0145;
  1375.   em_Clear                      = $0146;
  1376.   em_Paste                      = $0147;
  1377.   em_QueryFirstChar             = $0148;
  1378.   em_SetFirstChar               = $0149;
  1379.   em_QueryReadOnly              = $014A;
  1380.   em_SetReadOnly                = $014B;
  1381.   em_SetInsertMode              = $014C;
  1382.  
  1383. { Entry Field notification messages }
  1384.   en_SetFocus                   = $0001;
  1385.   en_KillFocus                  = $0002;
  1386.   en_Change                     = $0004;
  1387.   en_Scroll                     = $0008;
  1388.   en_MemError                   = $0010;
  1389.   en_Overflow                   = $0020;
  1390.   en_InsertModeToggle           = $0040;
  1391.  
  1392. {  Multiple Line Entries are declared in PmMle unit}
  1393.  
  1394. { List box styles }
  1395.   ls_MultipleSel                = $00000001;
  1396.   ls_OwnerDraw                  = $00000002;
  1397.   ls_NoAdjustPos                = $00000004;
  1398.   ls_HorzScroll                 = $00000008;
  1399.   ls_ExtendedSel                = $00000010;
  1400.  
  1401. { List box notification messages }
  1402.   ln_Select                     = 1;
  1403.   ln_SetFocus                   = 2;
  1404.   ln_KillFocus                  = 3;
  1405.   ln_Scroll                     = 4;
  1406.   ln_Enter                      = 5;
  1407.  
  1408. { List box messages }
  1409.   lm_QueryItemCount             = $0160;
  1410.   lm_InsertItem                 = $0161;
  1411.   lm_SetTopIndex                = $0162;
  1412.   lm_DeleteItem                 = $0163;
  1413.   lm_SelectItem                 = $0164;
  1414.   lm_QuerySelection             = $0165;
  1415.   lm_SetItemText                = $0166;
  1416.   lm_QueryItemTextLength        = $0167;
  1417.   lm_QueryItemText              = $0168;
  1418.   lm_SetItemHandle              = $0169;
  1419.   lm_QueryItemHandle            = $016A;
  1420.   lm_SearchString               = $016B;
  1421.   lm_SetItemHeight              = $016C;
  1422.   lm_QueryTopIndex              = $016D;
  1423.   lm_DeleteAll                  = $016E;
  1424.  
  1425. { List box constants }
  1426.   lit_Cursor                    = -4;
  1427.   lit_Error                     = -3;
  1428.   lit_MemError                  = -2;
  1429.   lit_None                      = -1;
  1430.   lit_First                     = -1;
  1431.  
  1432. { For lm_InsertItem msg }
  1433.   lit_End                       = -1;
  1434.   lit_SortAscending             = -2;
  1435.   lit_SortDescending            = -3;
  1436.  
  1437. { For lm_SearchString msg }
  1438.   lss_SubString                 = $0001;
  1439.   lss_Prefix                    = $0002;
  1440.   lss_CaseSensitive             = $0004;
  1441.  
  1442. { Menu control styles }
  1443.   ms_ActionBar                  = $00000001;
  1444.   ms_TitleButton                = $00000002;
  1445.   ms_VerticalFlip               = $00000004;
  1446.   ms_ConditionalCascade         = $00000040;
  1447.  
  1448. type
  1449. { Structure for use with LM_INSERTMULTITEMS }
  1450.   PLboxInfo = ^LBoxInfo;
  1451.   LBoxInfo = record
  1452.     lItemIndex  : Long;         // Item index
  1453.     ulItemCount : ULong;        // Item count
  1454.     reserved    : ULong;        // Reserved - must be zero
  1455.     reserved2   : ULong;        // Reserved - must be zero
  1456.   end;
  1457.  
  1458. function WinDeleteLBoxItem(hwndLBox: hwnd; index: Long) : Long; inline;
  1459. begin
  1460.   WinDeleteLBoxItem := WinSendMsg( hwndLBox, LM_DELETEITEM, Index, 0 );
  1461. end;
  1462.  
  1463. function WinInsertLBoxItem(hwndLBox: hwnd; index: Long; psz: PChar) : Long; inline;
  1464. begin
  1465.   WinInsertLBoxItem := WinSendMsg( hwndLBox, LM_INSERTITEM, Index, Long(psz) );
  1466. end;
  1467.  
  1468. function WinQueryLBoxCount(hwndLBox: hwnd) : Long; inline;
  1469. begin
  1470.   WinQueryLBoxCount := WinSendMsg( hwndLBox, LM_QUERYITEMCOUNT, 0, 0 );
  1471. end;
  1472.  
  1473. function WinQueryLBoxItemText(hwndLBox: hwnd; Index: Long; psz: PChar; cchMax: SmallWord) : Long; inline;
  1474. begin
  1475.   WinQueryLBoxItemText := WinSendMsg( hwndLBox, LM_QUERYITEMTEXT,
  1476.     Index OR (cchMax shl 16), Long(psz) );
  1477. end;
  1478.  
  1479. function WinQueryLBoxItemTextLength(hwndLBox: hwnd; Index: Long) : Long; inline;
  1480. begin
  1481.   WinQueryLBoxItemTextLength := WinSendMsg( hwndLBox, LM_QUERYITEMTEXTLENGTH,
  1482.     Index, 0 );
  1483. end;
  1484.  
  1485. function WinSetLBoxItemText(hwndLBox: hwnd; Index: Long; psz: PChar) : Bool; inline;
  1486. begin
  1487.   WinSetLBoxItemText := Bool( WinSendMsg( hwndLBox, LM_SETITEMTEXT, Index, Long(psz) ));
  1488. end;
  1489.  
  1490. function WinQueryLBoxSelectedItem(hwndLBox: hwnd) : Long; inline;
  1491. begin
  1492.   WinQueryLBoxSelectedItem := WinSendMsg( hwndLBox, LM_QUERYSELECTION,
  1493.     LIT_FIRST, 0 );
  1494. end;
  1495.  
  1496. function WinLoadMenu(Frame: HWnd; Module: HModule; IdMenu: ULong): HWnd;
  1497.  
  1498. { Menu control messages }
  1499. const
  1500.   mm_InsertItem                 = $0180;
  1501.   mm_DeleteItem                 = $0181;
  1502.   mm_QueryItem                  = $0182;
  1503.   mm_SetItem                    = $0183;
  1504.   mm_QueryItemCount             = $0184;
  1505.   mm_StartMenuMode              = $0185;
  1506.   mm_EndMenuMode                = $0186;
  1507.   mm_RemoveItem                 = $0188;
  1508.   mm_SelectItem                 = $0189;
  1509.   mm_QuerySelItemId             = $018A;
  1510.   mm_QueryItemText              = $018B;
  1511.   mm_QueryItemTextLength        = $018C;
  1512.   mm_SetItemHandle              = $018D;
  1513.   mm_SetItemText                = $018E;
  1514.   mm_ItemPositionFromId         = $018F;
  1515.   mm_ItemIdFromPosition         = $0190;
  1516.   mm_QueryItemAttr              = $0191;
  1517.   mm_SetItemAttr                = $0192;
  1518.   mm_IsItemValid                = $0193;
  1519.   mm_QueryItemRect              = $0194;
  1520.  
  1521.   mm_QueryDefaultItemId         = $0431;
  1522.   mm_SetDefaultItemId           = $0432;
  1523.  
  1524. function WinCreateMenu(Parent: HWnd; lpmt: Pointer): HWnd;
  1525.  
  1526. { Owner Item Structure (Also used for listboxes) }
  1527. type
  1528.   POwnerItem = ^OwnerItem;
  1529.   OwnerItem = record
  1530.     HWnd:           HWnd;
  1531.     Hps:            Hps;
  1532.     fsState:        ULong;
  1533.     fsAttribute:    ULong;
  1534.     fsStateOld:     ULong;
  1535.     fsAttributeOld: ULong;
  1536.     rclItem:        RectL;
  1537.     idItem:         Long;       { This field contains idItem for menus, iItem for lb. }
  1538.     hItem:          ULong;
  1539.   end;
  1540.  
  1541. { Menu item }
  1542.   PMenuItem = ^MenuItem;
  1543.   MenuItem = record
  1544.     iPosition:   SmallInt;
  1545.     afStyle:     SmallWord;
  1546.     afAttribute: SmallWord;
  1547.     id:          SmallWord;
  1548.     HWndSubMenu: HWnd;
  1549.     hItem:       ULong;
  1550.   end;
  1551.  
  1552. const
  1553.   mit_End                       = -1;
  1554.   mit_None                      = -1;
  1555.   mit_MemError                  = -1;
  1556.   mit_Error                     = -1;
  1557.   mit_First                     = -2;
  1558.   mit_Last                      = -3;
  1559.   mid_None                      = mit_None;
  1560.   mid_Error                     = -1;
  1561.  
  1562. { Menu item styles & attributes }
  1563.   mis_Text                      = $0001;
  1564.   mis_BitMap                    = $0002;
  1565.   mis_Separator                 = $0004;
  1566.   mis_OwnerDraw                 = $0008;
  1567.   mis_SubMenu                   = $0010;
  1568.   mis_MultMenu                  = $0020;        { multiple choice submenu }
  1569.   mis_SysCommand                = $0040;
  1570.   mis_Help                      = $0080;
  1571.   mis_Static                    = $0100;
  1572.   mis_ButtonSeparator           = $0200;
  1573.   mis_Break                     = $0400;
  1574.   mis_BreakSeparator            = $0800;
  1575.   mis_Group                     = $1000;        { multiple choice group start }
  1576. { In multiple choice submenus a style of 'single' denotes the item is a       }
  1577. { radiobutton. Absence of this style defaults the item to a checkbox.         }
  1578.   mis_Single                    = $2000;
  1579.  
  1580.   mia_NoDismiss                 = $0020;
  1581.   mia_Framed                    = $1000;
  1582.   mia_Checked                   = $2000;
  1583.   mia_Disabled                  = $4000;
  1584.   mia_Hilited                   = $8000;
  1585.  
  1586. function WinPopupMenu(Parent,Owner,Menu: HWnd; X,Y,IdItem: Long; fs: ULong): Bool;
  1587.  
  1588. { Values of fs in WinPopupMenu call }
  1589. const
  1590.   pu_PositionOnItem             = $0001; { Need idItem parameter }
  1591.   pu_HConstrain                 = $0002; { Keep menu on left and right edge }
  1592.   pu_VConstrain                 = $0004; { Keep menu on top and bottom edge }
  1593.   pu_None                       = $0000; { If invoked by keyboard }
  1594.   pu_MouseButton1Down           = $0008; { If invoked by button 1 }
  1595.   pu_MouseButton2Down           = $0010; { If invoked by button 2 }
  1596.   pu_MouseButton3Down           = $0018; { If invoked by button 3 }
  1597.   pu_SelectItem                 = $0020; { Set selected item (use with kbd) }
  1598.   pu_MouseButton1               = $0040; { If button1 use allowed }
  1599.   pu_MouseButton2               = $0080; { If button2 use allowed }
  1600.   pu_MouseButton3               = $0100; { If button3 use allowed }
  1601.   pu_Keyboard                   = $0200; { If keyboard use allowed}
  1602.  
  1603. { Useful macros }
  1604.  
  1605. function WinCheckMenuItem(hwndMenu : hwnd;id : ULong; fcheck : Bool) : Bool; inline;
  1606. begin
  1607.   WinCheckMenuItem := Bool(
  1608.           WinSendMsg( hwndMenu, MM_SETITEMATTR,
  1609.              id or (ord(true) shl 16),
  1610.              Word(MIA_CHECKED) or (Ord(fCheck)*MIA_CHECKED) shl 16 ));
  1611. end;
  1612.  
  1613. function WinIsMenuItemChecked(hwndMenu : hwnd;id : ULong) : Bool; inline;
  1614. begin
  1615.   WinIsMenuItemChecked := Bool(
  1616.           WinSendMsg( hwndMenu, MM_QUERYITEMATTR,
  1617.              id or (ord(true) shl 16), Long(MIA_CHECKED)));
  1618. end;
  1619.  
  1620. function WinEnableMenuItem(hwndMenu : hwnd;id : ULong; fEnable : Bool) : Bool; inline;
  1621. begin
  1622.   WinEnableMenuItem := Bool(
  1623.           WinSendMsg( hwndMenu, MM_SETITEMATTR,
  1624.              id or (ord(true) shl 16),
  1625.              Word(MIA_DISABLED) or (Ord(not fEnable)*MIA_DISABLED) shl 16 ));
  1626. end;
  1627.  
  1628. function WinIsMenuItemEnabled(hwndMenu : hwnd;id : ULong) : Bool; inline;
  1629. begin
  1630.   WinIsMenuItemEnabled := Bool(
  1631.           WinSendMsg( hwndMenu, MM_QUERYITEMATTR,
  1632.              id or (ord(true) shl 16), Long(MIA_DISABLED)));
  1633. end;
  1634.  
  1635. function WinSetMenuItemText( hwndMenu : hwnd; id: ULong; p : pChar) : Bool; inline;
  1636. begin
  1637.   WinSetMenuItemText := Bool(
  1638.           WinSendMsg( hwndMenu, MM_SETITEMTEXT, Id, Long( p ) ));
  1639. end;
  1640.  
  1641. function WinIsMenuItemValid( hwndMenu : hwnd; id: ULong) : Bool; inline;
  1642. begin
  1643.   WinIsMenuItemValid := Bool(
  1644.           WinSendMsg( hwndMenu, MM_ISITEMVALID,
  1645.              id or (ord(true) shl 16), Long( False )));
  1646. end;
  1647.  
  1648.  
  1649. Const
  1650. { Scroll Bar styles }
  1651.   sbs_Horz                      = 0;
  1652.   sbs_Vert                      = 1;
  1653.   sbs_ThumbSize                 = 2;
  1654.   sbs_AutoTrack                 = 4;
  1655.   sbs_AutoSize                  = $2000;
  1656.  
  1657. { Scroll Bar messages }
  1658.   sbm_SetScrollBar              = $01A0;
  1659.   sbm_SetPos                    = $01A1;
  1660.   sbm_QueryPos                  = $01A2;
  1661.   sbm_QueryRange                = $01A3;
  1662.   sbm_SetThumbSize              = $01A6;
  1663.  
  1664. { Scroll Bar Commands }
  1665.   sb_LineUp                     = 1;
  1666.   sb_LineDown                   = 2;
  1667.   sb_LineLeft                   = 1;
  1668.   sb_LineRight                  = 2;
  1669.   sb_PageUp                     = 3;
  1670.   sb_PageDown                   = 4;
  1671.   sb_PageLeft                   = 3;
  1672.   sb_PageRight                  = 4;
  1673.   sb_SliderTrack                = 5;
  1674.   sb_SliderPosition             = 6;
  1675.   sb_EndScroll                  = 7;
  1676.  
  1677. type
  1678.   PSbcData = ^SbcData;
  1679.   SbcData = record
  1680.     cb:       SmallWord;
  1681.     sHilite:  SmallWord;             { Reserved, should be set to zero }
  1682.     posFirst: SmallInt;
  1683.     posLast:  SmallInt;
  1684.     posThumb: SmallInt;
  1685.     cVisible: SmallInt;
  1686.     cTotal:   SmallInt;
  1687.   end;
  1688.  
  1689.   PFrameCData = ^FrameCData;
  1690.   FrameCData = record
  1691.     cb:            SmallWord;
  1692.     flCreateFlags: ULong;
  1693.     hmodResources: SmallWord;
  1694.     idResources:   SmallWord;
  1695.   end;
  1696.  
  1697. { Frame window styles }
  1698. { All unused fcf_xxx bits are reserved }
  1699. const
  1700.   fcf_TitleBar                  = $00000001;
  1701.   fcf_SysMenu                   = $00000002;
  1702.   fcf_Menu                      = $00000004;
  1703.   fcf_SizeBorder                = $00000008;
  1704.   fcf_MinButton                 = $00000010;
  1705.   fcf_MaxButton                 = $00000020;
  1706.   fcf_MinMax                    = $00000030; { MinMax means BOTH buttons }
  1707.   fcf_VertScroll                = $00000040;
  1708.   fcf_HorzScroll                = $00000080;
  1709.   fcf_DlgBorder                 = $00000100;
  1710.   fcf_Border                    = $00000200;
  1711.   fcf_ShellPosition             = $00000400;
  1712.   fcf_TaskList                  = $00000800;
  1713.   fcf_NoByteAlign               = $00001000;
  1714.   fcf_NoMoveWithOwner           = $00002000;
  1715.   fcf_Icon                      = $00004000;
  1716.   fcf_AccelTable                = $00008000;
  1717.   fcf_SysModal                  = $00010000;
  1718.   fcf_ScreenAlign               = $00020000;
  1719.   fcf_MouseAlign                = $00040000;
  1720.   fcf_HideButton                = $01000000;
  1721.   fcf_HideMax                   = $01000020; { HideMax means BOTH buttons }
  1722.   fcf_Dbe_AppStat               = $80000000;
  1723.   fcf_AutoIcon                  = $40000000;
  1724.  
  1725. { fcf_TitleBar or fcf_SysMenu or fcf_Menu or fcf_SizeBorder or fcf_MinMax or
  1726.   fcf_Icon or fcf_AccelTable or fcf_ShellPosition or fcf_TaskList }
  1727.   fcf_Standard                  = $0000CC3F;
  1728.  
  1729.   fs_Icon                       = $00000001;
  1730.   fs_AccelTable                 = $00000002;
  1731.   fs_ShellPosition              = $00000004;
  1732.   fs_TaskList                   = $00000008;
  1733.   fs_NoByteAlign                = $00000010;
  1734.   fs_NoMoveWithOwner            = $00000020;
  1735.   fs_SysModal                   = $00000040;
  1736.   fs_DlgBorder                  = $00000080;
  1737.   fs_Border                     = $00000100;
  1738.   fs_ScreenAlign                = $00000200;
  1739.   fs_MouseAlign                 = $00000400;
  1740.   fs_SizeBorder                 = $00000800;
  1741.   fs_AutoIcon                   = $00001000;
  1742.   fs_Dbe_AppStat                = $00008000;
  1743.  
  1744. { fs_Icon OR fs_AccelTable OR fs_ShellPosition OR fs_TaskList }
  1745.   fs_Standard                   = $0000000F;
  1746.  
  1747. { Frame Window Flags accessed via WinSet/QueryWindowUShort(qws_Flags) }
  1748.   ff_FlashWindow                = $0001;
  1749.   ff_Active                     = $0002;
  1750.   ff_FlashHilite                = $0004;
  1751.   ff_OwnerHidden                = $0008;
  1752.   ff_DlgDismissed               = $0010;
  1753.   ff_OwnerDisabled              = $0020;
  1754.   ff_Selected                   = $0040;
  1755.   ff_NoActivateSwp              = $0080;
  1756.  
  1757. function WinCreateStdWindow(Parent: HWnd; flStyle: ULong; var CreateFlags: ULong;
  1758.   ClientClass: PChar; Title: PChar; StyleClient: ULong; Module: HModule;
  1759.   IdResources: ULong; ClientWindow: pHWnd): HWnd;
  1760. function WinFlashWindow(Frame: HWnd; Flash: Bool): Bool;
  1761.  
  1762. { Frame window related messages }
  1763. const
  1764.   wm_FlashWindow                = $0040;
  1765.   wm_FormatFrame                = $0041;
  1766.   wm_UpdateFrame                = $0042;
  1767.   wm_FocusChange                = $0043;
  1768.   wm_SetBorderSize              = $0044;
  1769.   wm_TrackFrame                 = $0045;
  1770.   wm_MinMaxFrame                = $0046;
  1771.   wm_SetIcon                    = $0047;
  1772.   wm_QueryIcon                  = $0048;
  1773.   wm_SetAccelTable              = $0049;
  1774.   wm_QueryAccelTable            = $004A;
  1775.   wm_TranslateAccel             = $004B;
  1776.   wm_QueryTrackInfo             = $004C;
  1777.   wm_QueryBorderSize            = $004D;
  1778.   wm_NextMenu                   = $004E;
  1779.   wm_EraseBackground            = $004F;
  1780.   wm_QueryFrameInfo             = $0050;
  1781.   wm_QueryFocusChain            = $0051;
  1782.   wm_OwnerPosChange             = $0052;
  1783.   wm_CalcFrameRect              = $0053;
  1784. { Note $0054 is reserved }
  1785.   wm_WindowPosChanged           = $0055;
  1786.   wm_AdjustFramePos             = $0056;
  1787.   wm_QueryFrameCtlCount         = $0059;
  1788. { Note $005A is reserved }
  1789.   wm_QueryHelpInfo              = $005B;
  1790.   wm_SetHelpInfo                = $005C;
  1791.   wm_Error                      = $005D;
  1792.   wm_RealizePalette             = $005E;
  1793.  
  1794. { wm_QueryFrameInfo constants }
  1795.   fi_Frame                      = $00000001;
  1796.   fi_OwnerHide                  = $00000002;
  1797.   fi_ActivateOk                 = $00000004;
  1798.   fi_NoMoveWithOwner            = $00000008;
  1799.  
  1800. function WinCreateFrameControls(Frame: HWnd; var FCData: FrameCData; Title: PChar): Bool;
  1801. function WinCalcFrameRect(Frame: HWnd; var R: RectL; Client: Bool): Bool;
  1802. function WinGetMinPosition(Wnd: HWnd; var Swap: Swp; Point: PPointL): Bool;
  1803. function WinGetMaxPosition(Wnd: HWnd; var Swap: Swp): Bool;
  1804.  
  1805. type
  1806.   HSaveWp = LHandle;
  1807.  
  1808. function WinSaveWindowPos(SaveWp: HSaveWp; var Swap: Swp; Count: ULong): Bool;
  1809.  
  1810. { Frame control IDs    }
  1811. const
  1812.   fid_SysMenu                   = $8002;
  1813.   fid_TitleBar                  = $8003;
  1814.   fid_MinMax                    = $8004;
  1815.   fid_Menu                      = $8005;
  1816.   fid_VertScroll                = $8006;
  1817.   fid_HorzScroll                = $8007;
  1818.   fid_Client                    = $8008;
  1819. { Note $8009 is reserved }
  1820.   fid_Dbe_AppStat               = $8010;
  1821.   fid_Dbe_KbdStat               = $8011;
  1822.   fid_Dbe_Pecic                 = $8012;
  1823.   fid_Dbe_KkPopup               = $8013;
  1824.  
  1825. { Standard wm_SysCommand command values }
  1826.   sc_Size                       = $8000;
  1827.   sc_Move                       = $8001;
  1828.   sc_Minimize                   = $8002;
  1829.   sc_Maximize                   = $8003;
  1830.   sc_Close                      = $8004;
  1831.   sc_Next                       = $8005;
  1832.   sc_AppMenu                    = $8006;
  1833.   sc_SysMenu                    = $8007;
  1834.   sc_Restore                    = $8008;
  1835.   sc_NextFrame                  = $8009;
  1836.   sc_NextWindow                 = $8010;
  1837.   sc_TaskManager                = $8011;
  1838.   sc_HelpKeys                   = $8012;
  1839.   sc_HelpIndex                  = $8013;
  1840.   sc_HelpExtended               = $8014;
  1841.   sc_SwitchPanelIds             = $8015;
  1842.   sc_Dbe_First                  = $8018;
  1843.   sc_Dbe_Last                   = $801F;
  1844.   sc_BeginDrag                  = $8020;
  1845.   sc_EndDrag                    = $8021;
  1846.   sc_Select                     = $8022;
  1847.   sc_Open                       = $8023;
  1848.   sc_ContextMenu                = $8024;
  1849.   sc_ContextHelp                = $8025;
  1850.   sc_TextEdit                   = $8026;
  1851.   sc_BeginSelect                = $8027;
  1852.   sc_EndSelect                  = $8028;
  1853.   sc_Window                     = $8029;
  1854.   sc_Hide                       = $802A;
  1855.  
  1856. { Title bar control messages }
  1857.   tbm_SetHilite                 = $01E3;
  1858.   tbm_QueryHilite               = $01E4;
  1859.  
  1860. { Rectangle routines }
  1861.  
  1862. function WinCopyRect(AB: Hab; var Dest,Src: RectL): Bool;
  1863. function WinSetRect(AB: Hab; var R: RectL; xLeft,yBottom,xRight,yTop: Long): Bool;
  1864. function WinIsRectEmpty(AB: Hab; var R: RectL): Bool;
  1865. function WinEqualRect(AB: Hab; var R1,R2: RectL): Bool;
  1866. function WinSetRectEmpty(AB: Hab; var R: RectL): Bool;
  1867. function WinOffsetRect(AB: Hab; var R: RectL; cX,cY: Long): Bool;
  1868. function WinInflateRect(AB: Hab; var R: RectL; cX,cY: Long): Bool;
  1869. function WinPtInRect(AB: Hab; var R: RectL; var Point: PointL): Bool;
  1870. function WinIntersectRect(AB: Hab; var Dest,Src1,Src2: RectL): Bool;
  1871. function WinUnionRect(AB: Hab; var Dest,Src1,Src2: RectL): Bool;
  1872. function WinSubtractRect(AB: Hab; var Dest,Src1,Src2: RectL): Bool;
  1873. function WinMakeRect(AB: Hab; var R: RectL): Bool;
  1874. function WinMakePoints(AB: Hab; var Point: PointL; Count: ULong): Bool;
  1875.  
  1876. { System values }
  1877.  
  1878. function WinQuerySysValue(Desktop: HWnd; Index: Long): Long;
  1879. function WinSetSysValue(Desktop: HWnd; Index,Value: Long): Bool;
  1880.  
  1881. const
  1882.   sv_SwapButton                 = 0;
  1883.   sv_DblClkTime                 = 1;
  1884.   sv_CxDblClk                   = 2;
  1885.   sv_CyDblClk                   = 3;
  1886.   sv_CxSizeBorder               = 4;
  1887.   sv_CySizeBorder               = 5;
  1888.   sv_Alarm                      = 6;
  1889.   sv_ReservedFirst1             = 7;
  1890.   sv_ReservedLast1              = 8;
  1891.   sv_CursorRate                 = 9;
  1892.   sv_FirstScrollRate            = 10;
  1893.   sv_ScrollRate                 = 11;
  1894.   sv_NumberEdLists              = 12;
  1895.   sv_WarningFreq                = 13;
  1896.   sv_NoteFreq                   = 14;
  1897.   sv_ErrorFreq                  = 15;
  1898.   sv_WarningDuration            = 16;
  1899.   sv_NoteDuration               = 17;
  1900.   sv_ErrorDuration              = 18;
  1901.   sv_ReservedFirst              = 19;
  1902.   sv_ReservedLast               = 19;
  1903.   sv_CxScreen                   = 20;
  1904.   sv_CyScreen                   = 21;
  1905.   sv_CxVScroll                  = 22;
  1906.   sv_CyHScroll                  = 23;
  1907.   sv_CyVScrollArrow             = 24;
  1908.   sv_CxHScrollArrow             = 25;
  1909.   sv_CxBorder                   = 26;
  1910.   sv_CyBorder                   = 27;
  1911.   sv_CxDlgFrame                 = 28;
  1912.   sv_CyDlgFrame                 = 29;
  1913.   sv_CyTitleBar                 = 30;
  1914.   sv_CyVSlider                  = 31;
  1915.   sv_CxHSlider                  = 32;
  1916.   sv_CxMinMaxButton             = 33;
  1917.   sv_CyMinMaxButton             = 34;
  1918.   sv_CyMenu                     = 35;
  1919.   sv_CxFullScreen               = 36;
  1920.   sv_CyFullScreen               = 37;
  1921.   sv_CxIcon                     = 38;
  1922.   sv_CyIcon                     = 39;
  1923.   sv_CxPointer                  = 40;
  1924.   sv_CyPointer                  = 41;
  1925.   sv_Debug                      = 42;
  1926.   sv_CMouseButtons              = 43;
  1927.   sv_CPointerButtons            = 43;
  1928.   sv_PointerLevel               = 44;
  1929.   sv_CursorLevel                = 45;
  1930.   sv_TrackRectLevel             = 46;
  1931.   sv_CTimers                    = 47;
  1932.   sv_MousePresent               = 48;
  1933.   sv_CxByteAlign                = 49;
  1934.   sv_CxAlign                    = 49;
  1935.   sv_CyByteAlign                = 50;
  1936.   sv_CyAlign                    = 50;
  1937.  
  1938. { The following value enables any greater value to be set by WinSetSysVlaue. }
  1939. { Values of 51-55 are spare for extra non-settable system values             }
  1940. { This is to enable the setting of sv_ExtraKeyBeep by applications.          }
  1941.   sv_NotReserved                = 56;
  1942.   sv_ExtraKeyBeep               = 57;
  1943.  
  1944. { The following system value controls whether PM controls the keyboard      }
  1945. { lights for light key keystrokes (else applications will)                  }
  1946.   sv_SetLights                  = 58;
  1947.   sv_InsertMode                 = 59;
  1948.  
  1949.   sv_MenuRollDownDelay          = 64;
  1950.   sv_MenuRollUpDelay            = 65;
  1951.   sv_AltMnemonic                = 66;
  1952.   sv_TaskListMouseAccess        = 67;
  1953.  
  1954.   sv_CxIconTextWidth            = 68;
  1955.   sv_CIconTextLines             = 69;
  1956.  
  1957.   sv_ChordTime                  = 70;
  1958.   sv_CxChord                    = 71;
  1959.   sv_CyChord                    = 72;
  1960.   sv_CxMotion                   = 73;
  1961.   sv_CyMotion                   = 74;
  1962.  
  1963.   sv_BeginDrag                  = 75;
  1964.   sv_EndDrag                    = 76;
  1965.   sv_SingleSelect               = 77;
  1966.   sv_Open                       = 78;
  1967.   sv_ContextMenu                = 79;
  1968.   sv_ContextHelp                = 80;
  1969.   sv_TextEdit                   = 81;
  1970.   sv_BeginSelect                = 82;
  1971.   sv_EndSelect                  = 83;
  1972.  
  1973.   sv_BeginDragKb                = 84;
  1974.   sv_EndDragKb                  = 85;
  1975.   sv_SelectKb                   = 86;
  1976.   sv_OpenKb                     = 87;
  1977.   sv_ContextMenuKb              = 88;
  1978.   sv_ContextHelpKb              = 89;
  1979.   sv_TextEditKb                 = 90;
  1980.   sv_BeginSelectKb              = 91;
  1981.   sv_EndSelectKb                = 92;
  1982.  
  1983.   sv_Animation                  = 93;
  1984.   sv_AnimationSpeed             = 94;
  1985.  
  1986.   sv_MonoIcons                  = 95;
  1987.   sv_KbdAltered                 = 96;
  1988.   sv_PrintScreen                = 97;
  1989.   sv_CSysValues                 = 98;
  1990.  
  1991. { Presentation parameter structures }
  1992. type
  1993.   NpParam = ^Param;
  1994.   PParam = ^Param;
  1995.   Param = record
  1996.     id:   ULong;
  1997.     cb:   ULong;
  1998.     ab:   Byte;
  1999.   end;
  2000.  
  2001.   NpPresParams = ^PresParams;
  2002.   PPresParams = ^PresParams;
  2003.   PresParams = record
  2004.     cb:     ULong;
  2005.     aparam: Param;
  2006.   end;
  2007.  
  2008. { Presentation parameter APIs }
  2009.  
  2010. function WinSetPresParam(Wnd: HWnd; Id,cbParam: ULong; pbParam: Pointer): Bool;
  2011. function WinQueryPresParam(Wnd: HWnd; Id1,Id2: ULong; Id: PULong; cbBuf: ULong;
  2012.   pbBuf: Pointer; fs: ULong): ULong;
  2013. function WinRemovePresParam(Wnd: HWnd; Id: ULong): Bool;
  2014.  
  2015. { Presentation parameter types }
  2016. const
  2017.   pp_ForegroundColor            = 1;
  2018.   pp_ForegroundColorIndex       = 2;
  2019.   pp_BackgroundColor            = 3;
  2020.   pp_BackgroundColorIndex       = 4;
  2021.   pp_HiliteForegroundColor      = 5;
  2022.   pp_HiliteForegroundColorIndex = 6;
  2023.   pp_HiliteBackgroundColor      = 7;
  2024.   pp_HiliteBackgroundColorIndex = 8;
  2025.   pp_DisabledForegroundColor    = 9;
  2026.   pp_DisabledForegroundColorIndex = 10;
  2027.   pp_DisabledBackgroundColor    = 11;
  2028.   pp_DisabledBackgroundColorIndex = 12;
  2029.   pp_BorderColor                = 13;
  2030.   pp_BorderColorIndex           = 14;
  2031.   pp_FontNameSize               = 15;
  2032.   pp_FontHandle                 = 16;
  2033.   pp_Reserved                   = 17;
  2034.   pp_ActiveColor                = 18;
  2035.   pp_ActiveColorIndex           = 19;
  2036.   pp_InactiveColor              = 20;
  2037.   pp_InactiveColorIndex         = 21;
  2038.   pp_ActiveTextFgndColor        = 22;
  2039.   pp_ActiveTextFgndColorIndex   = 23;
  2040.   pp_ActiveTextBgndColor        = 24;
  2041.   pp_ActiveTextBgndColorIndex   = 25;
  2042.   pp_InactiveTextFgndColor      = 26;
  2043.   pp_InactiveTextFgndColorIndex = 27;
  2044.   pp_InactiveTextBgndColor      = 28;
  2045.   pp_InactiveTextBgndColorIndex = 29;
  2046.   pp_Shadow                     = 30;
  2047.   pp_MenuForegroundColor        = 31;
  2048.   pp_MenuForegroundColorIndex   = 32;
  2049.   pp_MenuBackgroundColor        = 33;
  2050.   pp_MenuBackgroundColorIndex   = 34;
  2051.   pp_MenuHiliteFgndColor        = 35;
  2052.   pp_MenuHiliteFgndColorIndex   = 36;
  2053.   pp_MenuHiliteBgndColor        = 37;
  2054.   pp_MenuHiliteBgndColorIndex   = 38;
  2055.   pp_MenuDisabledFgndColor      = 39;
  2056.   pp_MenuDisabledFgndColorIndex = 40;
  2057.   pp_MenuDisabledBgndColor      = 41;
  2058.   pp_MenuDisabledBgndColorIndex = 42;
  2059.  
  2060.   pp_User                       = $8000;
  2061.  
  2062. { Flags for WinQueryPresParams }
  2063.   qpf_NoInherit                 = $0001; { Don't inherit                      }
  2064.   qpf_Id1ColorIndex             = $0002; { Convert id1 color index into RGB   }
  2065.   qpf_Id2ColorIndex             = $0004; { Convert id2 color index into RGB   }
  2066.   qpf_PureRGBColor              = $0008; { Return pure RGB colors             }
  2067.   qpf_ValidFlags                = $000F; { Valid WinQueryPresParams flags     }
  2068.  
  2069. { System color functions }
  2070.  
  2071. function WinQuerySysColor(Desktop: HWnd; Color,Reserved: Long): Long;
  2072. function WinSetSysColors(Desktop: HWnd; Options,Format: ULong;
  2073.   FirstColor: Long; ColorCount: ULong; PColor: PLong): Bool;
  2074.  
  2075. const
  2076.   sysclr_ShadowHiliteBgnd       = -50;
  2077.   sysclr_ShadowHiliteFgnd       = -49;
  2078.   sysclr_ShadowText             = -48;
  2079.   sysclr_EntryField             = -47;
  2080.   sysclr_MenuDisabledText       = -46;
  2081.   sysclr_MenuHilite             = -45;
  2082.   sysclr_MenuHiliteBgnd         = -44;
  2083.   sysclr_PageBackground         = -43;
  2084.   sysclr_FieldBackground        = -42;
  2085.   sysclr_ButtonLight            = -41;
  2086.   sysclr_ButtonMiddle           = -40;
  2087.   sysclr_ButtonDark             = -39;
  2088.   sysclr_ButtonDefault          = -38;
  2089.   sysclr_TitleBottom            = -37;
  2090.   sysclr_Shadow                 = -36;
  2091.   sysclr_IconText               = -35;
  2092.   sysclr_DialogBackground       = -34;
  2093.   sysclr_HiliteForeground       = -33;
  2094.   sysclr_HiliteBackground       = -32;
  2095.   sysclr_InactiveTitleTextBgnd  = -31;
  2096.   sysclr_ActiveTitleTextBgnd    = -30;
  2097.   sysclr_InactiveTitleText      = -29;
  2098.   sysclr_ActiveTitleText        = -28;
  2099.   sysclr_OutputText             = -27;
  2100.   sysclr_WindowStaticText       = -26;
  2101.   sysclr_ScrollBar              = -25;
  2102.   sysclr_BackGround             = -24;
  2103.   sysclr_ActiveTitle            = -23;
  2104.   sysclr_InactiveTitle          = -22;
  2105.   sysclr_Menu                   = -21;
  2106.   sysclr_Window                 = -20;
  2107.   sysclr_WindowFrame            = -19;
  2108.   sysclr_MenuText               = -18;
  2109.   sysclr_WindowText             = -17;
  2110.   sysclr_TitleText              = -16;
  2111.   sysclr_ActiveBorder           = -15;
  2112.   sysclr_InactiveBorder         = -14;
  2113.   sysclr_AppWorkSpace           = -13;
  2114.   sysclr_HelpBackGround         = -12;
  2115.   sysclr_HelpText               = -11;
  2116.   sysclr_HelpHilite             = -10;
  2117.   sysclr_CSysColors             = 41;
  2118.  
  2119. { Timer manager }
  2120.  
  2121. function WinStartTimer(AB: Hab; Wnd: HWnd; IdTimer, Timeout: ULong): ULong;
  2122. function WinStopTimer(AB: Hab; Wnd: HWnd; IdTimer: ULong): Bool;
  2123. function WinGetCurrentTime(AB: Hab): ULong;
  2124.  
  2125. const
  2126.   tid_Cursor                    = $FFFF; { Reserved cursor timer ID              }
  2127.   tid_Scroll                    = $FFFE; { Reserved scrolling timer ID           }
  2128.   tid_FlashWindow               = $FFFD; { Reserved for window flashing timer ID }
  2129.   tid_UserMax                   = $7FFF; { Maximum user timer ID                 }
  2130.  
  2131. type
  2132.   HAccel = LHandle;
  2133.  
  2134. { Accelerator functions }
  2135. { Accel fs bits         }
  2136. { NOTE: the first six af_ code bits have the same value as their kc_ counterparts }
  2137. const
  2138.   af_Char                       = $0001;
  2139.   af_VirtualKey                 = $0002;
  2140.   af_ScanCode                   = $0004;
  2141.   af_Shift                      = $0008;
  2142.   af_Control                    = $0010;
  2143.   af_Alt                        = $0020;
  2144.   af_LoneKey                    = $0040;
  2145.   af_SysCommand                 = $0100;
  2146.   af_Help                       = $0200;
  2147.  
  2148. type
  2149.   PAccel = ^Accel;
  2150.   Accel = record
  2151.     fs:  SmallWord;
  2152.     Key: SmallWord;
  2153.     Cmd: SmallWord;
  2154.   end;
  2155.  
  2156.   PAccelTable = ^AccelTable;
  2157.   AccelTable = record
  2158.     cAccel: SmallWord;
  2159.     CodePage: SmallWord;
  2160.     aaccel: array[0..MaxInt] of Accel;
  2161.   end;
  2162.  
  2163. function WinLoadAccelTable(AB: Hab; Module: HModule; IdAccelTable: ULong): HAccel;
  2164. function WinCopyAccelTable(Acl: HAccel; AclTable: PAccelTable;
  2165.   cbCopyMax: ULong): ULong;
  2166. function WinCreateAccelTable(AB: Hab; var AclTable: AccelTable): HAccel;
  2167. function WinDestroyAccelTable(Acl: HAccel): Bool;
  2168. function WinTranslateAccel(AB: Hab; Wnd: HWnd; Acl: HAccel; var Msg: QMsg): Bool;
  2169. function WinSetAccelTable(AB: Hab; Acl: HAccel; Frame: HWnd): Bool;
  2170. function WinQueryAccelTable(AB: Hab; Frame: HWnd): HAccel;
  2171.  
  2172. { Extended Attribute Flags (Association Table) }
  2173. const
  2174.   eaf_DefaultOwner              = $0001;
  2175.   eaf_Unchangeable              = $0002;
  2176.   eaf_ReuseIcon                 = $0004;
  2177.  
  2178. { WinTrackRect information }
  2179. type
  2180.   PTrackInfo = ^TrackInfo;
  2181.   TrackInfo = record
  2182.     cxBorder:        Long;
  2183.     cyBorder:        Long;
  2184.     cxGrid:          Long;
  2185.     cyGrid:          Long;
  2186.     cxKeyboard:      Long;
  2187.     cyKeyboard:      Long;
  2188.     rclTrack:        RectL;
  2189.     rclBoundary:     RectL;
  2190.     ptlMinTrackSize: PointL;
  2191.     ptlMaxTrackSize: PointL;
  2192.     fs:              ULong;
  2193.   end;
  2194.  
  2195. function WinTrackRect(Wnd: HWnd; PS: Hps; var Info: TrackInfo): Bool;
  2196. function WinShowTrackRect(Wnd: HWnd; Show: Bool): Bool;
  2197.  
  2198. { WinTrackRect flags }
  2199. const
  2200.   tf_Left                       = $0001;
  2201.   tf_Top                        = $0002;
  2202.   tf_Right                      = $0004;
  2203.   tf_Bottom                     = $0008;
  2204.   { tf_Move = tf_Left or tf_Top or tf_Right or tf_Bottom }
  2205.   tf_Move                       = $000F;
  2206.  
  2207.   tf_SetPointerPos              = $0010;
  2208.   tf_Grid                       = $0020;
  2209.   tf_Standard                   = $0040;
  2210.   tf_AllInBoundary              = $0080;
  2211.   tf_ValidateTrackRect          = $0100;
  2212.   tf_PartInBoundary             = $0200;
  2213.  
  2214. { Clipboard Manager  }
  2215. { Clipboard messages }
  2216.   wm_RenderFmt                  = $0060;
  2217.   wm_RenderAllFmts              = $0061;
  2218.   wm_DestroyClipboard           = $0062;
  2219.   wm_PaintClipboard             = $0063;
  2220.   wm_SizeClipboard              = $0064;
  2221.   wm_HScrollClipboard           = $0065;
  2222.   wm_VScrollClipboard           = $0066;
  2223.   wm_DrawClipBoard              = $0067;
  2224.  
  2225. { Standard Clipboard formats }
  2226.   cf_Text                       = 1;
  2227.   cf_BitMap                     = 2;
  2228.   cf_DspText                    = 3;
  2229.   cf_DspBitMap                  = 4;
  2230.   cf_MetaFile                   = 5;
  2231.   cf_DspMetaFile                = 6;
  2232.   cf_Palette                    = 9;
  2233.  
  2234. { standard DDE and clipboard format stings }
  2235.   szfmt_Text                    = '1';
  2236.   szfmt_BitMap                  = '2';
  2237.   szfmt_DspText                 = '3';
  2238.   szfmt_DspBitMap               = '4';
  2239.   szfmt_MetaFile                = '5';
  2240.   szfmt_DspMetaFile             = '6';
  2241.   szfmt_Palette                 = '9';
  2242.   szfmt_Sylk                    = 'Sylk';
  2243.   szfmt_Dif                     = 'Dif';
  2244.   szfmt_Tiff                    = 'Tiff';
  2245.   szfmt_OemText                 = 'OemText';
  2246.   szfmt_Dib                     = 'Dib';
  2247.   szfmt_OwnerDisplay            = 'OwnerDisplay';
  2248.   szfmt_Link                    = 'Link';
  2249.   szfmt_MetaFilePict            = 'MetaFilePict';
  2250.   szfmt_DspMetaFilePict         = 'DspMetaFilePict';
  2251.   szfmt_CpText                  = 'Codepage Text';
  2252.   szddefmt_Rtf                  = 'Rich Text Format';
  2253.   szddefmt_PtrPict              = 'Printer_Picture';
  2254.  
  2255. type
  2256.   PMfp = ^Mfp;
  2257.   Mfp = record
  2258.     sizeBounds: PointL;   { metafile notional grid size      }
  2259.     sizeMM:     PointL;   { metafile size high metric units  }
  2260.     cbLength:   ULong;    { length of metafile data          }
  2261.     mapMode:    SmallWord;{ a PM metaflie map mode           }
  2262.     reserved:   SmallWord;
  2263.     abData:     Byte;     { metafile Data                    }
  2264.   end;
  2265.  
  2266.   PCpText = ^CpText;
  2267.   CpText = record
  2268.     idCountry:   SmallWord;
  2269.     usCodepage:  SmallWord;
  2270.     usLangID:    SmallWord;
  2271.     usSubLangID: SmallWord;
  2272.     abText:      Char;  { text string starts here          }
  2273.   end;
  2274.  
  2275. function WinSetClipbrdOwner(AB: Hab; Wnd: HWnd): Bool;
  2276. function WinSetClipbrdData(AB: Hab; Data,Fmt,rgfFmtInfo: ULong): Bool;
  2277. function WinQueryClipbrdData(AB: Hab; Fmt: ULong): ULong;
  2278. function WinQueryClipbrdFmtInfo(AB: Hab; Fmt: ULong; var FmtInfo: ULong): Bool;
  2279. function WinSetClipbrdViewer(AB: Hab; NewClipViewer: HWnd): Bool;
  2280.  
  2281. { WinSetClipbrdData flags }
  2282. const
  2283.   cfi_OwnerFree                 = $0001;
  2284.   cfi_OwnerDisplay              = $0002;
  2285.   cfi_Pointer                   = $0400;
  2286.   cfi_Handle                    = $0200;
  2287.  
  2288. function WinEnumClipbrdFmts(AB: Hab; Fmt: ULong): ULong;
  2289. function WinEmptyClipbrd(AB: Hab): Bool;
  2290. function WinOpenClipbrd(AB: Hab): Bool;
  2291. function WinCloseClipbrd(AB: Hab): Bool;
  2292. function WinQueryClipbrdOwner(AB: Hab): HWnd;
  2293. function WinQueryClipbrdViewer(AB: Hab): HWnd;
  2294.  
  2295. { Cursor manager common subsection }
  2296. function WinDestroyCursor(Wnd: HWnd): Bool;
  2297. function WinShowCursor(Wnd: HWnd; Show: Bool): Bool;
  2298. function WinCreateCursor(Wnd: HWnd; X,Y,cX,cY: Long; fs: ULong; Clip: PRectL): Bool;
  2299.  
  2300. { WinCreateCursor flags }
  2301. const
  2302.   cursor_Solid                  = $0000;
  2303.   cursor_HalfTone               = $0001;
  2304.   cursor_Frame                  = $0002;
  2305.   cursor_Flash                  = $0004;
  2306.   cursor_SetPos                 = $8000;
  2307.  
  2308. type
  2309.   PCursorInfo = ^CursorInfo;
  2310.   CursorInfo = record
  2311.     HWnd:    HWnd;
  2312.     x:       Long;
  2313.     y:       Long;
  2314.     cx:      Long;
  2315.     cy:      Long;
  2316.     fs:      ULong;
  2317.     rclClip: RectL;
  2318.   end;
  2319.  
  2320. function WinQueryCursorInfo(Desktop: HWnd; var CurInfo: CursorInfo): Bool;
  2321.  
  2322. { Pointer manager }
  2323.  
  2324. function WinSetPointer(Desktop: HWnd; PtrNew: HPointer): Bool;
  2325. function WinSetPointerOwner(Ptr: HPointer; Pid: Pid; Destroy: Bool): Bool;
  2326. function WinShowPointer(Desktop: HWnd; Show: Bool): Bool;
  2327. function WinLockPointerUpdate(Desktop: HWnd; hptrNew: HPointer; ulTimeInterval: ULong): Bool;
  2328. function WinQuerySysPointer(Desktop: HWnd; Index: Long; Load: Bool): HPointer;
  2329. function WinQuerySysPointerData(hwndDesktop: HWnd; iptr: ULong; var IconInfo: IconInfo): Bool;
  2330. function WinSetSysPointerData(Desktop: HWnd; iptr: ULong; IconInfo: PIconInfo): Bool;
  2331.  
  2332. { System pointers (NOTE: these are 1-based) }
  2333. const
  2334.   sptr_Arrow                    = 1;
  2335.   sptr_Text                     = 2;
  2336.   sptr_Wait                     = 3;
  2337.   sptr_Size                     = 4;
  2338.   sptr_Move                     = 5;
  2339.   sptr_Sizenwse                 = 6;
  2340.   sptr_Sizenesw                 = 7;
  2341.   sptr_Sizewe                   = 8;
  2342.   sptr_Sizens                   = 9;
  2343.   sptr_AppIcon                  = 10;
  2344.  
  2345.   sptr_IconInformation          = 11;
  2346.   sptr_IconQuestion             = 12;
  2347.   sptr_IconError                = 13;
  2348.   sptr_IconWarning              = 14;
  2349.   sptr_CPtr                     = 14;   { count loaded by pmwin }
  2350.  
  2351.   sptr_Illegal                  = 18;
  2352.   sptr_File                     = 19;
  2353.   sptr_Folder                   = 20;
  2354.   sptr_Multfile                 = 21;
  2355.   sptr_Program                  = 22;
  2356.  
  2357. { backward compatibility }
  2358.   sptr_HandIcon                 = sptr_IconError;
  2359.   sptr_QuesIcon                 = sptr_IconQuestion;
  2360.   sptr_BangIcon                 = sptr_IconWarning;
  2361.   sptr_NoteIcon                 = sptr_IconInformation;
  2362.  
  2363. function WinLoadPointer(Desktop: HWnd; Module: HModule; IdRes: ULong): HPointer;
  2364. function WinCreatePointer(Desktop: HWnd; hbmPointer: HBitMap; fPointer: Bool;
  2365.   xHotspot,yHotspot: Long): HPointer;
  2366. function WinSetPointerPos(Desktop: HWnd; X,Y: Long): Bool;
  2367. function WinDestroyPointer(Ptr: HPointer): Bool;
  2368. function WinQueryPointer(Desktop: HWnd): HPointer;
  2369. function WinQueryPointerPos(Desktop: HWnd; var Point: PointL): Bool;
  2370.  
  2371. type
  2372.   PPointerInfo = ^PointerInfo;
  2373.   PointerInfo = record
  2374.     fPointer:       ULong;
  2375.     xHotspot:       Long;
  2376.     yHotspot:       Long;
  2377.     hbmPointer:     HBitMap;
  2378.     hbmColor:       HBitMap;
  2379.     hbmMiniPointer: HBitMap;
  2380.     hbmMiniColor:   HBitMap;
  2381.   end;
  2382.  
  2383. function WinCreatePointerIndirect(Desktop: HWnd; var PtrInfo: PointerInfo): HPointer;
  2384. function WinQueryPointerInfo(Ptr: HPointer; var PtrInfo: PointerInfo): Bool;
  2385. function WinDrawPointer(PS: Hps; X,Y: Long; Ptr: HPointer; fs: ULong): Bool;
  2386.  
  2387. { WinDrawPointer() constants }
  2388. const
  2389.   dp_Normal                     = $0000;
  2390.   dp_Halftoned                  = $0001;
  2391.   dp_Inverted                   = $0002;
  2392.  
  2393. function WinGetSysBitmap(Desktop: HWnd; ibm: ULong): HBitMap;
  2394.  
  2395. { System bitmaps (NOTE: these are 1-based) }
  2396. const
  2397.   sbmp_Old_SysMenu              = 1;
  2398.   sbmp_Old_SbUpArrow            = 2;
  2399.   sbmp_Old_SbDnArrow            = 3;
  2400.   sbmp_Old_SbRgArrow            = 4;
  2401.   sbmp_Old_SbLfArrow            = 5;
  2402.   sbmp_MenuCheck                = 6;
  2403.   sbmp_Old_CheckBoxes           = 7;
  2404.   sbmp_BtnCorners               = 8;
  2405.   sbmp_Old_MinButton            = 9;
  2406.   sbmp_Old_MaxButton            = 10;
  2407.   sbmp_Old_RestoreButton        = 11;
  2408.   sbmp_Old_ChildSysMenu         = 12;
  2409.   sbmp_Drive                    = 15;
  2410.   sbmp_File                     = 16;
  2411.   sbmp_Folder                   = 17;
  2412.   sbmp_TreePlus                 = 18;
  2413.   sbmp_TreeMinus                = 19;
  2414.   sbmp_Program                  = 22;
  2415.   sbmp_MenuAttached             = 23;
  2416.   sbmp_SizeBox                  = 24;
  2417.   sbmp_SysMenu                  = 25;
  2418.   sbmp_MinButton                = 26;
  2419.   sbmp_MaxButton                = 27;
  2420.   sbmp_RestoreButton            = 28;
  2421.   sbmp_ChildSysMenu             = 29;
  2422.   sbmp_SysMenuDep               = 30;
  2423.   sbmp_MinButtonDep             = 31;
  2424.   sbmp_MaxButtonDep             = 32;
  2425.   sbmp_RestoreButtonDep         = 33;
  2426.   sbmp_ChildSysMenuDep          = 34;
  2427.   sbmp_SbUpArrow                = 35;
  2428.   sbmp_SbDnArrow                = 36;
  2429.   sbmp_SbLfArrow                = 37;
  2430.   sbmp_SbRgArrow                = 38;
  2431.   sbmp_SbUpArrowDep             = 39;
  2432.   sbmp_SbDnArrowDep             = 40;
  2433.   sbmp_SbLfArrowDep             = 41;
  2434.   sbmp_SbRgArrowDep             = 42;
  2435.   sbmp_SbUpArrowDis             = 43;
  2436.   sbmp_SbDnArrowDis             = 44;
  2437.   sbmp_SbLfArrowDis             = 45;
  2438.   sbmp_SbRgArrowDis             = 46;
  2439.   sbmp_ComBoDown                = 47;
  2440.   sbmp_CheckBoxes               = 48;
  2441.  
  2442. { Hook manager }
  2443.  
  2444. function WinSetHook(AB: Hab; Mq: Hmq; iHook: Long; HookFunc: PFn;
  2445.   Module: HModule): Bool;
  2446. function WinReleaseHook(AB: Hab; Mq: Hmq; iHook: Long; HookFunc: Pointer;
  2447.   Module: HModule): Bool;
  2448. function WinCallMsgFilter(AB: Hab; var Msg: QMsg; MsgF: ULong): Bool;
  2449.  
  2450. { Hook codes }
  2451. { 32-bit hook will receive Long parameters }
  2452. const
  2453.   hk_SendMsg                    = 0;
  2454.   { procedure SendMsgHook(AB: Hab;                      ** installer's hab
  2455.   *                       var Smh: SmhStruct;           ** p send msg struct
  2456.   *                       InterTask: Bool);             ** between threads }
  2457.  
  2458.   hk_Input                      = 1;
  2459.   { function InputHook(AB: Hab;                         ** installer's hab
  2460.   *                    var Msg: QMsg;                   ** p qmsg
  2461.   *                    fs: ULong): Bool;                ** remove/noremove }
  2462.  
  2463.   hk_MsgFilter                  = 2;
  2464.   { function MsgFilterHook(AB: Hab;                     ** installer's hab
  2465.   *                        var Msg: QMsgg,              ** p qmsg
  2466.   *                        Msgf: ULong): Bool;          ** filter flag }
  2467.  
  2468.   hk_JournalRecord              = 3;
  2469.   { procedure JournalRecordHook(AB: Hab;                ** installer's hab
  2470.   *                             var Msg: WMsg);         ** p qmsg }
  2471.  
  2472.   hk_JournalPlayBack            = 4;
  2473.   { function JournalPlaybackHook(AB: Hab;               **installer's hab
  2474.   *                           Skip: Bool fSkip,         ** skip messages
  2475.   *                           var Msg: QMsg): ULong;    ** p qmsg }
  2476.  
  2477.   hk_Help                       = 5;
  2478.   { function HelpHook(AB: Hab;                          ** installer's hab
  2479.   *                   Mode:  ULong;                     ** mode
  2480.   *                   Topic: ULong;                     ** main topic
  2481.   *                   SubTopic: ULong;                  ** sub topic
  2482.   *                   var Pos: RectL): Bool;            ** associated position }
  2483.   hk_Loader                     = 6;
  2484.   { function LoaderHook(AB: Hab;                        ** installer's hab
  2485.   *                     IdContext: Long;                ** who called hook
  2486.   *                     LibName: PChar;                 ** lib name string
  2487.   *                     var Lib: HLib;                  ** p to lib handle
  2488.   *                     ProcName: PChar;                ** procedure name
  2489.   *                     WndProc: FnWp): Bool;           ** window procedure }
  2490.  
  2491.   hk_RegisterUserMsg            = 7;
  2492.   { function RegisterUserHook(AB: Hab;                  ** installer's hab
  2493.   *                        Count: ULong;                ** entries in arRMP
  2494.   *                        arPMP: PULong;               ** RMP array
  2495.   *                        var Registered: Bool): Bool; ** msg parms already reg}
  2496.  
  2497.   hk_MsgControl                 = 8;
  2498.   { function MsgControlHook(AB: Hab;                    ** installer's hab
  2499.   *                        IdContext: Long;             ** who called hook
  2500.   *                        Wnd: HWnd;                   ** SEI window handle
  2501.   *                        ClassName: PChar;            ** window class name
  2502.   *                        MsgClass: ULong;             ** interested msg class **
  2503.   *                        IdControl: Long;             ** SMI_*
  2504.   *                        var Success: Bool): Bool;    ** mode already set}
  2505.  
  2506.   hk_PList_eEtry                = 9;
  2507.   { function ProgramListEntryHook(AB: Hab;              ** installer's hab
  2508.   *             var ProfileHookParams: PrfHookParms;    ** data
  2509.   *             var NoExecute: Bool): Bool;             ** cease hook processing}
  2510.  
  2511.   hk_PList_Exit                 = 10;
  2512.   { function ProgramListExitHook(AB: Hab;               ** installer's hab
  2513.   *         var ProfileHookParams: PrfHookParms): Bool; ** data}
  2514.  
  2515.   hk_FindWord                   = 11;
  2516.   { function FindWordHook(Codepage: ULong;              ** code page to use
  2517.   *                       Text: PChar;                  ** text to break
  2518.   *                       cb: ULong;                    ** maximum text size
  2519.   *                       ich: ULong;                   ** break 'near' here
  2520.   *                       pichStart: PULong;            ** where break began
  2521.   *                       pichEnd: PULong;              ** where break ended
  2522.   *                       pichNext: PULong): Bool;      ** where next word begin}
  2523.  
  2524.   hk_CodePageChanged            = 12;
  2525.   { procedure CodePageChangedHook(Mq: Hmq;              ** msg q handle
  2526.   *                               OldCodepage: ULong;   ** old code page
  2527.   *                               NewCodepage: ULong);  ** new code page}
  2528.  
  2529.   hk_WindowDC                   = 15;
  2530.   { function WindowDCHook(AB: Hab;                      ** installer's hab
  2531.   *                       Dc: Hdc;                      ** current Hdc
  2532.   *                       Wnd: HWnd;                    ** current HWnd
  2533.   *                       Assoc: Bool): Bool;           ** association flag}
  2534.  
  2535.   hk_DESTROYWINDOW              = 16;
  2536.   { function DestroyWindowHook(AB: Hab;                 ** installer's hab
  2537.   *                            Wnd: HWnd;               ** destroyed win HWnd
  2538.   *                            Reserved: ULong): Bool;  ** association flag}
  2539.   hk_CHECKMSGFILTER             = 20;
  2540.   { function CheckMsgFilteHook(AB: Hab;                 ** installer's hab
  2541.   *                            Msg: QMsg;               ** p qmsg
  2542.   *                            First,Last: ULong;       ** first and last msg
  2543.   *                            Options: ULong): Bool;   ** flags  }
  2544.  
  2545. { Current message queue constant }
  2546.   hmq_Current                   = Hmq(1);
  2547.  
  2548. { wh_MsgFilter context codes }
  2549.   msgf_DialogBox                = 1;
  2550.   msgf_MessageBox               = 2;
  2551.   msgf_Track                    = 8;
  2552.   msgf_DDepostMsg               = 3;
  2553.  
  2554. { hk_Help Help modes }
  2555.   hlpm_Frame                    = -1;
  2556.   hlpm_Window                   = -2;
  2557.   hlpm_Menu                     = -3;
  2558.  
  2559. { hk_SendMsg structure }
  2560.   pm_Model_1x                   = 0;
  2561.   pm_Model_2x                   = 1;
  2562.  
  2563. type
  2564.   PSmhStruct = ^SmhStruct;
  2565.   SmhStruct = record
  2566.     mp2:   MParam;
  2567.     mp1:   MParam;
  2568.     msg:   ULong;
  2569.     HWnd:  HWnd;
  2570.     model: ULong;
  2571.   end;
  2572.  
  2573. { hk_Loader context codes }
  2574. const
  2575.   lhk_DeleteProc                = 1;
  2576.   lhk_DeleteLib                 = 2;
  2577.   lhk_LoadProc                  = 3;
  2578.   lhk_LoadLib                   = 4;
  2579.  
  2580. { hk_MsgControl context codes }
  2581.   mchk_MsgInterest              = 1;
  2582.   mchk_ClassMsgInterest         = 2;
  2583.   mchk_Synchronisation          = 3;
  2584.   mchk_MsgMode                  = 4;
  2585.  
  2586. { hk_RegisterUserMsg conext codes }
  2587.   rumhk_DataType                = 1;
  2588.   rumhk_Msg                     = 2;
  2589.  
  2590. function WinSetClassThunkProc(ClassName: PChar; ThunkProc: PFn): Bool;
  2591. function WinQueryClassThunkProc(ClassName: PChar): PFn;
  2592. function WinSetWindowThunkProc(Wnd: HWnd; ThunkProc: PFn): Bool;
  2593. function WinQueryWindowThunkProc(Wnd: HWnd): PFn;
  2594. function WinQueryWindowModel(Wnd: HWnd): Long;
  2595.  
  2596. { Shell API is declared in the PmShl unit }
  2597.  
  2598. function WinQueryCp(Mq: Hmq): ULong;
  2599. function WinSetCp(Mq: Hmq; IdCodePage: ULong): Bool;
  2600. function WinQueryCpList(AB: Hab; ccpMax: ULong; PrgCp: PULong): ULong;
  2601. function WinCpTranslateString(AB: Hab; cpSrc: ULong; Src: PChar;
  2602.   cpDst: ULong; cchDestMax: ULong; Dest: PChar): Bool;
  2603. function WinCpTranslateChar(AB: Hab; cpSrc: ULong; Src: Char; cpDest: ULong): Char;
  2604. function WinUpper(AB: Hab; IdCp,IdCc: ULong; Str: PChar): ULong;
  2605. function WinUpperChar(AB: Hab; IdCp,IdCc: ULong; C: ULong): ULong;
  2606. function WinNextChar(AB: Hab; IdCp,IdCc: ULong; Str: PChar): PChar;
  2607. function WinPrevChar(AB: Hab; IdCp,IdCc: ULong; Start,Str: PChar): PChar;
  2608. function WinCompareStrings(AB: Hab; IdCp,IdCcc: ULong; Str1,Str2: PChar;
  2609.   Reserved: ULong): ULong;
  2610.  
  2611. const
  2612.   wcs_Error                     = 0;
  2613.   wcs_Eq                        = 1;
  2614.   wcs_Lt                        = 2;
  2615.   wcs_Gt                        = 3;
  2616.  
  2617. { Atom Manager Interface declarations }
  2618.  
  2619. type
  2620.   HAtomTbl = LHandle;
  2621.   Atom = ULong;
  2622.  
  2623. function WinQuerySystemAtomTable: HAtomTbl;
  2624. function WinCreateAtomTable(cbInitial,cBuckets: ULong): HAtomTbl;
  2625. function WinDestroyAtomTable(AtomTbl: HAtomTbl): HAtomTbl;
  2626. function WinAddAtom(AtomTbl: HAtomTbl; AtomName: PChar): Atom;
  2627. function WinFindAtom(AtomTbl: HAtomTbl; AtomName: Pchar): Atom;
  2628. function WinDeleteAtom(AtomTbl: HAtomTbl; Atom: Atom): Atom;
  2629. function WinQueryAtomUsage(AtomTbl: HAtomTbl; Atom: Atom): ULong;
  2630. function WinQueryAtomLength(AtomTbl: HAtomTbl; Atom: Atom): ULong;
  2631. function WinQueryAtomName(AtomTbl: HAtomTbl; Atom: Atom; Buffer: PChar;
  2632.   BufferMax: ULong): ULong;
  2633.  
  2634. { Error codes for debugging support                              }
  2635. { $1001 - $1021, $1034, $1036 - $1050 are reserved               }
  2636. const
  2637.   windbg_HWnd_Not_Destroyed     = $1022;
  2638.   windbg_HPtr_Not_Destroyed     = $1023;
  2639.   windbg_HAccel_Not_Destroyed   = $1024;
  2640.   windbg_HEnum_Not_Destroyed    = $1025;
  2641.   windbg_Visrgn_Sem_Busy        = $1026;
  2642.   windbg_User_Sem_Busy          = $1027;
  2643.   windbg_Dc_Cache_Busy          = $1028;
  2644.   windbg_Hook_Still_Installed   = $1029;
  2645.   windbg_Window_Still_Locked    = $102A;
  2646.   windbg_Updateps_Assertion_Fail = $102B;
  2647.   windbg_Sendmsg_Within_User_Sem = $102C;
  2648.   windbg_User_Sem_Not_Entered   = $102D;
  2649.   windbg_Proc_Not_Exported      = $102E;
  2650.   windbg_Bad_SendMsg_HWnd       = $102F;
  2651.   windbg_Abnormal_Exit          = $1030;
  2652.   windbg_Internal_Revision      = $1031;
  2653.   windbg_InitSystem_Failed      = $1032;
  2654.   windbg_HAtomTbl_Not_Destroyed = $1033;
  2655.   windbg_Window_Unlock_Wait     = $1035;
  2656.  
  2657. { Get/Set Error Information Interface declarations }
  2658. type
  2659.   PErrInfo = ^ErrInfo;
  2660.   ErrInfo = record
  2661.     cbFixedErrInfo: ULong;
  2662.     idError:        ErrorId;
  2663.     cDetailLevel:   ULong;
  2664.     offaoffszMsg:   ULong;
  2665.     offBinaryData:  ULong;
  2666.   end;
  2667.  
  2668. function WinGetLastError(AB: Hab): ErrorId;
  2669. function WinGetErrorInfo(AB: Hab): PErrInfo;
  2670. function WinFreeErrorInfo(var ErrInf: ErrInfo): Bool;
  2671. function WinSetErrorInfo(Err: ErrorId; Arguments: ULong): ErrorId;
  2672.  
  2673. { Important!: Original C declaration of this function is:            }
  2674. {             ERRORID APIENTRY WinSetErrorInfo(ERRORID, ULONG, ...); }
  2675. { Virtual Pascal doesn't support variable number of parameters, so   }
  2676. { the only issue is to call this function via special wrapper        }
  2677. { function written in the inline assembler.                          }
  2678.  
  2679. const
  2680.   sei_Breakpoint                = $8000; { Always enter an INT 3 breakpt       }
  2681.   sei_NoBeep                    = $4000; { Do not call DosBeep                 }
  2682.   sei_NoPrompt                  = $2000; { Do not prompt the user              }
  2683.   sei_DbgRsrvd                  = $1000; { Reserved for debug use              }
  2684.  
  2685.   sei_StackTrace                = $0001; { save the stack trace                }
  2686.   sei_Registers                 = $0002; { save the registers                  }
  2687.   sei_ArgCount                  = $0004; { first Word in args is arg count     }
  2688.   sei_DosError                  = $0008; { first Word in args is OS2 error code}
  2689.   sei_Reserved                  = $0FE0; { Reserved for future use             }
  2690.   sei_DebugOnly                 = sei_Breakpoint or sei_NoBeep or sei_NoPrompt or sei_Reserved;
  2691.  
  2692. { DDE standard system topic and item strings }
  2693.   szddesys_Topic                = 'System';
  2694.   szddesys_Item_Topics          = 'Topics';
  2695.   szddesys_Item_SysItems        = 'SysItems';
  2696.   szddesys_Item_RtnMsg          = 'ReturnMessage';
  2697.   szddesys_Item_Status          = 'Status';
  2698.   szddesys_Item_Formats         = 'Formats';
  2699.   szddesys_Item_Security        = 'Security';
  2700.   szddesys_Item_ItemFormats     = 'ItemFormats';
  2701.   szddesys_Item_Help            = 'Help';
  2702.   szddesys_Item_Protocols       = 'Protocols';
  2703.   szddesys_Item_Restart         = 'Restart';
  2704.  
  2705. { Dynamic Data Exchange (DDE) Structure Declarations }
  2706. type
  2707.   PConvContext = ^ConvContext;
  2708.   ConvContext = record
  2709.     cb:          ULong;         { SizeOf(ConvContext) }
  2710.     fsContext:   ULong;
  2711.     idCountry:   ULong;
  2712.     usCodepage:  ULong;
  2713.     usLangID:    ULong;
  2714.     usSubLangID: ULong;
  2715.   end;
  2716.  
  2717. const
  2718.   ddectxt_CaseSensitive         = $0001;
  2719.  
  2720. type
  2721.   PDdeInit = ^DdeInit;
  2722.   DdeInit = record
  2723.     cb:             ULong;      { SizeOf(DdeInit) }
  2724.     pszAppName:     PChar;
  2725.     pszTopic:       PChar;
  2726.     offConvContext: ULong;
  2727.   end;
  2728.  
  2729.   PDdeStruct = ^DdeStruct;
  2730.   DdeStruct = record
  2731.     cbData:        ULong;
  2732.     fsStatus:      SmallWord;
  2733.     usFormat:      SmallWord;
  2734.     offszItemName: SmallWord;
  2735.     offabData:     SmallWord;
  2736.   end;
  2737.  
  2738. { DDE constants for wStatus field }
  2739. const
  2740.   dde_Fack                      = $0001;
  2741.   dde_FBusy                     = $0002;
  2742.   dde_FNoData                   = $0004;
  2743.   dde_FackReq                   = $0008;
  2744.   dde_FResponse                 = $0010;
  2745.   dde_NotProcessed              = $0020;
  2746.   dde_FReserved                 = $00C0;
  2747.   dde_FAppStatus                = $FF00;
  2748.  
  2749. { old DDE public formats - new ones are cf_ constants }
  2750.   ddefmt_Text                   = $0001;
  2751.  
  2752. { Dynamic Data Exchange (DDE) Routines }
  2753.  
  2754. function WinDdeInitiate(Client: HWnd; AppName,TopicName: PChar;
  2755.   var Context: ConvContext): Bool;
  2756. function WinDdeRespond(Client,Server: HWnd; AppName,TopicName: PChar;
  2757.   var Context: ConvContext): MResult;
  2758. function WinDdePostMsg(ToWnd,FromWnd: HWnd;Wm: ULong; Dest: PDdeStruct;
  2759.   Options: ULong): Bool;
  2760.  
  2761. const
  2762.   ddepm_RETRY                   = $00000001;
  2763.   ddepm_NOFREE                  = $00000002;
  2764. { Dynamic Data Exchange (DDE) Messages }
  2765.   wm_Dde_First                  = $00A0;
  2766.   wm_Dde_Initiate               = $00A0;
  2767.   wm_Dde_Request                = $00A1;
  2768.   wm_Dde_Ack                    = $00A2;
  2769.   wm_Dde_Data                   = $00A3;
  2770.   wm_Dde_Advise                 = $00A4;
  2771.   wm_Dde_Unadvise               = $00A5;
  2772.   wm_Dde_Poke                   = $00A6;
  2773.   wm_Dde_Execute                = $00A7;
  2774.   wm_Dde_Terminate              = $00A8;
  2775.   wm_Dde_InitiateAck            = $00A9;
  2776.   wm_Dde_Last                   = $00AF;
  2777.  
  2778. { wm_DbcsFirst }
  2779.   wm_QueryConvertPos            = $00B0;
  2780.  
  2781. { Return values for wm_QueryConvertPos }
  2782.   qcp_Convert                   = $0001;
  2783.   qcp_NoConvert                 = $0000;
  2784.  
  2785. { Load/Delete Library/Procedure }
  2786.  
  2787. type
  2788.   PHLib = ^HLib;
  2789.   HLib = HModule;
  2790.  
  2791. function DDEs_pszItemName(pddes : Pointer) : pChar; inline;
  2792. begin
  2793.   DDEs_pszItemName := pChar(pddes)+PDDestruct(pddes)^.offszItemName;
  2794. end;
  2795.  
  2796. function DDEs_pabData(pddes : Pointer) : Pointer; inline;
  2797. begin
  2798.   DDEs_pabData := Pointer(pChar(pddes)+PDDestruct(pddes)^.offabData);
  2799. end;
  2800.  
  2801. function DDEi_pConvConText(pddei : pDDeInit) : pConvConText; inline;
  2802. begin
  2803.   DDEi_pConvConText := pConvConText(pChar(pddei)+pddei^.offConvContext);
  2804. end;
  2805.  
  2806. function WinDeleteProcedure(AB: Hab; WndProc: FnWp): Bool;
  2807. function WinDeleteLibrary(AB: Hab; LibHandle: HLib): Bool;
  2808. function WinLoadProcedure(AB: Hab; LibHandle: HLib; ProcName: PChar): Pointer;
  2809. function WinLoadLibrary(AB: Hab; LibName: PChar): HLib;
  2810.  
  2811. { Desktop API definitions }
  2812. type
  2813.   PDesktop = ^Desktop;
  2814.   Desktop = record
  2815.     cbSize:       ULong;
  2816.     hbm:          HBitMap;
  2817.     x:            Long;
  2818.     y:            Long;
  2819.     fl:           ULong;
  2820.     lTileCount:   Long;
  2821.     szFile: array [0..259] of Char;
  2822.   end;
  2823.  
  2824. function WinSetDesktopBkgnd(Desktop: HWnd; var DskNew: Desktop): HBitMap;
  2825. function WinQueryDesktopBkgnd(Desktop: HWnd; var Dsk: Desktop): Bool;
  2826.  
  2827. const
  2828.   sdt_Destroy                   = $0001;
  2829.   sdt_NoBkgnd                   = $0002;
  2830.   sdt_Tile                      = $0004;
  2831.   sdt_Scale                     = $0008;
  2832.   sdt_Pattern                   = $0010;
  2833.   sdt_Center                    = $0020;
  2834.   sdt_Retain                    = $0040;
  2835.   sdt_LoadFile                  = $0080;
  2836.  
  2837. { Palette Manager API definitions }
  2838.  
  2839. function WinRealizePalette(Wnd: HWnd; PS: Hps; var CClr: ULong): Long;
  2840.  
  2841. const
  2842.   str_DllName                   = 'keyremap';
  2843.   wm_DbcsFirst                  = $00B0;
  2844.   wm_DbcsLast                   = $00CF;
  2845.  
  2846. {----[ PMWP ]----}
  2847.  
  2848. { OS/2 Presentation Manager Workplace include file }
  2849.  
  2850. Type
  2851.   hObject = lHandle;
  2852.  
  2853. Const
  2854.   CCHMAXClass = 3; { Length of a classname }
  2855.   QC_First    = 0; { Codes for OA_QueryContent }
  2856.   QC_Next     = 1;
  2857.   QC_Last     = 2;
  2858.  
  2859. Const
  2860.   Location_Desktop = pChar($FFFF0001); { Current Desktop }
  2861.  
  2862. Type
  2863.   { An object's appearance (icon or bitmap or outline) }
  2864.  
  2865.   ObjectImage = record
  2866.     hptrObject: HPointer;
  2867.   end;
  2868.  
  2869.   PObjectImage = ^ObjectImage;
  2870.  
  2871.   { Class info structure returned by WinEnumObjectClasses }
  2872.  
  2873.   pObjClass = ^ObjClass;
  2874.   ObjClass = record
  2875.     pNext: pObjClass;           { Null for the last structure.. }
  2876.     pszClassName: PChar;        {  Class name }
  2877.     pszModName: PChar;          { Module name }
  2878.   end;
  2879.  
  2880.   { Workplace object management functions }
  2881.  
  2882. function WinRegisterObjectClass(pszClassName: PChar; pszModName: PChar): Boolean;
  2883. function WinDeregisterObjectClass(pszClassName: PChar): Boolean;
  2884. function WinReplaceObjectClass(pszOldClassName: PChar; pszNewClassName: PChar;
  2885.   fReplace: Boolean): Boolean;
  2886. function WinEnumObjectClasses(pObjClass: pObjClass; Var ulSize: ULong): Boolean;
  2887. function WinCreateObject(pszClassName: PChar; pszTitle: PChar;
  2888.   pszSetupString: PChar; pszLocation: PChar; ulFlags: ULong): HObject;
  2889.  
  2890. Const
  2891.   CO_FailIfExists    = 0;
  2892.   CO_ReplaceIfExists = 1;
  2893.   CO_UpdateIfExists  = 2;
  2894.  
  2895. function WinSetObjectData(hObject: HObject; pszSetupString: PChar): Boolean;
  2896. function WinDestroyObject(hObject: HObject): Boolean;
  2897. function WinQueryObject(pszObjectID: PChar): HObject;
  2898. function WinSaveObject(hObject: HObject; fAsync: Boolean): Boolean;
  2899.  
  2900. const
  2901.   Open_Unknown    = -1;
  2902.   Open_Default    =  0;
  2903.   Open_Contents   =  1;
  2904.   Open_Settings   =  2;
  2905.   Open_Help       =  3;
  2906.   Open_Running    =  4;
  2907.   Open_PromptDlg  =  5;
  2908.   Open_Palette    =  121;
  2909.  
  2910. function WinOpenObject(hObject: HObject; ulView: ULong; Flag: Boolean): Boolean;
  2911. function WinMoveObject(hObjectofObject: HObject; hObjectofDest: HObject;
  2912.   ulReserved: ULong): HObject;
  2913. function WinCopyObject(hObjectofObject: HObject; hObjectofDest: HObject;
  2914.   ulReserved: ULong): HObject;
  2915. function WinCreateShadow(hObjectofObject: HObject; hObjectofDest: HObject;
  2916.   ulReserved: ULong): HObject;
  2917. function WinQueryActiveDesktopPathname(pszPathName: PChar;  ulSize: ULong): Boolean;
  2918. function WinQueryObjectPath(hobject: HObject; pszPathName: PChar;
  2919.   ulSize: ULong): Boolean;
  2920. function WinRestartWPDServer(fState: Boolean): ApiRet;
  2921. function WinIsWPDServerReady: Boolean;
  2922. function WinRestartSOMDD(fState: Boolean): ApiRet;
  2923. function WinIsSOMDDReady: Boolean;
  2924.  
  2925.   { Object settings notebook page insertion structure }
  2926.  
  2927. Type
  2928.   PageInfo = record
  2929.     cb:                 ULong;
  2930.     hwndPage:           HWnd;
  2931.     pfnwp:              FnWP;
  2932.     resid:              ULong;
  2933.     pCreateParams:      Pointer;
  2934.     dlgid:              UShort;
  2935.     usPageStyleFlags:   UShort;
  2936.     usPageInsertFlags:  UShort;
  2937.     usSettingsFlags:    UShort;
  2938.     pszName:            PChar;
  2939.     idDefaultHelpPanel: UShort;
  2940.     usReserved2:        UShort;
  2941.     pszHelpLibraryName: PChar;
  2942.     pHelpSubtable:      pUShort; { PHelpSubTable }
  2943.     hmodHelpSubtable:   hModule;
  2944.     ulPageInsertId:     ULong;
  2945.   end;
  2946.  
  2947.   pPageInfo = ^PageInfo;
  2948.  
  2949. Const
  2950.   Settings_Page_Numbers = $01;
  2951.  
  2952.  
  2953.   { Utility apis }
  2954.  
  2955. Type
  2956.   IconPos = record
  2957.     ptlIcon: POINTL;                  { Location }
  2958.     szIdentity: Array[0..0] of Char;  { Object identity string }
  2959.   end;
  2960.   pIconPos = ^IconPos;
  2961.  
  2962. function WinSetFileIcon(pszFileName: PChar; pIcnInfo: PIconInfo): Boolean;
  2963. function WinSetFileIconN(pszFileName: PChar; pIcnInfo: pIconInfo;
  2964.   ulIconIndex: ULong): Boolean;
  2965. function WinFreeFileIcon(hptr: HPointer): Boolean;
  2966. function WinLoadFileIcon(pszFileName: PChar; fPrivate: Boolean): HPointer;
  2967. function WinLoadFileIconN(pszFileName: PChar; fPrivate: Boolean;
  2968.   ulIconIndex: ULong): HPointer;
  2969. function WinStoreWindowPos(pszAppName: PChar; pszKeyName: PChar;
  2970.   hwnd: HWnd): Boolean;
  2971. function WinRestoreWindowPos(pszAppName: PChar; pszKeyName: PChar;
  2972.   hwnd: HWnd): Boolean;
  2973. function WinShutdownSystem(hab: HAB; hmq: HMQ): Boolean;
  2974. function WinStretchPointer(PS: HPS; lx,ly,lcx,lcy: Long; hptrPointer: HPointer;
  2975.   ulHalfTone: ULong): Bool;
  2976.  
  2977. {----[ PMSPL ]----}
  2978.  
  2979. { OS/2 Presentation Manager Spooler constants, types and function declarations }
  2980.  
  2981. { Names of various OS2SYS.INI spooler variables }
  2982.  
  2983. Const
  2984.   Spl_Ini_Spooler      = 'PM_SPOOLER';
  2985.   Spl_Ini_Queue        = 'PM_SPOOLER_QUEUE';
  2986.   Spl_Ini_Printer      = 'PM_SPOOLER_PRINTER';
  2987.   Spl_Ini_PrinterDescr = 'PM_SPOOLER_PRINTER_DESCR';
  2988.   Spl_Ini_QueueDescr   = 'PM_SPOOLER_QUEUE_DESCR';
  2989.   Spl_Ini_QueueDD      = 'PM_SPOOLER_QUEUE_DD';
  2990.   Spl_Ini_QueueDDData  = 'PM_SPOOLER_QUEUE_DDDATA';
  2991.  
  2992.   { General SPL return values }
  2993.   Spl_Error = 0;
  2994.   Spl_OK = 1;
  2995.  
  2996. Type
  2997.   { Handle to a spool file }
  2998.   HSpl = lHandle;
  2999.  
  3000.   { Used in recording of PM_Q_STD data via SplStdxxx calls }
  3001.   HStd = lHandle;
  3002.   pHStd = ^HStd;
  3003.  
  3004.   { Spooler manager open data }
  3005.   qmOpenData  = PChar;
  3006.   PqmOpenData = PPChar;
  3007.  
  3008.   { Spooler Queue Processor interface }
  3009.  
  3010. Const
  3011.   { Control codes for SplQpControl }
  3012.   Splc_Abort                  = 1;
  3013.   Splc_Pause                  = 2;
  3014.   Splc_Continue               = 3;
  3015.  
  3016.   { flag defines for optional SplQpQueryFlags }
  3017.   { set this to allow spooler to bypass Queue Processor }
  3018.   { for PM_Q_RAW jobs. This allows print while a job }
  3019.   { is still spooling. }
  3020.   QP_Rawdata_Bypass           = $00000001;
  3021.  
  3022. Type
  3023.   { handle to a spooler queue processor }
  3024.   HProc = lHandle;
  3025.  
  3026.   { Spooler processor open data }
  3027.   PQPOpenData = PPChar;
  3028.  
  3029.   { Spooler Queue Processor interface }
  3030.   { API's exported by Queue Processor DLL's }
  3031.  
  3032. function SplQpOpen(cData: LongInt; pQPDataIn: PQPOpenData): HProc;
  3033. function SplQpPrint(hproc: HProc; pszFileName: PChar): Boolean;
  3034. function SplQpClose(hproc: HProc): Boolean;
  3035. function SplQpControl(hproc: HProc; cmdCode: LongInt): Boolean;
  3036. function SplQpQueryDt(pcDataType: PUlong; Var paszDataTypes: PChar): Boolean;
  3037. function SplQpInstall(hwnd: HWnd): Boolean;
  3038.  
  3039.   { The next API is optionally exported by Queue Processors }
  3040.   { The flags may be set to QP_RAWDATA_BYPASS to allow the }
  3041.   { spooler to print the job while spooling, bypassing this }
  3042.   { queue processor }
  3043.  
  3044. function SplQpQueryFlags(pulFlags: PULong): Boolean;
  3045.  
  3046.   { There are two definitions governing the QpOpen data block :-          }
  3047.   { 1) the original QPOPENDATA, which is used as                          }
  3048.   {    an array of PSZ and has a list of associated QPDat defines         }
  3049.   {    for accessing elements of the array. This has been extended        }
  3050.   {    from 6 to 12 elements. The last element is a numeric type          }
  3051.   {   and cannot satisfactorily be accessed via array indexing.           }
  3052.   {                                                                       }
  3053.   { 2) a new SQPOPENDATA structure (see below)                            }
  3054.   {                                                                       }
  3055.   { The old defn has been retained to support existing QProcs.            }
  3056.   {                                                                       }
  3057.  
  3058.   { Definition for elements within the PQPOPENDATA block }
  3059. Const
  3060.   QPDat_Address       = 0;
  3061.   QPDat_Driver_Name   = 1;
  3062.   QPDat_Driver_Data   = 2;
  3063.   QPDat_Data_Type     = 3;
  3064.   QPDat_Comment       = 4;
  3065.   QPDat_Proc_Params   = 5;
  3066.   QPDat_Spl_Params    = 6;  { SplQmOpen Spooler params }
  3067.   QPDat_Net_Params    = 7;  { SplQmOpen Network params }
  3068.   QPDat_Doc_Name      = 8;  { SplQmStartDoc name }
  3069.   QPDat_Queue_Name    = 9;  { Queue name for job }
  3070.   QPDat_Token         = 10; { SplQmOpen token name }
  3071.   QPDat_JobID         = 11; { SQM job identity }
  3072.  
  3073. Type
  3074.   PSQPOpenData = ^SQPOpenData;
  3075.   SQPOpenData = record
  3076.     pszLogAddress:    PChar;
  3077.     pszDriverName:    PChar;
  3078.     pdriv:            PDrivData;
  3079.     pszDataType:      PChar;
  3080.     pszComment:       PChar;
  3081.     pszProcParams:    PChar;
  3082.     pszSpoolParams:   PChar;
  3083.     pszNetworkParams: PChar;
  3084.     pszDocName:       PChar;
  3085.     pszQueueName:     PChar;
  3086.     pszToken:         PChar;
  3087.     idJobId:          UShort;
  3088.   end;
  3089.  
  3090.   { Error information and return codes }
  3091.  
  3092.   { Error information for SplMessageBox }
  3093. Const
  3094.   SplInfo_QPError       = $0001;
  3095.   SplInfo_DDError       = $0002;
  3096.   SplInfo_SplError      = $0004;
  3097.   SplInfo_OtherError    = $0080;
  3098.   SplInfo_Information   = $0100;
  3099.   SplInfo_Warning       = $0200;
  3100.   SplInfo_Error         = $0400;
  3101.   SplInfo_Severe        = $0800;
  3102.   SplInfo_UserIntReqD   = $1000;
  3103.  
  3104.   { Error Data for SplMessageBox }
  3105.   SplData_PrinterJam    = $0001;
  3106.   SplData_FormChgReqD   = $0002;
  3107.   SplData_CartChgReqD   = $0004;
  3108.   SplData_PenChgReqD    = $0008;
  3109.   SplData_DataError     = $0010;
  3110.   SplData_UnexpectError = $0020;
  3111.   SplData_Other         = $8000;
  3112.  
  3113.   { Return code for fSplStdQueryLength }
  3114.   SSql_Error = (-1);
  3115.  
  3116. Type
  3117.   SplErr = LongInt;
  3118.  
  3119.   { length for character arrays in structs (excluding zero terminator) }
  3120. Const
  3121.   CNLen = 15; { Computer name length }
  3122.   UNLen = 20; { Maximum user name length }
  3123.   QNLen = 12; { Queue name maximum length }
  3124.   PDLen = 8;  { Print destination length }
  3125.   DTLen = 9;  { Spool file data type }
  3126.   { e.g. PM_Q_STD,PM_Q_RAW }
  3127.  
  3128.   QP_DataType_Size      = 15; { returned by SplQpQueryDt }
  3129.   Driv_DeviceName_Size  = 31; { see DRIVDATA struc }
  3130.   Driv_Name_Size        = 8;  { name of device driver }
  3131.   PrinterName_Size      = 32; { max printer name length }
  3132.   FormName_Size         = 31; { max form name length }
  3133.   MaxCommentSz          = 48; { queue comment length }
  3134.  
  3135. Type
  3136.   pDriveProps = ^DrivProps;
  3137.   npDriveProps = ^DrivProps;
  3138.   DrivProps = record
  3139.     pszKeyName: PChar;
  3140.     cbBuf:          ULong;
  3141.     pBuf:           Pointer;
  3142.   end;
  3143.  
  3144.   pPrjInfo = ^PrjInfo;
  3145.   npPrjInfo = ^PrjInfo;
  3146.   PrjInfo = record
  3147.     uJobId:         UShort;
  3148.     szUserName:     Array[0..UNLen] of Char;
  3149.     pad_1:          Char;
  3150.     szNotifyName:   Array[0..CNLen] of Char;
  3151.     szDataType:     Array[0..DTLen] of Char;
  3152.     pszParms:       PChar;
  3153.     uPosition:      UShort;
  3154.     fsStatus:       UShort;
  3155.     pszStatus:      PChar;
  3156.     ulSubmitted:    ULong;
  3157.     ulSize:         ULong;
  3158.     pszComment:     PChar;
  3159.   end;
  3160.  
  3161.   pPrjInfo2 = ^PrjInfo2;
  3162.   npPrjInfo2 = ^PrjInfo2;
  3163.   PrjInfo2 = record
  3164.     uJobId:         UShort;
  3165.     uPriority:      UShort;
  3166.     pszUserName:    PChar;
  3167.     uPosition:      UShort;
  3168.     fsStatus:       UShort;
  3169.     ulSubmitted:    ULong;
  3170.     ulSize:         ULong;
  3171.     pszComment:     PChar;
  3172.     pszDocument:    PChar;
  3173.   end;
  3174.  
  3175.   pPrjInfo3 = ^PrjInfo3;
  3176.   npPrjInfo3 = ^PrjInfo3;
  3177.   PrjInfo3 = record
  3178.     uJobId:         UShort;
  3179.     uPriority:      UShort;
  3180.     pszUserName:    PChar;
  3181.     uPosition:      UShort;
  3182.     fsStatus:       UShort;
  3183.     ulSubmitted:    ULong;
  3184.     ulSize:         ULong;
  3185.     pszComment:     PChar;
  3186.     pszDocument:    PChar;
  3187.     pszNotifyName:  PChar;
  3188.     pszDataType:    PChar;
  3189.     pszParms:       PChar;
  3190.     pszStatus:      PChar;
  3191.     pszQueue:       PChar;
  3192.     pszQProcName:   PChar;
  3193.     pszQProcParms:  PChar;
  3194.     pszDriverName:  PChar;
  3195.     pDriverData:    PDrivData;
  3196.     pszPrinterName: PChar;
  3197.   end;
  3198.  
  3199.   pPrjInfo4 = ^PrjInfo4;
  3200.   npPrjInfo4 = ^PrjInfo4;
  3201.   PrjInfo4 = record
  3202.     uJobId:             UShort; // Spooler job ID
  3203.     uPriority:          UShort; // Print job priority
  3204.     pszUserName:        PChar;  // Name of job submitter
  3205.     uPosition:          UShort; // Job position in print queue
  3206.     fsStatus:           UShort; // Job status bits
  3207.     ulSubmitted:        ULong;  // Date and time of job submission
  3208.     ulSize:             ULong;  // Size of spooled job
  3209.     pszComment:         PChar;  // Job comment
  3210.     pszDocument:        PChar;  // Job document name
  3211.     pszSpoolFileName:   PChar;  // Path to spool file
  3212.     pszPortName:        PChar;  // Port on which job is printing
  3213.     pszStatus:          PChar;  // Job status string
  3214.     ulPagesSpooled:     ULong;
  3215.     ulPagesSent:        ULong;
  3216.     ulPagesPrinted:     ULong;
  3217.     ulTimePrinted:      ULong;
  3218.     ulExtendJobStatus:  ULong;
  3219.     ulStartPage:        ULong;
  3220.     ulEndPage:          ULong;
  3221.   end;
  3222.  
  3223.   pPrdInfo = ^PrdInfo;
  3224.   npPrdInfo = ^PrdInfo;
  3225.   PrdInfo = record
  3226.     szName:         Array[0..PDLen] of Char;
  3227.     szUserName:     Array[0..UNLen] of Char;
  3228.     uJobId:         UShort;
  3229.     fsStatus:       UShort;
  3230.     pszStatus:      PChar;
  3231.     time:           UShort;
  3232.   end;
  3233.  
  3234.   pPrdInfo3 = ^PrdInfo3;
  3235.   npPrdInfo3 = ^PrdInfo3;
  3236.   PrdInfo3 = record
  3237.     pszPrinterName: PChar;
  3238.     pszUserName:    PChar;
  3239.     pszLogAddr:     PChar;
  3240.     uJobId:         UShort;
  3241.     fsStatus:       UShort;
  3242.     pszStatus:      PChar;
  3243.     pszComment:     PChar;
  3244.     pszDrivers:     PChar;
  3245.     time:           UShort;
  3246.     usTimeOut:      UShort;
  3247.   end;
  3248.  
  3249.   pPrqInfo = ^PrqInfo;
  3250.   npPrqInfo = ^PrqInfo;
  3251.   PrqInfo = record
  3252.     szName:         Array[0..QNLen] of Char;
  3253.     pad_1:          Char;
  3254.     uPriority:      UShort;
  3255.     uStartTime:     UShort;
  3256.     uUntilTime:     UShort;
  3257.     pszSepFile:     PChar;
  3258.     pszPrProc:      PChar;
  3259.     pszDestinations: PChar;
  3260.     pszParms:       PChar;
  3261.     pszComment:     PChar;
  3262.     fsStatus:       UShort;
  3263.     cJobs:          UShort;
  3264.   end;
  3265.  
  3266.   pPrqInfo3 = ^PrqInfo3;
  3267.   npPrqInfo3 = ^PrqInfo3;
  3268.   PrqInfo3 = record
  3269.     pszName:        PChar;
  3270.     uPriority:      UShort;
  3271.     uStartTime:     UShort;
  3272.     uUntilTime:     UShort;
  3273.     fsType:         UShort;
  3274.     pszSepFile:     PChar;
  3275.     pszPrProc:      PChar;
  3276.     pszParms:       PChar;
  3277.     pszComment:     PChar;
  3278.     fsStatus:       UShort;
  3279.     cJobs:          UShort;
  3280.     pszPrinters:    PChar;
  3281.     pszDriverName:  PChar;
  3282.     pDriverData:    PDrivData;
  3283.   end;
  3284.  
  3285.   pPrqInfo6 = ^PrqInfo6;
  3286.   npPrqInfo6 = ^PrqInfo6;
  3287.   PrqInfo6 = record
  3288.     pszName:        PChar;
  3289.     uPriority:      UShort;
  3290.     uStartTime:     UShort;
  3291.     uUntilTime:     UShort;
  3292.     fsType:         UShort;
  3293.     pszSepFile:     PChar;
  3294.     pszPrProc:      PChar;
  3295.     pszParms:       PChar;
  3296.     pszComment:     PChar;
  3297.     fsStatus:       UShort;
  3298.     cJobs:          UShort;
  3299.     pszPrinters:    PChar;
  3300.     pszDriverName:  PChar;
  3301.     pDriverData:    PDrivData;
  3302.     pszRemoteComputerName: PChar;
  3303.     pszRemoteQueueName: PChar;
  3304.   end;
  3305.  
  3306.   { structure for DosPrintJobGetId }
  3307.  
  3308.   pPrIdInfi = ^PrIdInfo;
  3309.   npPrIdInfi = ^PrIdInfo;
  3310.   PrIdInfo = record
  3311.     uJobId:       UShort;
  3312.     szComputerName: Array[0..CnLen] of Char;
  3313.     szQueueName:  Array[0..QNLen] of Char;
  3314.     pad_1:        Char;
  3315.     end;
  3316.  
  3317.   { structure for DosPrintDriverEnum }
  3318.  
  3319.   pPrDrivInfo = ^PrDrivInfo;
  3320.   npPrDrivInfo = ^PrDrivInfo;
  3321.   PrDrivInfo = record
  3322.     szDrivName:   Array[0..Driv_Name_Size+1+Driv_DeviceName_Size] of Char;
  3323.   end;
  3324.  
  3325.   { structure for DosPrintQProcessorEnum }
  3326.  
  3327.   pPrQProcInfo = ^PrQProcInfo;
  3328.   npPrQProcInfo = ^PrQProcInfo;
  3329.   PrQProcInfo = record
  3330.     szQProcName: Array[0..QNLen] of Char;
  3331.   end;
  3332.  
  3333.   { structure for DosPrintPortEnum Level 0 }
  3334.  
  3335.   pPrPortInfo = ^PrPortInfo;
  3336.   npPrPortInfo = ^PrPortInfo;
  3337.   PrPortInfo = record
  3338.     szPortName: Array[0..PDLen] of Char;
  3339.   end;
  3340.  
  3341.   { structure for DosPrintPortEnum Level 1 }
  3342.  
  3343.   pPrPortInfo1 = ^PrPortInfo1;
  3344.   npPrPortInfo1 = ^PrPortInfo1;
  3345.   PrPortInfo1 = record
  3346.     pszPortName :   PChar;
  3347.     pszPortDriverName: Pchar;
  3348.     pszPortDriverPathName: Pchar;
  3349.   end;
  3350.  
  3351.   { Information about the current port settings; SplQueryPort and SplSetport }
  3352.  
  3353.   pPrPortInfo2 = ^PrPortInfo2;
  3354.   npPrPortInfo2 = ^PrPortInfo2;
  3355.   PrPortInfo2 = record
  3356.     pszPortName :         PChar;
  3357.     pszPortDriver:        Pchar;
  3358.     pszProtocolConverter: Pchar;
  3359.     ulReserved:           ULong; // Must be 0
  3360.     ulMode:               ULong;
  3361.     ulPriority:           ULong;
  3362.   end;
  3363.  
  3364.   { Information about a job being spooled, returned by SplQmGetJobID }
  3365.  
  3366.   pQMJobInfo = ^QMJobInfo;
  3367.   QMJobInfo = record
  3368.     ulJobID:         ULong;
  3369.     pszComputerName: PChar;
  3370.     pszQueueName:    PChar;
  3371.   end;
  3372.  
  3373.   { Values for parmnum in DosPrintQSetInfo/SplSetQueue }
  3374. Const
  3375.   PRQ_Priority_ParmNum        = 2;
  3376.   PRQ_StartTime_ParmNum       = 3;
  3377.   PRQ_UntilTime_ParmNum       = 4;
  3378.   PRQ_Separator_ParmNum       = 5;
  3379.   PRQ_Processor_ParmNum       = 6;
  3380.   PRQ_Destinations_ParmNum    = 7;
  3381.   PRQ_Parms_ParmNum           = 8;
  3382.   PRQ_Comment_ParmNum         = 9;
  3383.   PRQ_Type_ParmNum            = 10;
  3384.   PRQ_Printers_ParmNum        = 12;
  3385.   PRQ_DriverName_ParmNum      = 13;
  3386.   PRQ_DriverData_ParmNum      = 14;
  3387.   PRQ_Remote_Computer_ParmNum = 15;
  3388.   PRQ_Remote_Queue_ParmNum    = 16;
  3389.   PRQ_MaxParmnum              = 16;
  3390.  
  3391.   { Print Queue Priority }
  3392.   PRQ_Max_Priority            = 1; { highest priority }
  3393.   PRQ_Def_Priority            = 5;
  3394.   PRQ_Min_Priority            = 9; { lowest priority }
  3395.   PRQ_No_Priority             = 0;
  3396.  
  3397.   { Print queue status bitmask and values for level 1 }
  3398.   PRQ_Status_Mask             = 3;
  3399.   PRQ_Active                  = 0;
  3400.   PRQ_Paused                  = 1; { queue is held }
  3401.   PRQ_Error                   = 2;
  3402.   PRQ_Pending                 = 3; { pending deletion }
  3403.  
  3404.   { Print queue status bits for level 3 }
  3405.   PRQ3_Paused                 = $1; { queue is held }
  3406.   PRQ3_Pending                = $2; { pending deletion }
  3407.  
  3408.   { Print queue type bits for level 3 }
  3409.   PRQ3_Type_Raw               = $0001; { spools printer-specific data }
  3410.   PRQ3_Type_Bypass            = $0002; { allow print while spooling }
  3411.   PRQ3_Type_AppDefault        = $0004; { set for Application default Q }
  3412.  
  3413.   { Values for parmnum in DosPrintJobSetInfo/SplSetJob }
  3414.   PRJ_NotifyName_ParmNum      = 3;
  3415.   PRJ_DataType_ParmNum        = 4;
  3416.   PRJ_Parms_ParmNum           = 5;
  3417.   PRJ_Position_ParmNum        = 6;
  3418.   PRJ_JobFileInUse_ParmNum    = 7;
  3419.   PRJ_Comment_ParmNum         = 11;
  3420.   PRJ_Document_ParmNum        = 12;
  3421.   PRJ_StatusComment_ParmNum   = 13;
  3422.   PRJ_Priority_ParmNum        = 14;
  3423.   PRJ_ProcParms_ParmNum       = 16;
  3424.   PRJ_DriverData_ParmNum      = 18;
  3425.   PRJ_MaxParmNum              = 18;
  3426.  
  3427.   { Bitmap masks for status field of PRJINFO }
  3428.   { 2-7 bits also used in device status }
  3429.   PRJ_QStatus                 = $0003; { Bits 0,1 }
  3430.   PRJ_DevStatus               = $0ffc; { 2-11 bits }
  3431.   PRJ_Complete                = $0004; { Bit 2 }
  3432.   PRJ_Interv                  = $0008; { Bit 3 }
  3433.   PRJ_Error                   = $0010; { Bit 4 }
  3434.   PRJ_DestOffline             = $0020; { Bit 5 }
  3435.   PRJ_DestPaused              = $0040; { Bit 6 }
  3436.   PRJ_Notify                  = $0080; { Bit 7 }
  3437.   PRJ_DestNoPaper             = $0100; { Bit 8 }
  3438.   PRJ_DestFormChg             = $0200; { Bit 9 }
  3439.   PRJ_DestCrtChg              = $0400; { Bit 10 }
  3440.   PRJ_DestPenChg              = $0800; { Bit 11 }
  3441.   PRJ_JobFileInUse            = $4000; { Bit 14 }
  3442.   PRJ_Deleted                 = $8000; { Bit 15 }
  3443.  
  3444.   { Values of PRJ_Qstatus bits in fsStatus field of PRJINFO }
  3445.   PRJ_QS_Queued               = 0;
  3446.   PRJ_QS_Paused               = 1;
  3447.   PRJ_QS_Spooling             = 2;
  3448.   PRJ_QS_Printing             = 3;
  3449.  
  3450.   { Print Job Priority }
  3451.   PRJ_Max_Priority            = 99; { lowest priority }
  3452.   PRJ_Min_Priority            = 1; { highest priority }
  3453.   PRJ_No_Priority             = 0;
  3454.  
  3455.  
  3456.   { Bitmap masks for status field of PRDINFO }
  3457.   PRD_Status_Mask             = $0003; { Bits 0,1 }
  3458.   PRD_DevStatus               = $0ffc; { 2-11 bits }
  3459.  
  3460.   { Values of PRD_Status_Mask bits in fsStatus field of PRDINFO }
  3461.   PRD_Active                  = 0;
  3462.   PRD_Paused                  = 1;
  3463.  
  3464.   { Control codes used in DosPrintDestControl/SplControlDevice }
  3465.   PRD_Delete                  = 0;
  3466.   PRD_Pause                   = 1;
  3467.   PRD_Cont                    = 2;
  3468.   PRD_Restart                 = 3;
  3469.  
  3470.   { Values for parmnum in DosPrintDestSetInfo/SplSetDevice }
  3471.   PRD_LogAddr_ParmNum = 3;
  3472.   PRD_Comment_ParmNum = 7;
  3473.   PRD_Drivers_ParmNum = 8;
  3474.   PRD_Timeout_ParmNum = 10;
  3475.  
  3476.   { structure for SplEnumPrinter }
  3477.  
  3478. Type
  3479.   pPrinterInfo = ^PrinterInfo;
  3480.   PrinterInfo = record
  3481.     flType:                   ULong;
  3482.     pszComputerName:          PChar;
  3483.     pszPrintDestinationName:  PChar;
  3484.     pszDescription:           PChar;
  3485.     pszLocalName:             PChar;
  3486.   end;
  3487.  
  3488.   { Flags for flType in PRINTERINFO and SplEnumPrinter ************}
  3489. Const
  3490.   Spl_PR_Queue                = $00000001; { include queues }
  3491.   Spl_PR_Direct_Device        = $00000002; { unattached devices }
  3492.   Spl_PR_Queued_Device        = $00000004; { queued devices }
  3493.   Spl_PR_Local_Only           = $00000100; { exclude remote queues }
  3494.  
  3495. type
  3496.   pPortFromQ = ^PortFromQ;
  3497.   PortFromQ = record
  3498.     pszComputer:        PChar; // Name of computer on which port exists
  3499.     pszPort:            PChar; // Name of the port connected to the queue
  3500.     pszDeviceID:        PChar; // Device ID string returned by the printer
  3501.     flBidiCapabilities: ULong; // Printer capabilities
  3502.     flJobs:             ULong; // Job control flags
  3503.   end;
  3504.  
  3505. { Information about the ports connected to a specified queue }
  3506.   pGetPortFromQ = ^GetPortFromQ;
  3507.   GetPortFromQ = record
  3508.     ulPorts:   ULong;          // Number of ports connected to this queue
  3509.     PortFromQ: array[0..0] of PortFromQ;  // Array of ports connected to the queue
  3510.   end;
  3511.  
  3512.   { FUNCTION PROTOTYPES                                               }
  3513.   { In the case of the DosPrintxxx, the API is presented by new name  }
  3514.   { with the old name in parenthesis.                                 }
  3515.  
  3516. function SplQmOpen(pszToken: PChar; lCount: LongInt;
  3517.   Var qmdopData: QMOpenData): HSpl;
  3518. function SplQmStartDoc(HSpl: HSpl; pszDocName: PChar): Boolean;
  3519. function SplQmWrite(HSpl: HSpl; lCount: LongInt; Var Data): Boolean;
  3520. function SplQmEndDoc(HSpl: HSpl): ULong;
  3521. function SplQmClose(HSpl: HSpl): Boolean;
  3522. function SplQmAbort(HSpl: HSpl): Boolean;
  3523. function SplQmAbortDoc(HSpl: HSpl): Boolean;
  3524. function SplMessageBox(pszLogAddr: PChar; fErrInfo: ULong; fErrData: ULong;
  3525.   pszText: PChar; pszCaption: PChar; idWindow: ULong; fStyle: ULong): ULong;
  3526.  
  3527.   { Direct Device File System Interface }
  3528.  
  3529. function PrtOpen(pszDeviceName: PChar; phDevice: PHFile; Var ActionTaken: ULong;
  3530.   cbFileSize: ULong; uFileAttr: ULong; openFlag: ULong; openMode: ULong; reserved: ULong): ULong;
  3531. function PrtClose(hDevice: HFile): ULong;
  3532. function PrtWrite(hDevice: HFile; Var chData; cbData: ULong;
  3533.   pcbWritten: PULong): ULong;
  3534. function PrtDevIOCtl(pData: Pointer; pParms: Pointer; uFunction: ULong;
  3535.   uCategory: ULong; hDevice: HFile): ULong;
  3536. Procedure PrtAbort(hDevice: HFile);
  3537.  
  3538. function SplStdOpen(hdc: HDC): Boolean;
  3539. function SplStdClose(hdc: HDC): Boolean;
  3540. function SplStdStart(hdc: HDC): Boolean;
  3541. function SplStdStop(hdc: HDC): HStd;
  3542. function SplStdDelete(hMetaFile: HStd): Boolean;
  3543. function SplStdGetBits(hMetaFile: HStd; offData: LongInt; cbData: LongInt;
  3544.   pchData: PChar): Boolean;
  3545. function SplStdQueryLength(hMetaFile: HStd): LongInt;
  3546.  
  3547.   { SplCreateDevice(DosPrintDestAdd) }
  3548. function SplCreateDevice(pszComputerName: PChar; ulLevel: ULong; Var Buf;
  3549.   cbBuf: ULong): SplErr;
  3550.  
  3551.   { New in Warp: }
  3552. function SplQmGetJobID(Spl: HSpl; ulLevel: ULong;
  3553.   pBuf: Pointer; cbBuf: ULong; var cbNeeded: ULong): ULong;
  3554.  
  3555.   { New in Warp: }
  3556. function SplQmNewPage(Spl: HSpl; ulPageNumber: ULong): ULong;
  3557.  
  3558.   { New function in Warp: }
  3559. function SplCreatePort(pszComputerName: PChar; pszPortName: PChar;
  3560.   pszPortDriver: PChar; ulVersion: ULong; Var Buf; cbBuf: ULong): ULong;
  3561.  
  3562.   { New function in Warp: }
  3563. function SplDeletePort(pszComputerName: PChar; pszPortName: PChar): ULong;
  3564.  
  3565.   { New function in Warp: }
  3566. function SplQueryPort(pszComputerName: PChar; pszPortName: PChar;
  3567.   ulLevel: ULong; pBuf: Pointer; cbBuf: ULong; var cbNeeded: ULong): ULong;
  3568.  
  3569.   { New function in Warp: }
  3570. function SplSetPort(pszComputerName: PChar; pszPortName: PChar;
  3571.   ulLevel: PChar; pBuf: Pointer; cbBuf: ULong; ulParmNum: ULong): ULong;
  3572.  
  3573.   { New function in Warp: }
  3574. function SplDisable(pszComputerName: PChar; pReserved: Pointer): ULong;
  3575.  
  3576.   { New function in Warp: }
  3577. function SplRegister(pszComputerName: PChar; pszName: PChar;
  3578.   hwndNotify: HWnd; ulCategory: ULong; ulType: ULong;
  3579.   var ulHandle: ULong): ULong;
  3580.  
  3581.   { New function in Warp: }
  3582. function SplUnRegister(pszComputerName: PChar; pszName: PChar;
  3583.   ulHandle: ULong; ulCategory: ULong; ulType: ULong): ULong;
  3584.  
  3585.   { New function in Warp: }
  3586. function SplRegisterControlPanel(pszName: PChar; pszDllPath: PChar;
  3587.   ulFlags: ULong; pszReserved: Pointer; ulVersion: ULong): ULong;
  3588.  
  3589.   { New function in Warp: }
  3590. function SplQueryPath(pszComputerName: PChar;
  3591.   pszRemoteQueueName: PChar; ulLevel: ULong; pBuf: Pointer;
  3592.   cbBuf: ULong; var cbNeeded: ULong): ULong;
  3593.  
  3594.   { New function in Warp: }
  3595. function SplDisplayControlPanel(pszComputerName: PChar;
  3596.   pszPortName: PChar; pszDeviceID: PChar; pszControlPanel: PChar;
  3597.   AB: Hab; Flags: ULong): ULong;
  3598.  
  3599.   { New function in Warp: }
  3600. function SplGetControlPanelList(pszComputerName: PChar;
  3601.   pszPortName: PChar; pszDeviceID: PChar;
  3602.   flCapabilities: PChar; pszListOfPanels: PChar;
  3603.   cbBuf: ULong; var cbNeeded: ULong): ULong;
  3604.  
  3605.   { New function in Warp: }
  3606. function SplQueryControlPanel(pszComputerName: PChar;
  3607.   pszPortName: PChar; pszDeviceID: PChar;
  3608.   pszControlPanel: PChar; flCapabilities: ULong;
  3609.   var ulOptions: ULong): ULong;
  3610.  
  3611.   { New function in Warp: }
  3612. function SplGetPortFromQ(pszComputerName: PChar;
  3613.   pszQueueName: PChar; ulLevel: PChar; var Buf;
  3614.   cbBuf: ULong; var cbNeeded: ULong): ULong;
  3615.   { SplControlDevice(DosPrintDestControl) }
  3616. function SplControlDevice(pszComputerName: PChar; pszPortName: PChar;
  3617.   ulControl: ULong): SplErr;
  3618.  
  3619.   { SplDeleteDevice(DosPrintDestDel) }
  3620. function SplDeleteDevice(pszComputerName: PChar; pszPrintDeviceName: PChar): SplErr;
  3621.  
  3622.   { SplEnumDevice(DosPrintDestEnum) }
  3623. function SplEnumDevice(pszComputerName: PChar; ulLevel: ULong; Var Buf;
  3624.   cbBuf: ULong; Var cReturned: ULong; Var cTotal: ULong; Var cbNeeded: ULong;
  3625.   pReserved: Pointer): SplErr;
  3626.  
  3627.   { SplQueryDevice(DosPrintDestGetInfo) }
  3628. function SplQueryDevice(pszComputerName: PChar; pszPrintDeviceName: PChar;
  3629.   ulLevel: ULong; Var Buf; cbBuf: ULong; Var cbNeeded: ULong): SplErr;
  3630.  
  3631.   { SplSetDevice(DosPrintDestSetInfo) }
  3632. function SplSetDevice(pszComputerName: PChar; pszPrintDeviceName: PChar;
  3633.   ulLevel: ULong; Var Buf; cbBuf: ULong; ulParmNum: ULong): SplErr;
  3634.  
  3635.   { SplReleaseJob(DosPrintJobContinue) }
  3636. function SplReleaseJob(pszComputerName: PChar; pszQueueName: PChar;
  3637.   ulJob: ULong): SplErr;
  3638.  
  3639.   { SplDeleteJob(DosPrintJobDel) }
  3640. function SplDeleteJob(pszComputerName: PChar; pszQueueName: PChar;
  3641.   ulJob: ULong): SplErr;
  3642.  
  3643.   { SplEnumJob(DosPrintJobEnum) }
  3644. function SplEnumJob(pszComputerName: PChar; pszQueueName: PChar;
  3645.   ulLevel: ULong; Var Buf; cbBuf: ULong; Var cReturned: ULong;
  3646.   Var cTotal: ULong; Var cbNeeded: ULong; pReserved: Pointer): SplErr;
  3647.  
  3648.   { See above for change to PRIDINFO datatype for this API }
  3649.   { SplQueryJob(DosPrintJobGetInfo) }
  3650. function SplQueryJob(pszComputerName: PChar; pszQueueName: PChar;
  3651.   ulJob: ULong; ulLevel: ULong; Var Buf; cbBuf: ULong; Var cbNeeded: ULong): SplErr;
  3652.  
  3653.   { SplHoldJob(DosPrintJobPause) }
  3654. function SplHoldJob(pszComputerName: PChar; pszQueueName: PChar;
  3655.   ulJob: ULong): SplErr;
  3656.  
  3657.   { SplSetJob(DosPrintJobSetInfo)}
  3658. function SplSetJob(pszComputerName: PChar; pszQueueName: PChar;
  3659.   ulJob: ULong; ulLevel: ULong; Var Buf; cbBuf: ULong; ulParmNum: ULong): SplErr;
  3660.  
  3661.   { SplCreateQueue(DosPrintQAdd) }
  3662. function SplCreateQueue(pszComputerName: PChar; ulLevel: ULong;
  3663.   Var Buf; cbBuf: ULong): SplErr;
  3664.  
  3665.   { SplReleaseQueue(DosPrintQContinue) }
  3666. function SplReleaseQueue(pszComputerName: PChar; pszQueueName: PChar): SplErr;
  3667.  
  3668.   { SplDeleteQueue(DosPrintQDel) }
  3669. function SplDeleteQueue(pszComputerName: PChar; pszQueueName: PChar): SplErr;
  3670.  
  3671.   { SplEnumQueue(DosPrintQEnum) }
  3672. function SplEnumQueue(pszComputerName: PChar; ulLevel: ULong; pBuf : Pointer;
  3673.   cbBuf: ULong; Var cReturned: ULong; Var cTotal: ULong; Var cbNeeded: ULong;
  3674.   pReserved: Pointer): SplErr;
  3675.  
  3676.   { SplQueryQueue(DosPrintQGetInfo) }
  3677. function SplQueryQueue(pszComputerName: PChar; pszQueueName: PChar;
  3678.   ulLevel: ULong; Var Buf; cbBuf: ULong; Var cbNeeded: ULong): SplErr;
  3679.  
  3680.   { SplHoldQueue(DosPrintQPause) }
  3681. function SplHoldQueue(pszComputerName: PChar; pszQueueName: PChar): SplErr;
  3682.  
  3683.   { SplPurgeQueue(DosPrintQPurge) }
  3684. function SplPurgeQueue(pszComputerName: PChar; pszQueueName: PChar): SplErr;
  3685.  
  3686.   { SplSetQueue(DosPrintQSetInfo) }
  3687. function SplSetQueue(pszComputerName: PChar; pszQueueName: PChar;
  3688.   ulLevel: ULong; Var Buf; cbBuf: ULong; ulParmNum: ULong): SplErr;
  3689.  
  3690.   { SplEnumDriver(DosPrintDriverEnum) }
  3691. function SplEnumDriver(pszComputerName: PChar; ulLevel: ULong; Var Buf;
  3692.   cbBuf: ULong; Var cReturned: ULong; Var cTotal: ULong; Var cbNeeded: ULong;
  3693.   pReserved: Pointer): SplErr;
  3694.  
  3695.   { SplEnumPort(DosPrintPortEnum) }
  3696. function SplEnumPort(pszComputerName: PChar; ulLevel: ULong; Var Buf;
  3697.   cbBuf: ULong; Var cReturned: ULong; Var cTotal: ULong; Var cbNeeded: ULong;
  3698.   pReserved: Pointer): SplErr;
  3699.  
  3700.   { SplEnumQueueProcessor(DosPrintQProcessorEnum) }
  3701. function SplEnumQueueProcessor(pszComputerName: PChar; ulLevel: ULong;
  3702.   Var Buf; cbBuf: ULong; Var cReturned: ULong; Var cTotal: ULong;
  3703.   Var cbNeeded: ULong; pReserved: Pointer): SplErr;
  3704.  
  3705. function SplEnumPrinter(pszComputerName: PChar; uLevel: ULong; flType: ULong;
  3706.   Var Buf; cbbuf: ULong; Var cReturned: ULong; Var cTotal: ULong;
  3707.   Var cbNeeded: ULong; pReserved: Pointer): SplErr;
  3708. function SplCopyJob(pszSrcComputerName: PChar; pszSrcQueueName: PChar;
  3709.   ulSrcJob: ULong; pszTrgComputerName: PChar; pszTrgQueueName: PChar;
  3710.   Var ulTrgJob: ULong): SplErr;
  3711.  
  3712. {----[ PMMLE ]----}
  3713.  
  3714. const
  3715. { MLE Window styles ( in addition to ws_* ) }
  3716.   mls_WordWrap                  = $00000001;
  3717.   mls_Border                    = $00000002;
  3718.   mls_VScroll                   = $00000004;
  3719.   mls_HScroll                   = $00000008;
  3720.   mls_ReadOnly                  = $00000010;
  3721.   mls_IgnoreTab                 = $00000020;
  3722.   mls_DisableUndo               = $00000040;
  3723.  
  3724. { MLE External Data Types }
  3725. type
  3726.   IPt = Long;                   { insertion point }
  3727.   PIpt = ^Ipt;
  3728.   Pix  = Long;                  { pixel           }
  3729.   Line =  ULong;                { Line number     }
  3730.  
  3731.   PMleFormatRect = ^MleFormatRect;
  3732.   MleFormatRect = record
  3733.      cxFormat: Long;            { format rectangle width  }
  3734.      cyFormat: Long;            { format rectangle height }
  3735.   end;
  3736.  
  3737.   PMleCtlData = ^MleCtlData;
  3738.   MleCtlData = record
  3739.     cbCtlData:     SmallWord;   { Length of the MLECTLDATA structure  }
  3740.     afIEFormat:    SmallWord;   { import/export format                }
  3741.     cchText:       ULong;       { text limit                          }
  3742.     iptAnchor:     IPt;         { beginning of selection              }
  3743.     iptCursor:     IPt;         { ending of selection                 }
  3744.     cxFormat:      Long;        { format rectangle width              }
  3745.     cyFormat:      Long;        { format rectangle height             }
  3746.     afFormatFlags: ULong;       { formatting rectangle flags          }
  3747.   end;
  3748.  
  3749. { afFormatFlags mask }
  3750. const
  3751.   mlffmtrect_LimitHorz          = $00000001;
  3752.   mlffmtrect_LimitVert          = $00000002;
  3753.   mlffmtrect_MatchWindow        = $00000004;
  3754.   mlffmtrect_FormatRect         = $00000007;
  3755. { afIEFormat - Import/Export Format flags }
  3756.   mlfie_CfText                  = 0;
  3757.   mlfie_NoTrans                 = 1;
  3758.   mlfie_WinFmt                  = 2;
  3759.   mlfie_Rtf                     = 3;
  3760.  
  3761. type
  3762.   POverflow = ^MleOverflow;
  3763.   MleOverflow = record
  3764.     afErrInd:    ULong;         { see mask below                         }
  3765.     nBytesOver:  Long;          { number of bytes overflowed             }
  3766.     pixHorzOver: Long;          { number of pixels horizontally overflow }
  3767.     pixVertOver: Long;          { number of pixels vertically overflowed }
  3768.   end;
  3769.  
  3770. { afErrInd - error format rectangle flags }
  3771. const
  3772.   mlfefr_Resize                 = $00000001;
  3773.   mlfefr_TabStop                = $00000002;
  3774.   mlfefr_Font                   = $00000004;
  3775.   mlfefr_Text                   = $00000008;
  3776.   mlfefr_WordWrap               = $00000010;
  3777.   mlfetl_TextBytes              = $00000020;
  3778.  
  3779. type
  3780.   PMargStruct = ^MleMargStruct;
  3781.   MleMargStruct = record
  3782.     afMargins:   SmallWord;     { margin indicator }
  3783.     usMouMsg:    SmallWord;     { mouse message    }
  3784.     iptNear:     IPt;           { the geometrically nearest insertion point }
  3785.   end;
  3786.  
  3787. { afFlags - margin notification indicators }
  3788. const
  3789.   mlfmargin_Left                = $0001;
  3790.   mlfmargin_Bottom              = $0002;
  3791.   mlfmargin_Right               = $0003;
  3792.   mlfmargin_Top                 = $0004;
  3793.  
  3794. { mlm_QuerySelection flags }
  3795.   mlfqs_MinMaxSel               = 0;
  3796.   mlfqs_MinSel                  = 1;
  3797.   mlfqs_MaxSel                  = 2;
  3798.   mlfqs_AnchorSel               = 3;
  3799.   mlfqs_CursorSel               = 4;
  3800.  
  3801. { mln_ClpbdFail flags }
  3802.   mlfclpbd_TooMuchText          = $00000001;
  3803.   mlfclpbd_Error                = $00000002;
  3804.  
  3805. type
  3806.   PMle_SearchData = ^Mle_SearchData;
  3807.   Mle_SearchData = record
  3808.     cb:           SmallWord;  { size of search spec structure       }
  3809.     pchFind:      PChar;      { string to search for                }
  3810.     pchReplace:   PChar;      { string to replace with              }
  3811.     cchFind:      SmallWord;  { length of pchFindString             }
  3812.     cchReplace:   SmallWord;  { length of replace string            }
  3813.     iptStart:     IPt;        { point at which to start search      }
  3814.                               { (negative indicates cursor pt)      }
  3815.                               { becomes pt where string found       }
  3816.     iptStop:      IPt;        { point at which to stop search       }
  3817.                               { (negative indicates EOT)            }
  3818.     cchFound:     SmallWord;  { Length of found string at iptStart  }
  3819.   end;
  3820.  
  3821. { mlm_Search style flags }
  3822. const
  3823.   mlfsearch_CaseSensitive       = $00000001;
  3824.   mlfsearch_SelectMatch         = $00000002;
  3825.   mlfsearch_ChangeAll           = $00000004;
  3826.  
  3827. { MLE messages - MLM from $01B0 to $01DE; MLN from $0001 to $000F }
  3828. { formatting messages }
  3829.   mlm_SetTextLimit              = $01B0;
  3830.   mlm_QueryTextLimit            = $01B1;
  3831.   mlm_SetFormatRect             = $01B2;
  3832.   mlm_QueryFormatRect           = $01B3;
  3833.   mlm_SetWrap                   = $01B4;
  3834.   mlm_QueryWrap                 = $01B5;
  3835.   mlm_SetTabStop                = $01B6;
  3836.   mlm_QueryTabStop              = $01B7;
  3837.   mlm_SetReadOnly               = $01B8;
  3838.   mlm_QueryReadOnly             = $01B9;
  3839.  
  3840. { text content manipulation and queries Messages }
  3841.   mlm_QueryChanged              = $01BA;
  3842.   mlm_SetChanged                = $01BB;
  3843.   mlm_QueryLineCount            = $01BC;
  3844.   mlm_CharFromLine              = $01BD;
  3845.   mlm_LineFromChar              = $01BE;
  3846.   mlm_QueryLineLength           = $01BF;
  3847.   mlm_QueryTextLength           = $01C0;
  3848.  
  3849. { text import and export messages }
  3850.   mlm_Format                    = $01C1;
  3851.   mlm_SetImportExport           = $01C2;
  3852.   mlm_Import                    = $01C3;
  3853.   mlm_Export                    = $01C4;
  3854.   mlm_Delete                    = $01C6;
  3855.   mlm_QueryFormatLineLength     = $01C7;
  3856.   mlm_QueryFormatTextLength     = $01C8;
  3857.   mlm_Insert                    = $01C9;
  3858.  
  3859. { selection messages }
  3860.   mlm_SetSel                    = $01CA;
  3861.   mlm_QuerySel                  = $01CB;
  3862.   mlm_QuerySelText              = $01CC;
  3863.  
  3864. { undo and redo messages }
  3865.   mlm_QueryUndo                 = $01CD;
  3866.   mlm_Undo                      = $01CE;
  3867.   mlm_ResetUndo                 = $01CF;
  3868.  
  3869. { text attributes messages }
  3870.   mlm_QueryFont                 = $01D0;
  3871.   mlm_SetFont                   = $01D1;
  3872.   mlm_SetTextColor              = $01D2;
  3873.   mlm_QueryTextColor            = $01D3;
  3874.   mlm_SetBackColor              = $01D4;
  3875.   mlm_QueryBackColor            = $01D5;
  3876.  
  3877. { scrolling messages }
  3878.   mlm_QueryFirstChar            = $01D6;
  3879.   mlm_SetFirstChar              = $01D7;
  3880.  
  3881. { clipboard messages }
  3882.   mlm_Cut                       = $01D8;
  3883.   mlm_Copy                      = $01D9;
  3884.   mlm_Paste                     = $01DA;
  3885.   mlm_Clear                     = $01DB;
  3886.  
  3887. { display manipulation messages }
  3888.   mlm_EnableRefresh             = $01DC;
  3889.   mlm_DisableRefresh            = $01DD;
  3890.  
  3891. { search message }
  3892.   mlm_Search                    = $01DE;
  3893.   mlm_QueryImportExport         = $01DF;
  3894.  
  3895. { notification messages }
  3896.   mln_Overflow                  = $0001;
  3897.   mln_PixHorzOverflow           = $0002;
  3898.   mln_PixVertOverflow           = $0003;
  3899.   mln_TextOverflow              = $0004;
  3900.   mln_VScroll                   = $0005;
  3901.   mln_HScroll                   = $0006;
  3902.   mln_Change                    = $0007;
  3903.   mln_SetFocus                  = $0008;
  3904.   mln_KillFocus                 = $0009;
  3905.   mln_Margin                    = $000A;
  3906.   mln_SearchPause               = $000B;
  3907.   mln_MemError                  = $000C;
  3908.   mln_UndoOverflow              = $000D;
  3909.   mln_ClpbdFail                 = $000F;
  3910.  
  3911. {----[ PMGPI ]----}
  3912.  
  3913. { General GPI return values }
  3914. const
  3915.   gpi_Error                     = Bool(0);
  3916.   gpi_Ok                        = Bool(1);
  3917.   gpi_AltError                  = Bool(-1);
  3918.  
  3919. { fixed point number - implicit binary point between 2 and 3 hex digits }
  3920. type
  3921.   PFixed = ^Fixed;
  3922.   Fixed  = Long;
  3923. { fixed point number - implicit binary point between 1st and 2nd hex digits }
  3924.   Fixed88 = SmallWord;
  3925. { fixed point signed number - implicit binary point between bits 14 and 13. }
  3926. {                             Bit 15 is the sign bit.                       }
  3927. {                             Thus 1.0 is represented by 16384 (0x4000)     }
  3928. {                             and -1.0 is represented by -16384 (0xc000)    }
  3929.   Fixed114 = SmallWord;
  3930. { structure for size parameters e.g. for GpiCreatePS }
  3931.   PSizeL = ^SizeL;
  3932.   SizeL = record
  3933.     cx: Long;
  3934.     cy: Long;
  3935.   end;
  3936. { make FIXED number from SHORT integer part and USHORT fractional part }
  3937. function MakeFixed(intpart,fractpart : SmallInt) : Fixed; inline;
  3938. begin
  3939.   MakeFixed := fractpart OR intpart shl 16;
  3940. end;
  3941.  
  3942. { extract fractional part from a fixed quantity }
  3943. Function FixedFrac(fx : Fixed) : SmallInt; inline;
  3944. begin
  3945.   FixedFrac := SmallInt( fx );
  3946. end;
  3947.  
  3948. { extract integer part from a fixed quantity }
  3949. Function FixedInt(fx : Fixed) : SmallInt; inline;
  3950. begin
  3951.   FixedInt := SmallInt( fx shr 16 );
  3952. end;
  3953.  
  3954.  
  3955. { return code on GpiQueryLogColorTable,GpiQueryRealColors and GpiQueryPel }
  3956. const
  3957.   clr_NoIndex                   = -254;
  3958.   { units for GpiCreatePS and others }
  3959.   pu_Arbitrary                  = $0004;
  3960.   pu_Pels                       = $0008;
  3961.   pu_Lometric                   = $000C;
  3962.   pu_Himetric                   = $0010;
  3963.   pu_Loenglish                  = $0014;
  3964.   pu_Hienglish                  = $0018;
  3965.   pu_Twips                      = $001C;
  3966.   { format for GpiCreatePS }
  3967.   gpif_Default                  = 0;
  3968.   gpif_Short                    = $0100;
  3969.   gpif_Long                     = $0200;
  3970.   { PS type for GpiCreatePS }
  3971.   gpit_Normal                   = 0;
  3972.   gpit_Micro                    = $1000;
  3973.   { implicit associate flag for GpiCreatePS }
  3974.   gpia_NoAssoc                  = 0;
  3975.   gpia_Assoc                    = $4000;
  3976.   { return error for GpiQueryDevice }
  3977.   hdc_Error                     = Hdc(-1);
  3978.  
  3979.   { common GPICONTROL functions }
  3980.  
  3981. function GpiCreatePS(Ab: Hab; DC: Hdc; var sizlSize: SizeL; Options: ULong): Hps;
  3982. function GpiDestroyPS(PS: Hps): Bool;
  3983. function GpiAssociate(PS: Hps; DC: Hdc): Bool;
  3984. function GpiRestorePS(PS: Hps; lPSid: Long): Bool;
  3985. function GpiSavePS(PS: Hps): Long;
  3986. function GpiErase(PS: Hps): Bool;
  3987. function GpiQueryDevice(PS: Hps): Hdc;
  3988.  
  3989. { options for GpiResetPS }
  3990. const
  3991.   gres_Attrs                    = $0001;
  3992.   gres_Segments                 = $0002;
  3993.   gres_All                      = $0004;
  3994.  
  3995.   { option masks for PS options used by GpiQueryPs }
  3996.   ps_Units                      = $00FC;
  3997.   ps_Format                     = $0F00;
  3998.   ps_Type                       = $1000;
  3999.   ps_Mode                       = $2000;
  4000.   ps_Associate                  = $4000;
  4001.   ps_NoReset                    = $8000;
  4002.  
  4003.   { error context returned by GpiErrorSegmentData }
  4004.   gpie_Segment                  = 0;
  4005.   gpie_Element                  = 1;
  4006.   gpie_Data                     = 2;
  4007.  
  4008.   { control parameter for GpiSetDrawControl }
  4009.   dctl_Erase                    = 1;
  4010.   dctl_Display                  = 2;
  4011.   dctl_Boundary                 = 3;
  4012.   dctl_Dynamic                  = 4;
  4013.   dctl_Correlate                = 5;
  4014.  
  4015.   { constants for GpiSet/QueryDrawControl }
  4016.   dctl_Error                    = -1;
  4017.   dctl_Off                      = 0;
  4018.   dctl_On                       = 1;
  4019.  
  4020.   { constants for GpiSet/QueryStopDraw }
  4021.   sdw_Error                     = -1;
  4022.   sdw_Off                       = 0;
  4023.   sdw_On                        = 1;
  4024.  
  4025.   { drawing for GpiSet/QueryDrawingMode }
  4026.   dm_Error                      = 0;
  4027.   dm_Draw                       = 1;
  4028.   dm_Retain                     = 2;
  4029.   dm_DrawAndRetain              = 3;
  4030.  
  4031. { other GPICONTROL functions }
  4032.  
  4033. function GpiResetPS(PS: Hps; Options: ULong): Bool;
  4034. function GpiSetPS(PS: Hps; var sizlsize: SizeL; Options: ULong): Bool;
  4035. function GpiQueryPS(PS: Hps; var sizlsize: SizeL): ULong;
  4036. function GpiErrorSegmentData(PS: Hps; var Segment,Context: Long): Long;
  4037. function GpiQueryDrawControl(PS: Hps; Control: Long): Long;
  4038. function GpiSetDrawControl(PS: Hps; Control,Value: Long): Bool;
  4039. function GpiQueryDrawingMode(PS: Hps): Long;
  4040. function GpiSetDrawingMode(PS: Hps; Mode: Long): Bool;
  4041. function GpiQueryStopDraw(PS: Hps): Long;
  4042. function GpiSetStopDraw(PS: Hps; Value: Long): Bool;
  4043.  
  4044. { options for GpiSetPickApertureSize }
  4045. const
  4046.   pickap_Default                = 0;
  4047.   pickap_Rec                    = 2;
  4048.  
  4049.   { type of correlation for GpiCorrelateChain }
  4050.   picksel_Visible               = 0;
  4051.   picksel_All                   = 1;
  4052.  
  4053.   { return code to indicate correlate hit(s) }
  4054.   gpi_Hits                      = 2;
  4055.  
  4056. { picking, correlation and boundary functions }
  4057.  
  4058. function GpiCorrelateChain(PS: Hps; lType: Long; var ptlPick: PointL;
  4059.   MaxHits,MaxDepth: Long; var l2: Long): Long;
  4060. function GpiQueryTag(PS: Hps; var Tag: Long): Bool;
  4061. function GpiSetTag(PS: Hps; Tag: Long): Bool;
  4062. function GpiQueryPickApertureSize(PS: Hps; var sizlsize: SizeL): Bool;
  4063. function GpiSetPickApertureSize(PS: Hps; Options: Long; var sizlsize: SizeL): Bool;
  4064. function GpiQueryPickAperturePosition(PS: Hps; var ptlPoint: PointL): Bool;
  4065. function GpiSetPickAperturePosition(PS: Hps; ptlPick: PointL): Bool;
  4066. function GpiQueryBoundaryData(PS: Hps; var rclBoundary: RectL): Bool;
  4067. function GpiResetBoundaryData(PS: Hps): Bool;
  4068. function GpiCorrelateFrom(PS: Hps; FirstSegment,LastSegment,lType: Long;
  4069.   var ptlPick: PointL; MaxHits,MaxDepth: Long; var SegTag: Long): Long;
  4070. function GpiCorrelateSegment(PS: Hps; Segment,lType: Long; var ptlPick: PointL;
  4071.   MaxHits,MaxDepth: Long; var SegTag: Long): Long;
  4072.  
  4073. { data formats for GpiPutData and GpiGetData }
  4074. const
  4075.   dform_NoConv                  = 0;
  4076.   dform_S370Short               = 1;
  4077.   dform_PCShort                 = 2;
  4078.   dform_PCLong                  = 4;
  4079.  
  4080.   { segment attributes used by GpiSet/QuerySegmentAttrs and others }
  4081.   attr_Error                    = -1;
  4082.   attr_Detectable               = 1;
  4083.   attr_Visible                  = 2;
  4084.   attr_Chained                  = 6;
  4085.   attr_Dynamic                  = 8;
  4086.   attr_FastChain                = 9;
  4087.   attr_Prop_Detectable          = 10;
  4088.   attr_Prop_Visible             = 11;
  4089.   { attribute on/off values }
  4090.   attr_Off                      = 0;
  4091.   attr_On                       = 1;
  4092.  
  4093.   { segment priority used by GpiSetSegmentPriority and others }
  4094.   lower_Pri                     = -1;
  4095.   higher_Pri                    = 1;
  4096.  
  4097.   { segment control functions }
  4098.  
  4099. function GpiOpenSegment(PS: Hps; Segment: Long): Bool;
  4100. function GpiCloseSegment(PS: Hps): Bool;
  4101. function GpiDeleteSegment(PS: Hps; Segid: Long): Bool;
  4102. function GpiQueryInitialSegmentAttrs(PS: Hps; Attribute: Long): Long;
  4103. function GpiSetInitialSegmentAttrs(PS: Hps; Attribute,Value: Long): Bool;
  4104. function GpiQuerySegmentAttrs(PS: Hps; Segid,Attribute: Long): Long;
  4105. function GpiSetSegmentAttrs(PS: Hps; Segid,Attribute,Value: Long): Bool;
  4106. function GpiQuerySegmentPriority(PS: Hps; RefSegid,Order: Long): Long;
  4107. function GpiSetSegmentPriority(PS: Hps; Segid,RefSegid,Order: Long): Bool;
  4108. function GpiDeleteSegments(PS: Hps; FirstSegment,LastSegment: Long): Bool;
  4109. function GpiQuerySegmentNames(PS: Hps; FirstSegid,LastSegid,Max: Long;
  4110.   var Segids: Long): Long;
  4111.  
  4112. { draw functions for segments }
  4113. function GpiGetData(PS: Hps; Segid: Long; var Offset: Long; Format,Length: Long;
  4114.   var Data): Long;
  4115. function GpiPutData(PS: Hps; Format: Long; var Count: Long; var Data): Long;
  4116. function GpiDrawChain(PS: Hps): Bool;
  4117. function GpiDrawFrom(PS: Hps; FirstSegment,LastSegment: Long): Bool;
  4118. function GpiDrawSegment(PS: Hps; Segment: Long): Bool;
  4119. function GpiDrawDynamics(PS: Hps): Bool;
  4120. function GpiRemoveDynamics(PS: Hps; FirstSegid,LastSegid: Long): Bool;
  4121.  
  4122. { edit modes used by GpiSet/QueryEditMode }
  4123. const
  4124.   segem_Error                   = 0;
  4125.   segem_Insert                  = 1;
  4126.   segem_Replace                 = 2;
  4127.  
  4128.   { segment editing by element functions }
  4129.  
  4130. function GpiBeginElement(PS: Hps; lType: Long; Desc: PChar): Bool;
  4131. function GpiEndElement(PS: Hps): Bool;
  4132. function GpiLabel(PS: Hps; lLabel: Long): Bool;
  4133. function GpiElement(PS: Hps; lType: Long; Desc: PChar; Length: Long;
  4134.   var Data): Long;
  4135. function GpiQueryElement(PS: Hps; Off,MaxLength: Long; var Data): Long;
  4136. function GpiDeleteElement(PS: Hps): Bool;
  4137. function GpiDeleteElementRange(PS: Hps; FirstElement,LastElement: Long): Bool;
  4138. function GpiDeleteElementsBetweenLabels(PS: Hps; FirstLabel,LastLabel: Long): Bool;
  4139. function GpiQueryEditMode(PS: Hps): Long;
  4140. function GpiSetEditMode(PS: Hps; Mode: Long): Bool;
  4141. function GpiQueryElementPointer(PS: Hps): Long;
  4142. function GpiSetElementPointer(PS: Hps; Element: Long): Bool;
  4143. function GpiOffsetElementPointer(PS: Hps; offset: Long): Bool;
  4144. function GpiQueryElementType(PS: Hps; var lType: Long; Length: Long;
  4145.   Data: PChar): Long;
  4146. function GpiSetElementPointerAtLabel(PS: Hps; lLabel: Long): Bool;
  4147.  
  4148. { co-ordinates space for GpiConvert }
  4149. const
  4150.   cvtc_World                    = 1;
  4151.   cvtc_Model                    = 2;
  4152.   cvtc_DefaultPage              = 3;
  4153.   cvtc_Page                     = 4;
  4154.   cvtc_Device                   = 5;
  4155.  
  4156.   { type of transformation for GpiSetSegmentTransformMatrix }
  4157.   transform_Replace             = 0;
  4158.   transform_Add                 = 1;
  4159.   transform_Preempt             = 2;
  4160.  
  4161.   { transform matrix }
  4162. type
  4163.   PMatrixLf = ^MatrixLf;
  4164.   MatrixLf = record
  4165.     fxM11: Fixed;
  4166.     fxM12: Fixed;
  4167.     lM13:  Long;
  4168.     fxM21: Fixed;
  4169.     fxM22: Fixed;
  4170.     lM23:  Long;
  4171.     lM31:  Long;
  4172.     lM32:  Long;
  4173.     lM33:  Long;
  4174.   end;
  4175.  
  4176.   { transform and transform conversion functions }
  4177. function GpiQuerySegmentTransformMatrix(PS: Hps; Segid,Count: Long;
  4178.   var matlfArray: MatrixLf): Bool;
  4179. function GpiSetSegmentTransformMatrix(PS: Hps; Segid,Count: Long;
  4180.   var matlfarray: MatrixLf; Options: Long): Bool;
  4181. function GpiConvert(PS: Hps; Src,Targ,Count: Long; var aptlPoints: PointL): Bool;
  4182. function GpiConvertWithMatrix(PS: Hps; Countp: Long; var aptlPoints: PointL;
  4183.   Count: Long; var matlfArray: MatrixLf): Bool;
  4184. function GpiQueryModelTransformMatrix(PS: Hps; Count: Long; pmatlfArray: MatrixLf): Bool;
  4185. function GpiSetModelTransformMatrix(PS: Hps; Count: Long; matlfArray: MatrixLf;
  4186.   Options: Long): Bool;
  4187. function GpiCallSegmentMatrix(PS: Hps; Segment,Count: Long; matlfArray: MatrixLf;
  4188.   Options: Long): Long;
  4189. function GpiQueryDefaultViewMatrix(PS: Hps; Count: Long; var matlfArray: MatrixLf): Bool;
  4190. function GpiSetDefaultViewMatrix(PS: Hps; Count: Long; var matlfarray: MatrixLf;
  4191.   Options: Long): Bool;
  4192. function GpiQueryPageViewport(PS: Hps; var rclViewport: RectL): Bool;
  4193. function GpiSetPageViewport(PS: Hps; var rclViewport: RectL): Bool;
  4194. function GpiQueryViewingTransformMatrix(PS: Hps; Count: Long; matlfArray: MatrixLf): Bool;
  4195. function GpiSetViewingTransformMatrix(PS: Hps; Count: Long; matlfArray: MatrixLf;
  4196.   Options: Long): Bool;
  4197. { transform helper routines }
  4198. function GpiTranslate(PS: Hps; var matlfArray: MatrixLf; Options: Long;
  4199.   var ptlTranslation: PointL): Bool;
  4200. function GpiScale(PS: Hps; var matlfArray: MatrixLf; Options: Long;
  4201.   var afxScale: Fixed; var ptlCenter: PointL): Bool;
  4202. function GpiRotate(PS: Hps; var matlfArray: MatrixLf; Options: Long;
  4203.   fxAngle: Fixed; ptlCenter: PPointL): Bool;
  4204. { general clipping functions }
  4205. function GpiSetGraphicsField(PS: Hps; var rclField: RectL): Bool;
  4206. function GpiQueryGraphicsField(PS: Hps; var rclField: RectL): Bool;
  4207. function GpiSetViewingLimits(PS: Hps; var rclLimits: RectL): Bool;
  4208. function GpiQueryViewingLimits(PS: Hps; var rclLimits: RectL): Bool;
  4209.  
  4210. { modes for GpiModifyPath }
  4211. const
  4212.   mpath_Stroke                  = 6;
  4213.  
  4214.   { modes for GpiFillPath }
  4215.   fpath_Alternate               = 0;
  4216.   fpath_Winding                 = 2;
  4217.   fpath_Excl                    = 0;
  4218.   fpath_Incl                    = 8;
  4219.  
  4220.    { modes for GpiSetClipPath }
  4221.   scp_Alternate                 = 0;
  4222.   scp_Winding                   = 2;
  4223.   scp_And                       = 4;
  4224.   scp_Reset                     = 0;
  4225.   scp_Excl                      = 0;
  4226.   scp_Incl                      = 8;
  4227.  
  4228. { Path and Clip Path functions }
  4229.  
  4230. function GpiBeginPath(PS: Hps; Path: Long): Bool;
  4231. function GpiEndPath(PS: Hps): Bool;
  4232. function GpiCloseFigure(PS: Hps): Bool;
  4233. function GpiModifyPath(PS: Hps; Path,Mode: Long): Bool;
  4234. function GpiFillPath(PS: Hps; Path,Options: Long): Long;
  4235. function GpiSetClipPath(PS: Hps; Path,Options: Long): Bool;
  4236. function GpiOutlinePath(PS: Hps; Path,Options: Long): Long;
  4237. function GpiPathToRegion(PS: Hps; Path,Options: Long): HRgn;
  4238. function GpiStrokePath(PS: Hps; Path: Long; Options: ULong): Long;
  4239.  
  4240. { options for GpiCreateLogColorTable and others }
  4241. const
  4242.   lcol_Reset                    = $0001;
  4243.   lcol_Realizable               = $0002;
  4244.   lcol_PureColor                = $0004;
  4245.   lcol_Override_Default_Colors  = $0008;
  4246.   lcol_Realized                 = $0010;
  4247.  
  4248.   { format of logical lColor table for GpiCreateLogColorTable and others }
  4249.   lcolf_Default                 = 0;
  4250.   lcolf_IndRgb                  = 1;
  4251.   lcolf_ConsecRgb               = 2;
  4252.   lcolf_Rgb                     = 3;
  4253.   lcolf_Palette                 = 4;
  4254.  
  4255.   { options for GpiQueryRealColors and others }
  4256.   lcolopt_Realized              = $0001;
  4257.   lcolopt_Index                 = $0002;
  4258.  
  4259.   { return codes from GpiQueryLogColorTable to indicate it is in RGB mode }
  4260.   qlct_Error                    = -1;
  4261.   qlct_Rgb                      = -2;
  4262.  
  4263.   { GpiQueryLogColorTable index returned for colors not explicitly loaded }
  4264.   qlct_NotLoaded                = -1;
  4265.   { return codes for GpiQueryColorData }
  4266.   qcd_lct_Format                = 0;
  4267.   qcd_lct_LoIndex               = 1;
  4268.   qcd_lct_HiIndex               = 2;
  4269.   qcd_lct_Options               = 3;
  4270.  
  4271.   { Palette manager return values }
  4272.   pal_Error                     = -1;
  4273.  
  4274.   { color flags for GpiCreatePalette and others }
  4275.   pc_Reserved                   = $01;
  4276.   pc_Explicit                   = $02;
  4277.   pc_NoCollapse                 = $04;
  4278.  
  4279. { logical lColor table functions }
  4280.  
  4281. function GpiCreateLogColorTable(PS: Hps; Options: ULong; Format,Start,Count: Long;
  4282.   palTable: PLong): Bool;
  4283. function GpiQueryColorData(PS: Hps; Count: Long; var alArray: Long): Bool;
  4284. function GpiQueryLogColorTable(PS: Hps; Options: ULong; Start,Count: Long;
  4285.   var alArray: Long): Long;
  4286. function GpiQueryRealColors(PS: Hps; Options: ULong; Start,Count: Long;
  4287.   var alColors: Long): Long;
  4288. function GpiQueryNearestColor(PS: Hps; Options: ULong; RgbIn: Long): Long;
  4289. function GpiQueryColorIndex(PS: Hps; Options: ULong; RgbColor: Long): Long;
  4290. function GpiQueryRGBColor(PS: Hps; Options: ULong; ColorIndex: Long): Long;
  4291.  
  4292. { Palette manager functions }
  4293. function GpiCreatePalette(Ab: Hab; Options: ULong; Format,Count: ULong;
  4294.   var aulTable: ULong): HPal;
  4295. function GpiDeletePalette(Pal: HPal): Bool;
  4296. function GpiSelectPalette(PS: Hps; Pal: HPal): HPal;
  4297. function GpiAnimatePalette(Pal: HPal; Format,Start,Count: ULong;
  4298.   var aulTable: ULong): Long;
  4299. function GpiSetPaletteEntries(Pal: HPal; Format,Start,Count: ULong;
  4300.   var aulTable: ULong): Bool;
  4301. function GpiQueryPalette(PS: Hps): HPal;
  4302. function GpiQueryPaletteInfo(Pal: HPal; PS: Hps; Options,Start,Count: ULong;
  4303.   var aulArray: ULong): Long;
  4304.  
  4305. { default color table indices }
  4306. const
  4307.   clr_False                     = -5;
  4308.   clr_True                      = -4;
  4309.  
  4310.   clr_Error                     = -255;
  4311.   clr_Default                   = -3;
  4312.   clr_White                     = -2;
  4313.   clr_Black                     = -1;
  4314.   clr_Background                = 0;
  4315.   clr_Blue                      = 1;
  4316.   clr_Red                       = 2;
  4317.   clr_Pink                      = 3;
  4318.   clr_Green                     = 4;
  4319.   clr_Cyan                      = 5;
  4320.   clr_Yellow                    = 6;
  4321.   clr_Neutral                   = 7;
  4322.  
  4323.   clr_Darkgray                  = 8;
  4324.   clr_Darkblue                  = 9;
  4325.   clr_Darkred                   = 10;
  4326.   clr_Darkpink                  = 11;
  4327.   clr_Darkgreen                 = 12;
  4328.   clr_Darkcyan                  = 13;
  4329.   clr_Brown                     = 14;
  4330.   clr_Palegray                  = 15;
  4331.  
  4332.   { RGB colors }
  4333.   rgb_Error                     = -255;
  4334.   rgb_Black                     = $00000000;
  4335.   rgb_Blue                      = $000000FF;
  4336.   rgb_Green                     = $0000FF00;
  4337.   rgb_Cyan                      = $0000FFFF;
  4338.   rgb_Red                       = $00FF0000;
  4339.   rgb_Pink                      = $00FF00FF;
  4340.   rgb_Yellow                    = $00FFFF00;
  4341.   rgb_White                     = $00FFFFFF;
  4342.  
  4343.   { control flags used by GpiBeginArea }
  4344.   ba_NoBoundary                 = 0;
  4345.   ba_Boundary                   = $0001;
  4346.   ba_Alternate                  = 0;
  4347.   ba_Winding                    = $0002;
  4348.   ba_Excl                       = 0;
  4349.   ba_Incl                       = $0008;
  4350.  
  4351.   { fill options for GpiBox/GpiFullArc }
  4352.   dro_Fill                      = 1;
  4353.   dro_Outline                   = 2;
  4354.   dro_OutlineFill               = 3;
  4355.  
  4356.   { basic pattern symbols }
  4357.   patsym_Error                  = -1;
  4358.   patsym_Default                = 0;
  4359.   patsym_Dense1                 = 1;
  4360.   patsym_Dense2                 = 2;
  4361.   patsym_Dense3                 = 3;
  4362.   patsym_Dense4                 = 4;
  4363.   patsym_Dense5                 = 5;
  4364.   patsym_Dense6                 = 6;
  4365.   patsym_Dense7                 = 7;
  4366.   patsym_Dense8                 = 8;
  4367.   patsym_Vert                   = 9;
  4368.   patsym_Horiz                  = 10;
  4369.   patsym_Diag1                  = 11;
  4370.   patsym_Diag2                  = 12;
  4371.   patsym_Diag3                  = 13;
  4372.   patsym_Diag4                  = 14;
  4373.   patsym_NoShade                = 15;
  4374.   patsym_Solid                  = 16;
  4375.   patsym_Halftone               = 17;
  4376.   patsym_Hatch                  = 18;
  4377.   patsym_DiagHatch              = 19;
  4378.   patsym_Blank                  = 64;
  4379.  
  4380.   { lcid values for GpiSet/QueryPattern and others }
  4381.   lcid_Error                    = -1;
  4382.   lcid_Default                  = 0;
  4383.  
  4384. { global primitive functions }
  4385.  
  4386. function GpiSetColor(PS: Hps; Color: Long): Bool;
  4387. function GpiQueryColor(PS: Hps): Long;
  4388.  
  4389. { line primitive functions }
  4390.  
  4391. function GpiBox(PS: Hps; Control: Long; var ptlPoint: PointL;
  4392.   HRound,VRound: Long): Long;
  4393.  
  4394. function GpiMove(PS: Hps; var ptlPoint: PointL): Bool;
  4395. function GpiLine(PS: Hps; var ptlEndPoint: PointL): Long;
  4396. function GpiPolyLine(PS: Hps; Count: Long; var aptlPoints: PointL): Long;
  4397. function GpiPolyLineDisjoint(PS: Hps; Count: Long; var aptlPoints: PointL): Long;
  4398.  
  4399. { area primitive functions }
  4400.  
  4401. function GpiSetPattern(PS: Hps; PatternSymbol: Long): Bool;
  4402. function GpiQueryPattern(PS: Hps): Long;
  4403. function GpiBeginArea(PS: Hps; Options: ULong): Bool;
  4404. function GpiEndArea(PS: Hps): Long;
  4405.  
  4406. { character primitive functions }
  4407.  
  4408. function GpiCharString(PS: Hps; Count: Long; chString: PChar): Long;
  4409. function GpiCharStringAt(PS: Hps; var ptlPoint: PointL; Count: Long;
  4410.   chString: PChar): Long;
  4411.  
  4412. { mode for GpiSetAttrMode }
  4413. const
  4414.   am_Error                      = -1;
  4415.   am_Preserve                   = 0;
  4416.   am_NoPreserve                 = 1;
  4417.  
  4418.   { foreground mixes }
  4419.   fm_Error                      = -1;
  4420.   fm_Default                    = 0;
  4421.   fm_Or                         = 1;
  4422.   fm_OverPaint                  = 2;
  4423.   fm_LeaveAlone                 = 5;
  4424.  
  4425.   fm_Xor                        = 4;
  4426.   fm_And                        = 6;
  4427.   fm_Subtract                   = 7;
  4428.   fm_MaskSrcNot                 = 8;
  4429.   fm_Zero                       = 9;
  4430.   fm_NotMergeSrc                = 10;
  4431.   fm_NotXorSrc                  = 11;
  4432.   fm_Invert                     = 12;
  4433.   fm_MergeSrcNot                = 13;
  4434.   fm_NotCopySrc                 = 14;
  4435.   fm_MergeNotSrc                = 15;
  4436.   fm_NotMaskSrc                 = 16;
  4437.   fm_One                        = 17;
  4438.  
  4439.   { background mixes }
  4440.   bm_Error                      = -1;
  4441.   bm_Default                    = 0;
  4442.   bm_Or                         = 1;
  4443.   bm_OverPaint                  = 2;
  4444.   bm_LeaveAlone                 = 5;
  4445.  
  4446.   bm_Xor                        = 4;
  4447.   bm_And                        = 6;
  4448.   bm_Subtract                   = 7;
  4449.   bm_MaskSrcNot                 = 8;
  4450.   bm_Zero                       = 9;
  4451.   bm_NotMergeSrc                = 10;
  4452.   bm_NotXorSrc                  = 11;
  4453.   bm_Invert                     = 12;
  4454.   bm_MergeSrcNot                = 13;
  4455.   bm_NotCopySrc                 = 14;
  4456.   bm_MergeNotSrc                = 15;
  4457.   bm_NotMaskSrc                 = 16;
  4458.   bm_One                        = 17;
  4459.   bm_SrcTransparent             = 18;
  4460.   bm_DestTransparent            = 19;
  4461.  
  4462.   { basic line type styles }
  4463.   linetype_Error                = -1;
  4464.   linetype_Default              = 0;
  4465.   linetype_Dot                  = 1;
  4466.   linetype_ShortDash            = 2;
  4467.   linetype_DashDot              = 3;
  4468.   linetype_DoubleDot            = 4;
  4469.   linetype_LongDash             = 5;
  4470.   linetype_DashDoubleDot        = 6;
  4471.   linetype_Solid                = 7;
  4472.   linetype_Invisible            = 8;
  4473.   linetype_Alternate            = 9;
  4474.  
  4475.   { cosmetic line widths }
  4476.   linewidth_Error               = -1;
  4477.   linewidth_Default             = 0;
  4478.   linewidth_Normal              = $00010000;   { 1.0 }
  4479.   linewidth_Thick               = $00020000;   { 2.0 }
  4480.  
  4481.   { actual line widths }
  4482.   lineWidthGeom_Error           = -1;
  4483.  
  4484.   { line end styles }
  4485.   lineend_Error                 = -1;
  4486.   lineend_Default               = 0;
  4487.   lineend_Flat                  = 1;
  4488.   lineend_Square                = 2;
  4489.   lineend_Round                 = 3;
  4490.  
  4491.   { line join styles }
  4492.   linejoin_Error                = -1;
  4493.   linejoin_Default              = 0;
  4494.   linejoin_Bevel                = 1;
  4495.   linejoin_Round                = 2;
  4496.   linejoin_Mitre                = 3;
  4497.  
  4498.   { character directions }
  4499.   chdirn_Error                  = -1;
  4500.   chdirn_Default                = 0;
  4501.   chdirn_LeftRight              = 1;
  4502.   chdirn_TopBottom              = 2;
  4503.   chdirn_RightLeft              = 3;
  4504.   chdirn_BottomTop              = 4;
  4505.  
  4506.   { character text alignments }
  4507.   ta_Normal_Horiz               = $0001;
  4508.   ta_Left                       = $0002;
  4509.   ta_Center                     = $0003;
  4510.   ta_Right                      = $0004;
  4511.   ta_Standard_Horiz             = $0005;
  4512.   ta_Normal_Vert                = $0100;
  4513.   ta_Top                        = $0200;
  4514.   ta_Half                       = $0300;
  4515.   ta_Base                       = $0400;
  4516.   ta_Bottom                     = $0500;
  4517.   ta_Standard_Vert              = $0600;
  4518.  
  4519.   { character modes }
  4520.   cm_Error                      = -1;
  4521.   cm_Default                    = 0;
  4522.   cm_Mode1                      = 1;
  4523.   cm_Mode2                      = 2;
  4524.   cm_Mode3                      = 3;
  4525.  
  4526.   { basic marker symbols }
  4527.   marksym_Error                 = -1;
  4528.   marksym_Default               = 0;
  4529.   marksym_Cross                 = 1;
  4530.   marksym_Plus                  = 2;
  4531.   marksym_Diamond               = 3;
  4532.   marksym_Square                = 4;
  4533.   marksym_SixPointStar          = 5;
  4534.   marksym_EightPointStar        = 6;
  4535.   marksym_SolidDiamond          = 7;
  4536.   marksym_SolidSquare           = 8;
  4537.   marksym_Dot                   = 9;
  4538.   marksym_SmallCircle           = 10;
  4539.   marksym_Blank                 = 64;
  4540.  
  4541.   { formatting options for GpiCharStringPosAt }
  4542.   chs_Opaque                    = $0001;
  4543.   chs_Vector                    = $0002;
  4544.   chs_LeavePos                  = $0008;
  4545.   chs_Clip                      = $0010;
  4546.   chs_Underscore                = $0200;
  4547.   chs_StrikeOut                 = $0400;
  4548.  
  4549.   { bundle codes for GpiSetAttributes and GpiQueryAttributes }
  4550.   prim_Line                     = 1;
  4551.   prim_Char                     = 2;
  4552.   prim_Marker                   = 3;
  4553.   prim_Area                     = 4;
  4554.   prim_Image                    = 5;
  4555.  
  4556.   { line bundle mask bits }
  4557.   lbb_Color                     = $0001;
  4558.   lbb_Back_Color                = $0002;
  4559.   lbb_Mix_Mode                  = $0004;
  4560.   lbb_Back_Mix_Mode             = $0008;
  4561.   lbb_Width                     = $0010;
  4562.   lbb_Geom_Width                = $0020;
  4563.   lbb_Type                      = $0040;
  4564.   lbb_End                       = $0080;
  4565.   lbb_Join                      = $0100;
  4566.  
  4567.   { character bundle mask bits }
  4568.   cbb_Color                     = $0001;
  4569.   cbb_Back_Color                = $0002;
  4570.   cbb_Mix_Mode                  = $0004;
  4571.   cbb_Back_Mix_Mode             = $0008;
  4572.   cbb_Set                       = $0010;
  4573.   cbb_Mode                      = $0020;
  4574.   cbb_Box                       = $0040;
  4575.   cbb_Angle                     = $0080;
  4576.   cbb_Shear                     = $0100;
  4577.   cbb_Direction                 = $0200;
  4578.   cbb_Text_Align                = $0400;
  4579.   cbb_Extra                     = $0800;
  4580.   cbb_Break_Extra               = $1000;
  4581.  
  4582.   { marker bundle mask bits }
  4583.   mbb_Color                     = $0001;
  4584.   mbb_Back_Color                = $0002;
  4585.   mbb_Mix_Mode                  = $0004;
  4586.   mbb_Back_Mix_Mode             = $0008;
  4587.   mbb_Set                       = $0010;
  4588.   mbb_Symbol                    = $0020;
  4589.   mbb_Box                       = $0040;
  4590.  
  4591.   { pattern bundle mask bits }
  4592.   abb_Color                     = $0001;
  4593.   abb_Back_Color                = $0002;
  4594.   abb_Mix_Mode                  = $0004;
  4595.   abb_Back_Mix_Mode             = $0008;
  4596.   abb_Set                       = $0010;
  4597.   abb_Symbol                    = $0020;
  4598.   abb_Ref_Point                 = $0040;
  4599.  
  4600.   { image bundle mask bits }
  4601.   ibb_Color                     = $0001;
  4602.   ibb_Back_Color                = $0002;
  4603.   ibb_Mix_Mode                  = $0004;
  4604.   ibb_Back_Mix_Mode             = $0008;
  4605.  
  4606. { structure for GpiSetArcParams and GpiQueryArcParams }
  4607. type
  4608.   PArcParams = ^ArcParams;
  4609.   ArcParams = record
  4610.     lP: Long;
  4611.     lQ: Long;
  4612.     lR: Long;
  4613.     lS: Long;
  4614.   end;
  4615.  
  4616. { variation of SIZE used for FIXEDs }
  4617.   PSizeF = ^SizeF;
  4618.   SizeF = record
  4619.     cx: Fixed;
  4620.     cy: Fixed;
  4621.   end;
  4622.  
  4623. { structure for gradient parameters e.g. for GpiSetCharAngle }
  4624.   PGradientL = ^GradientL;
  4625.   GradientL = record
  4626.     x: Long;
  4627.     y: Long;
  4628.   end;
  4629.  
  4630. { line bundle for GpiSetAttributes and GpiQueryAttributes }
  4631.   PLineBundle = ^LineBundle;
  4632.   LineBundle = record
  4633.     lColor:        Long;
  4634.     lBackColor:    Long;
  4635.     usMixMode:     SmallWord;
  4636.     usBackMixMode: SmallWord;
  4637.     fxWidth:       Fixed;
  4638.     lGeomWidth:    Long;
  4639.     usType:        SmallWord;
  4640.     usEnd:         SmallWord;
  4641.     usJoin:        SmallWord;
  4642.     usReserved:    SmallWord;
  4643.   end;
  4644.  
  4645. { character bundle for GpiSetAttributes and GpiQueryAttributes }
  4646.   PCharBundle = ^CharBundle;
  4647.   CharBundle = record
  4648.     lColor:        Long;
  4649.     lBackColor:    Long;
  4650.     usMixMode:     SmallWord;
  4651.     usBackMixMode: SmallWord;
  4652.     usSet:         SmallWord;
  4653.     usPrecision:   SmallWord;
  4654.     sizfxCell:     SizeF;
  4655.     ptlAngle:      PointL;
  4656.     ptlShear:      PointL;
  4657.     usDirection:   SmallWord;
  4658.     usTextAlign:   SmallWord;
  4659.     fxExtra:       Fixed;
  4660.     fxBreakExtra:  Fixed;
  4661.   end;
  4662.  
  4663. { marker bundle for GpiSetAttributes and GpiQueryAttributes }
  4664.   PMarkerBundle = ^MarkerBundle;
  4665.   MarkerBundle = record
  4666.     lColor:        Long;
  4667.     lBackColor:    Long;
  4668.     usMixMode:     SmallWord;
  4669.     usBackMixMode: SmallWord;
  4670.     usSet:         SmallWord;
  4671.     usSymbol:      SmallWord;
  4672.     sizfxCell:     SizeF;
  4673.   end;
  4674.  
  4675. { pattern bundle for GpiSetAttributes and GpiQueryAttributes }
  4676.   PAreaBundle = ^AreaBundle;
  4677.   AreaBundle = record
  4678.     lColor:        Long;
  4679.     lBackColor:    Long;
  4680.     usMixMode:     SmallWord;
  4681.     usBackMixMode: SmallWord;
  4682.     usSet:         SmallWord;
  4683.     usSymbol:      SmallWord;
  4684.     ptlRefPoint:   PointL;
  4685.   end;
  4686.  
  4687. { image bundle for GpiSetAttributes and GpiQueryAttributes }
  4688.   PImageBundle = ^ImageBundle;
  4689.   ImageBundle = record
  4690.     lColor:        Long;
  4691.     lBackColor:    Long;
  4692.     usMixMode:     SmallWord;
  4693.     usBackMixMode: SmallWord;
  4694.   end;
  4695.  
  4696. { pointer to any bundle used by GpiSet/QueryAttrs }
  4697.   PBundle = Pointer;
  4698.  
  4699. { array indices for GpiQueryTextBox }
  4700. const
  4701.   txtbox_TopLeft                = 0;
  4702.   txtbox_BottomLeft             = 1;
  4703.   txtbox_TopRight               = 2;
  4704.   txtbox_BottomRight            = 3;
  4705.   txtbox_Concat                 = 4;
  4706.   { array count for GpiQueryTextBox }
  4707.   txtbox_Count                  = 5;
  4708.  
  4709.   { return codes for GpiPtVisible }
  4710.   pvis_Error                    = 0;
  4711.   pvis_Invisible                = 1;
  4712.   pvis_Visible                  = 2;
  4713.  
  4714.   { return codes for GpiRectVisible }
  4715.   rvis_Error                    = 0;
  4716.   rvis_Invisible                = 1;
  4717.   rvis_Partial                  = 2;
  4718.   rvis_Visible                  = 3;
  4719.  
  4720. { attribute mode functions }
  4721.  
  4722. function GpiSetAttrMode(PS: Hps; Mode: Long): Bool;
  4723. function GpiQueryAttrMode(PS: Hps): Long;
  4724.  
  4725. { bundle primitive functions }
  4726.  
  4727. function GpiSetAttrs(PS: Hps; PrimType: Long; AttrMask,DefMask: ULong; bunAttrs: PBundle): Bool;
  4728. function GpiQueryAttrs(PS: Hps; PrimType: Long; AttrMask: ULong; bunAttrs: PBundle): Long;
  4729.  
  4730. { global primitive functions }
  4731.  
  4732. function GpiSetBackColor(PS: Hps; Color: Long): Bool;
  4733. function GpiQueryBackColor(PS: Hps): Long;
  4734. function GpiSetMix(PS: Hps; MixMode: Long): Bool;
  4735. function GpiQueryMix(PS: Hps): Long;
  4736. function GpiSetBackMix(PS: Hps; MixMode: Long): Bool;
  4737. function GpiQueryBackMix(PS: Hps): Long;
  4738.  
  4739. { line primitive functions }
  4740.  
  4741. function GpiSetLineType(PS: Hps; LineType: Long): Bool;
  4742. function GpiQueryLineType(PS: Hps): Long;
  4743. function GpiSetLineWidth(PS: Hps; LineWidth: Fixed): Bool;
  4744. function GpiQueryLineWidth(PS: Hps): Fixed;
  4745. function GpiSetLineWidthGeom(PS: Hps; LineWidth: Long): Bool;
  4746. function GpiQueryLineWidthGeom(PS: Hps): Long;
  4747. function GpiSetLineEnd(PS: Hps; LineEnd: Long): Bool;
  4748. function GpiQueryLineEnd(PS: Hps): Long;
  4749. function GpiSetLineJoin(PS: Hps; LineJoin: Long): Bool;
  4750. function GpiQueryLineJoin(PS: Hps): Long;
  4751. function GpiSetCurrentPosition(PS: Hps; var ptlPoint: PointL): Bool;
  4752. function GpiQueryCurrentPosition(PS: Hps; var ptlPoint: PointL): Bool;
  4753.  
  4754. { arc primitive functions }
  4755.  
  4756. function GpiSetArcParams(PS: Hps; var Params: ArcParams): Bool;
  4757. function GpiQueryArcParams(PS: Hps; Params: ArcParams): Bool;
  4758. function GpiPointArc(PS: Hps; var ptl2: PointL): Long;
  4759. function GpiFullArc(PS: Hps; Control: Long; Multiplier: Fixed): Long;
  4760. function GpiPartialArc(PS: Hps; var ptlCenter: PointL;
  4761.   Multiplier,StartAngle,SweepAngle: Fixed): Long;
  4762. function GpiPolyFillet(PS: Hps; Count: Long; var aptlPoints: PointL): Long;
  4763. function GpiPolySpline(PS: Hps; Count: Long; var aptlPoints: PointL): Long;
  4764. function GpiPolyFilletSharp(PS: Hps; Count: Long; var aptlPoints: PointL;
  4765.   var afxPoints: Fixed): Long;
  4766.  
  4767. { area primitive functions }
  4768.  
  4769. function GpiSetPatternSet(PS: Hps; lSet: Long): Bool;
  4770. function GpiQueryPatternSet(PS: Hps): Long;
  4771. function GpiSetPatternRefPoint(PS: Hps; var ptlRefPoint: PointL): Bool;
  4772. function GpiQueryPatternRefPoint(PS: Hps; var ptlRefPoint: PointL): Bool;
  4773.  
  4774. { character primitive functions }
  4775.  
  4776. function GpiQueryCharStringPos(PS: Hps; Options: ULong; lCount: Long;
  4777.   chString: PChar; var alXincrements: Long; var aptlPositions: PointL): Bool;
  4778. function GpiQueryCharStringPosAt(PS: Hps; var ptlStartL: PointL; Options: ULong;
  4779.   Count: Long; chString: PChar; var alXincrements: Long; var aptlPositions: PointL): Bool;
  4780. function GpiQueryTextBox(PS: Hps; Count1:Long; chString: PChar; Count2: Long;
  4781.   var aptlPoints: PointL): Bool;
  4782. function GpiQueryDefCharBox(PS: Hps; var sizlsize: SizeL): Bool;
  4783. function GpiSetCharSet(PS: Hps; lcid: Long): Bool;
  4784. function GpiQueryCharSet(PS: Hps): Long;
  4785. function GpiSetCharBox(PS: Hps; var sizfxBox: SizeF): Bool;
  4786. function GpiQueryCharBox(PS: Hps; var sizfxSize: SizeF): Bool;
  4787. function GpiSetCharAngle(PS: Hps; var gradlAngle: GradientL): Bool;
  4788. function GpiQueryCharAngle(PS: Hps; var gradlAngle: GradientL): Bool;
  4789. function GpiSetCharShear(PS: Hps; var ptlAngle: PointL): Bool;
  4790. function GpiQueryCharShear(PS: Hps; ptlShear: PointL): Bool;
  4791. function GpiSetCharDirection(PS: Hps; Direction: Long): Bool;
  4792. function GpiQueryCharDirection(PS: Hps): Long;
  4793. function GpiSetCharMode(PS: Hps; Mode: Long): Bool;
  4794. function GpiQueryCharMode(PS: Hps): Long;
  4795. function GpiSetTextAlignment(PS: Hps; Horiz,Vert: Long): Bool;
  4796. function GpiQueryTextAlignment(PS: Hps; var Horiz,Vert: Long): Bool;
  4797. function GpiCharStringPos(PS: Hps; var rclRect: RectL; Options: ULong;
  4798.   Count: Long; chString: PChar; var alAdx: Long): Long;
  4799. function GpiCharStringPosAt(PS: Hps; var ptlStart: PointL; var rclRect: RectL;
  4800.   Options: ULong; Count: Long; chString: PChar; var alAdx: Long): Long;
  4801. function GpiSetCharExtra(PS: Hps; Extra: Fixed): Bool;
  4802. function GpiSetCharBreakExtra(PS: Hps; BreakExtra: Fixed): Bool;
  4803. function GpiQueryCharExtra(PS: Hps; var Extra: Fixed): Bool;
  4804. function GpiQueryCharBreakExtra(PS: Hps; var BreakExtra: Fixed): Bool;
  4805.  
  4806. { marker primitive functions  }
  4807.  
  4808. function GpiMarker(PS: Hps; var ptlPoint: PointL): Long;
  4809. function GpiPolyMarker(PS: Hps; Count: Long; var aptlPoints: PointL): Long;
  4810. function GpiSetMarker(PS: Hps; Symbol: Long): Bool;
  4811. function GpiSetMarkerBox(PS: Hps; var sizfxSize: SizeF): Bool;
  4812. function GpiSetMarkerSet(PS: Hps; lSet: Long): Bool;
  4813. function GpiQueryMarker(PS: Hps): Long;
  4814. function GpiQueryMarkerBox(PS: Hps; var sizfxSize: SizeF): Bool;
  4815. function GpiQueryMarkerSet(PS: Hps): Long;
  4816.  
  4817. { image primitive functions }
  4818.  
  4819. function GpiImage(PS: Hps; Format: Long; var sizlImageSize: SizeL;
  4820.   Length: Long; var Data): Long;
  4821.  
  4822. { miscellaneous primitive functions }
  4823.  
  4824. function GpiPop(PS: Hps; Count: Long): Bool;
  4825. function GpiPtVisible(PS: Hps; var ptlPoint: PointL): Long;
  4826. function GpiRectVisible(PS: Hps; var rclRectangle: RectL): Long;
  4827. function GpiComment(PS: Hps; Length: Long; var Data): Bool;
  4828.  
  4829. { return codes from GpiCreateLogFont }
  4830. const
  4831.   font_Default                  = 1;
  4832.   font_Match                    = 2;
  4833.  
  4834.   { lcid type for GpiQuerySetIds }
  4835.   lcidt_Font                    = 6;
  4836.   lcidt_BitMap                  = 7;
  4837.  
  4838.   { constant used to delete all lcids by GpiDeleteSetId }
  4839.   lcid_All                      = -1;
  4840.  
  4841. type
  4842.   { kerning data returned by GpiQueryKerningPairs }
  4843.   PKerningPairs = ^KerningPairs;
  4844.   KerningPairs = record
  4845.     sFirstChar:     SmallWord;
  4846.     sSecondChar:    SmallWord;
  4847.     lKerningAmount: Long;
  4848.   end;
  4849.  
  4850.   { data required by GpiQueryFaceString }
  4851.   PFaceNameDesc = ^FaceNameDesc;
  4852.   FaceNameDesc = record
  4853.     usSize:        SmallWord;
  4854.     usWeightClass: SmallWord;
  4855.     usWidthClass:  SmallWord;
  4856.     usReserved:    SmallWord;
  4857.     flOptions:     ULong;
  4858.   end;
  4859.  
  4860.   { FACENAMEDESC 'WeightClass' options for GpiQueryFaceString }
  4861.   const
  4862.   fweight_Dont_Care             = 0;
  4863.   fweight_Ultra_Light           = 1;
  4864.   fweight_Extra_Light           = 2;
  4865.   fweight_Light                 = 3;
  4866.   fweight_Semi_Light            = 4;
  4867.   fweight_Normal                = 5;
  4868.   fweight_Semi_Bold             = 6;
  4869.   fweight_Bold                  = 7;
  4870.   fweight_Extra_Bold            = 8;
  4871.   fweight_Ultra_Bold            = 9;
  4872.  
  4873.   { faceNAMEDESC 'WidthClass' options for GpiQueryFaceString }
  4874.   fwidth_Dont_Care              = 0;
  4875.   fwidth_Ultra_Condensed        = 1;
  4876.   fwidth_Extra_Condensed        = 2;
  4877.   fwidth_Condensed              = 3;
  4878.   fwidth_Semi_Condensed         = 4;
  4879.   fwidth_Normal                 = 5;
  4880.   fwidth_Semi_Expanded          = 6;
  4881.   fwidth_Expanded               = 7;
  4882.   fwidth_Extra_Expanded         = 8;
  4883.   fwidth_Ultra_Expanded         = 9;
  4884.  
  4885.   { FACENAMEDESC 'options' for GpiQueryFaceString }
  4886.   ftype_Italic                  = $0001;
  4887.   ftype_Italic_Dont_Care        = $0002;
  4888.   ftype_Oblique                 = $0004;
  4889.   ftype_Oblique_Dont_Care       = $0008;
  4890.   ftype_Rounded                 = $0010;
  4891.   ftype_Rounded_Dont_Care       = $0020;
  4892.  
  4893.   { actions for GpiQueryFontAction }
  4894.   qfa_Public                    = 1;
  4895.   qfa_Private                   = 2;
  4896.   qfa_Error                     = GPI_ALTERROR;
  4897.  
  4898.   { options for GpiQueryFonts }
  4899.   qf_Public                     = $0001;
  4900.   qf_Private                    = $0002;
  4901.   qf_No_Generic                 = $0004;
  4902.   qf_No_Device                  = $0008;
  4903.  
  4904. { font file descriptions for GpiQueryFontFileDescriptions }
  4905. type
  4906.   PFfDescs  = ^FfDescS;
  4907.   FfDescs   = array [0..1,0..FaceSize-1] of Char;
  4908.   PFfDescs2 = ^FfDescs2;
  4909.   FfDescs2  = record
  4910.     cbLength:         ULong;
  4911.     cbFacenameOffset: ULong;
  4912.     abFamilyName: array[0..0] of Byte;
  4913.   end;
  4914.  
  4915. { physical and logical font functions }
  4916.  
  4917. function GpiCreateLogFont(PS: Hps; Name: PStr8; Lcid: Long; var fatAttrs: FAttrs): Long;
  4918. function GpiDeleteSetId(PS: Hps; Lcid: Long): Bool;
  4919. function GpiLoadFonts(Ab: Hab; Filename: PChar): Bool;
  4920. function GpiUnloadFonts(Ab: Hab; Filename: PChar): Bool;
  4921. function GpiQueryFonts(PS: Hps; Options: ULong; Facename: PChar; var ReqFonts: Long;
  4922.   MetricsLength: Long; afmMetrics: pFontMetrics): Long;
  4923. function GpiQueryFontMetrics(PS: Hps; MetricsLength: Long; var fmMetrics: FontMetrics): Bool;
  4924. function GpiQueryKerningPairs(PS: Hps; Count: Long; var akrnprData: KerningPairs): Long;
  4925. function GpiQueryWidthTable(PS: Hps; FirstChar,Count: Long; var alData: Long): Bool;
  4926. function GpiQueryNumberSetIds(PS: Hps): Long;
  4927. function GpiQuerySetIds(PS: Hps; Count: Long; var alTypes: Long; var aNames: Str8;
  4928.   var allcids: Long): Bool;
  4929. function GpiQueryFaceString(PS: Hps; FamilyName: PChar; var attrs: FaceNameDesc;
  4930.   length: Long; CompoundFaceName: PChar): ULong;
  4931. function GpiQueryLogicalFont(PS: Hps; cid: Long; var Name: Str8; var attrs: FAttrs;
  4932.   Length: Long): Bool;
  4933. function GpiQueryFontAction(AB: Hab; Options: ULong): ULong;
  4934. function GpiLoadPublicFonts(AB: Hab; Filename: PChar): Bool;
  4935. function GpiUnloadPublicFonts(AB: Hab; Filename: PChar): Bool;
  4936. function GpiSetCp(PS: Hps; CodePage: ULong): Bool;
  4937. function GpiQueryCp(PS: Hps): ULong;
  4938. function GpiQueryFontFileDescriptions(Ab: Hab; Filename: PChar;
  4939.   var Count: Long; var affdescsNames: FfDescs): Long;
  4940. function GpiQueryFullFontFileDescs(Ab: Hab; Filename: PChar;
  4941.   var Count: Long; var Names; var NamesBuffLength: Long): Long;
  4942.  
  4943. { raster operations defined for GpiBitBlt }
  4944. const
  4945.   rop_SrcCopy                   = $00CC;
  4946.   rop_SrcPaint                  = $00EE;
  4947.   rop_SrcAnd                    = $0088;
  4948.   rop_SrcInvert                 = $0066;
  4949.   rop_SrcErase                  = $0044;
  4950.   rop_NotSrcCopy                = $0033;
  4951.   rop_NotSrcErase               = $0011;
  4952.   rop_MergeCopy                 = $00C0;
  4953.   rop_MergePaint                = $00BB;
  4954.   rop_PatCopy                   = $00F0;
  4955.   rop_PatPaint                  = $00FB;
  4956.   rop_PatInvert                 = $005A;
  4957.   rop_DstInvert                 = $0055;
  4958.   rop_Zero                      = $0000;
  4959.   rop_One                       = $00FF;
  4960.  
  4961.   { Blt options for GpiBitBlt }
  4962.   bbo_Or                        = 0;
  4963.   bbo_And                       = 1;
  4964.   bbo_Ignore                    = 2;
  4965.   bbo_Pal_Colors                = 4;
  4966.   bbo_No_Color_Info             = 8;
  4967.  
  4968.   { Fill options for GpiFloodFill }
  4969.   ff_Boundary                   = 0;
  4970.   ff_Surface                    = 1;
  4971.  
  4972.   { error return for GpiSetBitmap }
  4973.   hbm_Error                     = HBitMap(-1);
  4974.  
  4975. { bitmap and pel functions }
  4976.  
  4977. function GpiBitBlt(Target,Src: Hps; Count: Long; var aptlPoints: PointL;
  4978.   Rop: Long; Options: ULong): Long;
  4979. function GpiDeleteBitmap(BitMap: HBitMap): Bool;
  4980. function GpiLoadBitmap(PS: Hps; Resource: HModule; idBitmap: ULong;
  4981.   Width,Height: Long): HBitMap;
  4982. function GpiSetBitmap(PS: Hps; Bitmap: HBitMap): HBitMap;
  4983. function GpiWCBitBlt(PS: Hps; Src: HBitMap; Count: Long; var aptlPoints: PointL;
  4984.   Rop: Long; Options: ULong): Long;
  4985.  
  4986. { bitmap structures and file formats (from PMBITMAP.H) }
  4987.  
  4988. { This is the file format structure for Bit Maps, Pointers and Icons    }
  4989. { as stored in the resource file of a PM application.                   }
  4990. {                                                                       }
  4991. { Notes on file format:                                                 }
  4992. {                                                                       }
  4993. { Each BITMAPFILEHEADER entry is immediately followed by the color table}
  4994. { for the bit map bits it references.                                   }
  4995. { Icons and Pointers contain two BITMAPFILEHEADERs for each ARRAYHEADER }
  4996. { item.  The first one is for the ANDXOR mask, the second is for the    }
  4997. { COLOR mask.  All offsets are absolute based on the start of the FILE. }
  4998. {                                                                       }
  4999. { For OS/2 Version 2.0 and later BITMAPFILEHEADER2 and the other '2'    }
  5000. { versions of each structure are recommended. Use the non-2 versions    }
  5001. { of each structure if compatibility with OS/2 Version 1.X is required. }
  5002.  
  5003. { bitmap parameterization used by GpiCreateBitmap and others }
  5004. type
  5005.   PBitMapInfoHeader = ^BitMapInfoHeader;
  5006.   BitMapInfoHeader = record
  5007.     cbFix:     ULong;
  5008.     cx:        SmallWord;
  5009.     cy:        SmallWord;
  5010.     cPlanes:   SmallWord;
  5011.     cBitCount: SmallWord;
  5012.   end;
  5013.  
  5014.   { RGB data for _BITMAPINFO struct }
  5015.   RGB = record
  5016.     bBlue:  Byte;
  5017.     bGreen: Byte;
  5018.     bRed:   Byte;
  5019.   end;
  5020.  
  5021.   { bitmap data used by GpiSetBitmapBits and others }
  5022.   PBitMapInfo = ^BitMapInfo;
  5023.   BitMapInfo = record
  5024.     cbFix:        ULong;
  5025.     cx:           SmallWord;
  5026.     cy:           SmallWord;
  5027.     cPlanes:      SmallWord;
  5028.     cBitCount:    SmallWord;
  5029.     argbColor: array[0..0] of RGB;
  5030.   end;
  5031.  
  5032. { Constants for compression/decompression command }
  5033. const
  5034.   cbd_Compression               = 1;
  5035.   cbd_DeCompression             = 2;
  5036.   cbd_Bits                      = 0;
  5037.  
  5038.   { Flags for compression/decompression option }
  5039.  
  5040.   cbd_Color_Conversion          = $00000001;
  5041.  
  5042.   { Compression scheme in the ulCompression field of the bitmapinfo structure }
  5043.  
  5044.   bca_Uncomp                    = 0;
  5045.   bca_Huffman1d                 = 3;
  5046.   bca_Rle4                      = 2;
  5047.   bca_Rle8                      = 1;
  5048.   bca_Rle24                     = 4;
  5049.  
  5050.   bru_Metric                    = 0;
  5051.  
  5052.   bra_BottomUp                  = 0;
  5053.  
  5054.   brh_NotHalfToned              = 0;
  5055.   brh_ErrorDiffusion            = 1;
  5056.   brh_Panda                     = 2;
  5057.   brh_SuperCircle               = 3;
  5058.  
  5059.   bce_Palette                   = -1;
  5060.   bce_Rgb                       = 0;
  5061.  
  5062. type
  5063.   PBitMapInfoHeader2 = ^BitMapInfoHeader2;
  5064.   BitMapInfoHeader2 = record
  5065.     cbFix:           ULong;     { Length of structure                    }
  5066.     cx:              ULong;     { Bit-map width in pels                  }
  5067.     cy:              ULong;     { Bit-map height in pels                 }
  5068.     cPlanes:         SmallWord; { Number of bit planes                   }
  5069.     cBitCount:       SmallWord; { Number of bits per pel within a plane  }
  5070.     ulCompression:   ULong;     { Compression scheme used to store the bitmap }
  5071.     cbImage:         ULong;     { Length of bit-map storage data in bytes}
  5072.     cxResolution:    ULong;     { x resolution of target device          }
  5073.     cyResolution:    ULong;     { y resolution of target device          }
  5074.     cclrUsed:        ULong;     { Number of color indices used           }
  5075.     cclrImportant:   ULong;     { Number of important color indices      }
  5076.     usUnits:         SmallWord; { Units of measure                       }
  5077.     usReserved:      SmallWord; { Reserved                               }
  5078.     usRecording:     SmallWord; { Recording algorithm                    }
  5079.     usRendering:     SmallWord; { Halftoning algorithm                   }
  5080.     cSize1:          ULong;     { Size value 1                           }
  5081.     cSize2:          ULong;     { Size value 2                           }
  5082.     ulColorEncoding: ULong;     { Color encoding                         }
  5083.     ulIdentifier:    ULong;     { Reserved for application use           }
  5084.   end;
  5085.  
  5086.   PRGB2 = ^RGB2;
  5087.   RGB2 = record
  5088.     bBlue:     Byte;            { Blue component of the color definition }
  5089.     bGreen:    Byte;            { Green component of the color definition}
  5090.     bRed:      Byte;            { Red component of the color definition  }
  5091.     fcOptions: Byte;            { Reserved, must be zero                 }
  5092.    end;
  5093.  
  5094.    PBitMapInfo2 = ^BitMapInfo2;
  5095.    BitMapInfo2 = record
  5096.      cbFix:           ULong;    { Length of fixed portion of structure   }
  5097.      cx:              ULong;    { Bit-map width in pels                  }
  5098.      cy:              ULong;    { Bit-map height in pels                 }
  5099.      cPlanes:         SmallWord;{ Number of bit planes                   }
  5100.      cBitCount:       SmallWord;{ Number of bits per pel within a plane  }
  5101.      ulCompression:   ULong;    { Compression scheme used to store the bitmap }
  5102.      cbImage:         ULong;    { Length of bit-map storage data in bytes}
  5103.      cxResolution:    ULong;    { x resolution of target device          }
  5104.      cyResolution:    ULong;    { y resolution of target device          }
  5105.      cclrUsed:        ULong;    { Number of color indices used           }
  5106.      cclrImportant:   ULong;    { Number of important color indices      }
  5107.      usUnits:         SmallWord;{ Units of measure                       }
  5108.      usReserved:      SmallWord;{ Reserved                               }
  5109.      usRecording:     SmallWord;{ Recording algorithm                    }
  5110.      usRendering:     SmallWord;{ Halftoning algorithm                   }
  5111.      cSize1:          ULong;    { Size value 1                           }
  5112.      cSize2:          ULong;    { Size value 2                           }
  5113.      ulColorEncoding: ULong;    { Color encoding                         }
  5114.      ulIdentifier:    ULong;    { Reserved for application use           }
  5115.      argbColor: array [0..0] of RGB2; { Color definition record          }
  5116.   end;
  5117.  
  5118.   PBitMapFileHeader = ^BitMapFileHeader;
  5119.   BitMapFileHeader = record
  5120.     usType:   SmallWord;
  5121.     cbSize:   ULong;
  5122.     xHotspot: SmallInt;
  5123.     yHotspot: SmallInt;
  5124.     offBits:  ULong;
  5125.     bmp:      BitMapInfoHeader;
  5126.   end;
  5127.  
  5128.   PBitMapArrayFileHeader = ^BitMapArrayFileHeader;
  5129.   BitMapArrayFileHeader = record
  5130.     usType:    SmallWord;
  5131.     cbSize:    ULong;
  5132.     offNext:   ULong;
  5133.     cxDisplay: SmallWord;
  5134.     cyDisplay: SmallWord;
  5135.     bfh:       BitMapFileHeader;
  5136.   end;
  5137.  
  5138.   PBitMapFileHeader2 = ^BitMapFileHeader2;
  5139.   BitMapFileHeader2 = record
  5140.     usType:   SmallWord;
  5141.     cbSize:   ULong;
  5142.     xHotspot: SmallInt;
  5143.     yHotspot: SmallInt;
  5144.     offBits:  ULong;
  5145.     bmp2:     BitMapInfoHeader2;
  5146.   end;
  5147.  
  5148.   PBitMapArrayFileHeader2 = ^BitMapArrayFileHeader2;
  5149.   BitMapArrayFileHeader2 = record
  5150.     usType:    SmallWord;
  5151.     cbSize:    ULong;
  5152.     offNext:   ULong;
  5153.     cxDisplay: SmallWord;
  5154.     cyDisplay: SmallWord;
  5155.     bfh2:      BitMapFileHeader2;
  5156.   end;
  5157.  
  5158. { These are the identifying values that go in the usType field of the }
  5159. { BitMapFileHeader(2) and BitMapArrayFileHeader(2).                   }
  5160. { (bft_ => Bit map File Type                                          }
  5161. const
  5162.   bft_Icon                      = $4349;   { 'IC' }
  5163.   bft_BMap                      = $4D42;   { 'BM' }
  5164.   bft_Pointer                   = $5450;   { 'PT' }
  5165.   bft_ColorIcon                 = $4943;   { 'CI' }
  5166.   bft_ColorPointer              = $5043;   { 'CP' }
  5167.   bft_BitMapArray               = $4142;   { 'BA' }
  5168.  
  5169.   { usage flags for GpiCreateBitmap }
  5170.   cbm_Init                      = $0004;
  5171.  
  5172.   { error return code for GpiSet/QueryBitmapBits }
  5173.   bmb_Error                             = -1;
  5174.  
  5175. { bitmap and pel functions }
  5176.  
  5177. function GpiCreateBitmap(PS: Hps; var bmpNew: BitMapInfoHeader2; Options: ULong;
  5178.   var InitData; var bmiInfoTable: BitMapInfo2): HBitMap;
  5179. function GpiSetBitmapBits(PS: Hps; ScanStart,Scans: Long; var Buffer;
  5180.   var bmiInfoTable: BitMapInfo2): Long;
  5181. function GpiSetBitmapDimension(BitMap: HBitMap; var sizlBitmapDimension: SizeL): Bool;
  5182. function GpiSetBitmapId(PS: Hps; BitMap: HBitMap; Lcid: Long): Bool;
  5183. function GpiQueryBitmapBits(PS: Hps; ScanStart,Scans: Long; var Buffer;
  5184.   var bmiInfoTable: BitMapInfo2): Long;
  5185. function GpiQueryBitmapDimension(BitMap: HBitMap; var sizlBitmapDimension: SizeL): Bool;
  5186. function GpiQueryBitmapHandle(PS: Hps; Lcid: Long): HBitMap;
  5187. function GpiQueryBitmapParameters(BitMap: HBitMap; var bmpData: BitMapInfoHeader): Bool;
  5188. function GpiQueryBitmapInfoHeader(BitMap: HBitMap; var bmpData: BitMapInfoHeader2): Bool;
  5189. function GpiQueryDeviceBitmapFormats(PS: Hps; Count: Long; var alArray: Long): Bool;
  5190. function GpiSetPel(PS: Hps; var ptlPoint: PointL): Long;
  5191. function GpiQueryPel(PS: Hps; var ptlPoint: PointL): Long;
  5192. function GpiFloodFill(PS: Hps; Options,Color: Long): Long;
  5193. function GpiDrawBits(PS: Hps; var Bits; bmiInfoTable: BitMapInfo2; Count: Long;
  5194.   var aptlPoints: PointL; Rop: Long; Options: ULong): Long;
  5195.  
  5196. { options for GpiCombineRegion }
  5197. const
  5198.   crgn_Or                       = 1;
  5199.   crgn_Copy                     = 2;
  5200.   crgn_Xor                      = 4;
  5201.   crgn_And                      = 6;
  5202.   crgn_Diff                     = 7;
  5203.  
  5204.   { usDirection of returned region data for GpiQueryRegionRects }
  5205.   rectdir_LfRt_TopBot           = 1;
  5206.   rectdir_RtLf_TopBot           = 2;
  5207.   rectdir_LfRt_BotTop           = 3;
  5208.   rectdir_RtLf_BotTop           = 4;
  5209.  
  5210. { control data for GpiQueryRegionRects }
  5211. type
  5212.   PRgnRect = ^RgnRect;
  5213.   RgnRect = record
  5214.     ircStart:    ULong;
  5215.     crc:         ULong;
  5216.     crcReturned: ULong;
  5217.     ulDirection: ULong;
  5218.   end;
  5219.  
  5220. { return code to indicate type of region for GpiCombineRegion and others }
  5221. const
  5222.   rgn_Error                     = 0;
  5223.   rgn_Null                      = 1;
  5224.   rgn_Rect                      = 2;
  5225.   rgn_Complex                   = 3;
  5226.  
  5227.   { return codes for GpiPtInRegion }
  5228.   prgn_Error                    = 0;
  5229.   prgn_Outside                  = 1;
  5230.   prgn_Inside                   = 2;
  5231.  
  5232.   { return codes for GpiRectInRegion }
  5233.   rrgn_Error                    = 0;
  5234.   rrgn_Outside                  = 1;
  5235.   rrgn_Partial                  = 2;
  5236.   rrgn_Inside                   = 3;
  5237.  
  5238.   { return codes for GpiEqualRegion }
  5239.   eqrgn_Error                   = 0;
  5240.   eqrgn_NotEqual                = 1;
  5241.   eqrgn_Equal                   = 2;
  5242.  
  5243.   { error return code for GpiSetRegion }
  5244.   hrgn_Error                    = HRgn(-1);
  5245.  
  5246.   { main region functions }
  5247. function GpiCombineRegion(PS: Hps; Dest,Src1,Src2: HRgn; Mode: Long): Long;
  5248. function GpiCreateRegion(PS: Hps; Count: Long; arclRectangles: pRectL): HRgn;
  5249. function GpiDestroyRegion(PS: Hps; Rgn: HRgn): Bool;
  5250. function GpiEqualRegion(PS: Hps; Src1,Src2: HRgn): Long;
  5251. function GpiOffsetRegion(PS: Hps; Rgn: HRgn; var ptlOffset: PointL): Bool;
  5252. function GpiPaintRegion(PS: Hps; Rgn: HRgn): Long;
  5253. function GpiFrameRegion(PS: Hps; Rgn: HRgn; var thickness: SizeL): Long;
  5254. function GpiPtInRegion(PS: Hps; Rgn: HRgn; var ptlPoint: PointL): Long;
  5255. function GpiQueryRegionBox(PS: Hps; Rgn: HRgn; var rclBound: RectL): Long;
  5256. function GpiQueryRegionRects(PS: Hps; Rgn: HRgn; var rclBound: RectL;
  5257.   var rgnrcControl: RgnRect; var rclRect: RectL): Bool;
  5258. function GpiRectInRegion(PS: Hps; Rgn: HRgn; var rclRect: RectL): Long;
  5259. function GpiSetRegion(PS: Hps; Rgn: HRgn; Count: Long; var arclRectangles: RectL): Bool;
  5260.  
  5261. { clip region functions }
  5262.  
  5263. function GpiSetClipRegion(PS: Hps; Rgn: HRgn; var RgnOld: HRgn): Long;
  5264. function GpiQueryClipRegion(PS: Hps): HRgn;
  5265. function GpiQueryClipBox(PS: Hps; var rclBound: RectL): Long;
  5266. function GpiExcludeClipRectangle(PS: Hps; var rclRectangle: RectL): Long;
  5267. function GpiIntersectClipRectangle(PS: Hps; var rclRectangle: RectL): Long;
  5268. function GpiOffsetClipRegion(PS: Hps; var ptlPoint: PointL): Long;
  5269.  
  5270. { constants for index values of options array for GpiPlayMetaFile }
  5271. const
  5272.   pmf_SegBase                   = 0;
  5273.   pmf_LoadType                  = 1;
  5274.   pmf_Resolve                   = 2;
  5275.   pmf_Lcids                     = 3;
  5276.   pmf_Reset                     = 4;
  5277.   pmf_Suppress                  = 5;
  5278.   pmf_ColorTables               = 6;
  5279.   pmf_ColorRealizable           = 7;
  5280.   pmf_Defaults                  = 8;
  5281.   pmf_DeleteObjects             = 9;
  5282.  
  5283.   { options for GpiPlayMetaFile }
  5284.   rs_Default                    = 0;
  5285.   rs_NoDiscard                  = 1;
  5286.   lc_Default                    = 0;
  5287.   lc_Noload                     = 1;
  5288.   lc_LoadDisc                   = 3;
  5289.   lt_Default                    = 0;
  5290.   lt_NoModify                   = 1;
  5291.   lt_OriginalView               = 4;
  5292.   res_Default                   = 0;
  5293.   res_NoReset                   = 1;
  5294.   res_Reset                     = 2;
  5295.   sup_Default                   = 0;
  5296.   sup_NoSuppress                = 1;
  5297.   sup_Suppress                  = 2;
  5298.   ctab_Default                  = 0;
  5299.   ctab_NoModify                 = 1;
  5300.   ctab_Replace                  = 3;
  5301.   ctab_ReplacePalette           = 4;
  5302.   crea_Default                  = 0;
  5303.   crea_Realize                  = 1;
  5304.   crea_NoRealize                = 2;
  5305.   crea_DoRealize                = 3;
  5306.  
  5307.   ddef_Default                  = 0;
  5308.   ddef_Ignore                   = 1;
  5309.   ddef_Loaddisc                 = 3;
  5310.   dobj_Default                  = 0;
  5311.   dobj_Nodelete                 = 1;
  5312.   dobj_Delete                   = 2;
  5313.   rsp_Default                   = 0;
  5314.   rsp_NoDiscard                 = 1;
  5315.  
  5316. { MetaFile functions }
  5317.  
  5318. function GpiCopyMetaFile(MF: Hmf): Hmf;
  5319. function GpiDeleteMetaFile(MF: Hmf): Bool;
  5320. function GpiLoadMetaFile(Ab: Hab; Filename: PChar): Hmf;
  5321. function GpiPlayMetaFile(PS: Hps; MF: Hmf; Count1: Long; var alOptarray,lSegCount: Long;
  5322.   Count2: Long; Desc: PChar): Long;
  5323. function GpiQueryMetaFileBits(MF: Hmf; Offset,Length: Long; var Data): Bool;
  5324. function GpiQueryMetaFileLength(MF: Hmf): Long;
  5325. function GpiSaveMetaFile(MF: Hmf; Filename: PChar): Bool;
  5326. function GpiSetMetaFileBits(MF: Hmf; Offset,Length: Long; var Buffer): Bool;
  5327.  
  5328. { default functions }
  5329.  
  5330. function GpiQueryDefArcParams(PS: Hps; var arcpArcParams: ArcParams): Bool;
  5331. function GpiQueryDefAttrs(PS: Hps; PrimType: Long; flAttrMask: ULong; bunAttr: PBundle): Bool;
  5332. function GpiQueryDefTag(PS: Hps; var Tag: Long): Bool;
  5333. function GpiQueryDefViewingLimits(PS: Hps; var rclLimits: RectL): Bool;
  5334. function GpiSetDefArcParams(PS: Hps; arcpArcParams: ArcParams): Bool;
  5335. function GpiSetDefAttrs(PS: Hps; PrimType: Long; AttrMask: ULong; bunAttrs: PBundle): Bool;
  5336. function GpiSetDefTag(PS: Hps; Tag: Long): Bool;
  5337. function GpiSetDefViewingLimits(PS: Hps; var rclLimits: RectL): Bool;
  5338.  
  5339. type
  5340.   PPolygon = ^Polygon;
  5341.   Polygon = record
  5342.     ulPoints: ULong;
  5343.     aPointl:  PPointL;
  5344.   end;
  5345.  
  5346.   PPolySet = ^PolySet;
  5347.   PolySet = record
  5348.     ulPolys:     ULong;
  5349.     aPolygon: array [0..0] of Polygon;
  5350.   end;
  5351.  
  5352. { control flags used by GpiPolygons }
  5353. const
  5354.   polygon_NoBoundary            = 0;
  5355.   polygon_Boundary              = $0001;
  5356.  
  5357.   polygon_Alternate             = 0;
  5358.   polygon_Winding               = $0002;
  5359.  
  5360.   polygon_Excl                  = 0;
  5361.   polygon_Incl                  = $0008;
  5362.  
  5363. { default function }
  5364.  
  5365. function GpiPolygons(PS: Hps; Count: ULong; var aplgn: Polygon; Options,Model: ULong): Long;
  5366.  
  5367. { General DEV return values }
  5368.  
  5369. const
  5370.   dev_Error                     = 0;
  5371.   dev_Ok                        = 1;
  5372.  
  5373. { DC type for DevOpenDC }
  5374.   od_Queued                     = 2;
  5375.   od_Direct                     = 5;
  5376.   od_Info                       = 6;
  5377.   od_Metafile                   = 7;
  5378.   od_Memory                     = 8;
  5379.   od_Metafile_NoQuery           = 9;
  5380.  
  5381. { Codes for DevQueryCaps }
  5382.   caps_Family                   = 0;
  5383.   caps_Io_Caps                  = 1;
  5384.   caps_Technology               = 2;
  5385.   caps_Driver_Version           = 3;
  5386.   caps_Width                    = 4;    { pels }
  5387.   caps_Height                   = 5;    { pels }
  5388.   caps_Width_In_Chars           = 6;
  5389.   caps_Height_In_Chars          = 7;
  5390.   caps_Horizontal_Resolution    = 8;    { pels per meter }
  5391.   caps_Vertical_Resolution      = 9;    { pels per meter }
  5392.   caps_Char_Width               = 10;   { pels }
  5393.   caps_Char_Height              = 11;   { pels }
  5394.   caps_Small_Char_Width         = 12;   { pels }
  5395.   caps_Small_Char_Height        = 13;   { pels }
  5396.   caps_Colors                   = 14;
  5397.   caps_Color_Planes             = 15;
  5398.   caps_Color_BitCount           = 16;
  5399.   caps_Color_Table_Support      = 17;
  5400.   caps_Mouse_Buttons            = 18;
  5401.   caps_Foreground_Mix_Support   = 19;
  5402.   caps_Background_Mix_Support   = 20;
  5403.   caps_Device_Windowing         = 31;
  5404.   caps_Additional_Graphics      = 32;
  5405.   caps_Vio_Loadable_Fonts       = 21;
  5406.   caps_Window_Byte_Alignment    = 22;
  5407.   caps_Bitmap_Formats           = 23;
  5408.   caps_Raster_Caps              = 24;
  5409.   caps_Marker_Height            = 25;   { pels }
  5410.   caps_Marker_Width             = 26;   { pels }
  5411.   caps_Device_Fonts             = 27;
  5412.   caps_Graphics_Subset          = 28;
  5413.   caps_Graphics_Version         = 29;
  5414.   caps_Graphics_Vector_Subset   = 30;
  5415.   caps_Phys_Colors              = 33;
  5416.   caps_Color_Index              = 34;
  5417.   caps_Graphics_Char_Width      = 35;
  5418.   caps_Graphics_Char_Height     = 36;
  5419.   caps_Horizontal_Font_Res      = 37;
  5420.   caps_Vertical_Font_Res        = 38;
  5421.   caps_Device_Font_Sim          = 39;
  5422.   caps_LineWidth_Thick          = 40;
  5423.   caps_Device_Polyset_Points    = 41;
  5424.  
  5425. { Constants for CAPS_IO_CAPS }
  5426.   caps_Io_Dummy                 = 1;
  5427.   caps_Io_Supports_Op           = 2;
  5428.   caps_Io_Supports_Ip           = 3;
  5429.   caps_Io_Supports_Io           = 4;
  5430.  
  5431. { Constants for caps_Technology }
  5432.   caps_Tech_Unknown             = 0;
  5433.   caps_Tech_Vector_Plotter      = 1;
  5434.   caps_Tech_Raster_Display      = 2;
  5435.   caps_Tech_Raster_Printer      = 3;
  5436.   caps_Tech_Raster_Camera       = 4;
  5437.   caps_Tech_PostScript          = 5;
  5438.  
  5439. { Constants for caps_Color_Table_Support }
  5440.   caps_Coltabl_Rgb_8            = 1;
  5441.   caps_Coltabl_Rgb_8_Plus       = 2;
  5442.   caps_Coltabl_True_Mix         = 4;
  5443.   caps_Coltabl_Realize          = 8;
  5444.  
  5445. { Constants for caps_Foreground_Mix_Support }
  5446.   caps_Fm_Or                    = 1;
  5447.   caps_Fm_Overpaint             = 2;
  5448.   caps_Fm_Xor                   = 8;
  5449.   caps_Fm_Leavealone            = 16;
  5450.   caps_Fm_And                   = 32;
  5451.   caps_Fm_General_Boolean       = 64;
  5452.  
  5453. { Constants for caps_Background_Mix_Support }
  5454.   caps_Bm_Or                    = 1;
  5455.   caps_Bm_OverPaint             = 2;
  5456.   caps_Bm_Xor                   = 8;
  5457.   caps_Bm_LeaveAlone            = 16;
  5458.   caps_Bm_And                   = 32;
  5459.   caps_Bm_General_Boolean       = 64;
  5460.   caps_Bm_SrcTransparent        = 128;
  5461.   caps_Bm_DestTransparent       = 256;
  5462.  
  5463. { Constants for caps_Device_Windowing }
  5464.   caps_Dev_Windowing_Support    = 1;
  5465.  
  5466. { Constants for caps_Dev_Font_Sim     }
  5467.   caps_Dev_Font_Sim_Bold        = 1;
  5468.   caps_Dev_Font_Sim_Italic      = 2;
  5469.   caps_Dev_Font_Sim_Underscore  = 4;
  5470.   caps_Dev_Font_Sim_Strikeout   = 8;
  5471.  
  5472. { Constants for caps_Additional_Graphics }
  5473.   caps_Vdd_Ddb_Transfer         = 1;
  5474.   caps_Graphics_Kerning_Support = 2;
  5475.   caps_Font_Outline_Default     = 4;
  5476.   caps_Font_Image_Default       = 8;
  5477. { bits represented by values 16 and 32 are reserved }
  5478.   caps_Scaled_Default_Markers   = 64;
  5479.   caps_Color_Cursor_Support     = 128;
  5480.   caps_Palette_Manager          = 256;
  5481.   caps_Cosmetic_WideLine_Support = 512;
  5482.   caps_Direct_Fill              = 1024;
  5483.   caps_Rebuild_Fills            = 2048;
  5484.   caps_Clip_Fills               = $00001000 { 4096  };
  5485.   caps_Enhanced_FontMetrics     = $00002000 { 8192  };
  5486.   caps_Transform_Support        = $00004000 { 16384 };
  5487.   caps_External_16_BitCount     = $00008000 { 32768 };
  5488.  
  5489. { Constants for caps_Window_Byte_Alignment }
  5490.   caps_Byte_Align_Required      = 0;
  5491.   caps_Byte_Align_Recommended   = 1;
  5492.   caps_Byte_Align_Not_Required  = 2;
  5493.  
  5494. { Constants for caps_Raster_Caps }
  5495.   caps_Raster_Bitblt            = 1;
  5496.   caps_Raster_Banding           = 2;
  5497.   caps_Raster_Bitblt_Scaling    = 4;
  5498.   caps_Raster_Set_Pel           = 16;
  5499.   caps_Raster_Fonts             = 32;
  5500.   caps_Raster_Flood_Fill        = 64;
  5501.  
  5502. function DevOpenDC(AB: HAB; lType: Long; Token: PChar; Count: Long;
  5503.   dopData: Pointer; dcComp: HDC): HDC;
  5504.  
  5505. function DevCloseDC(DC: HDC): HMF;
  5506.  
  5507. function DevQueryCaps(DC: HDC; Start,Count: Long; var lArray: Long): Bool;
  5508.  
  5509. { Records for devesc_QueryVioCellSizes }
  5510. type
  5511.   PVioSizeCount = ^VioSizeCount;
  5512.   VioSizeCount = record
  5513.     maxcount: Long;
  5514.     count:    Long;
  5515.   end;
  5516.  
  5517.   PVioFontCellSize = ^VioFontCellSize;
  5518.   VioFontCellSize = record
  5519.     cx: Long;
  5520.     cy: Long;
  5521.   end;
  5522.  
  5523. { Record for devesc_GetScalingFactor }
  5524.  
  5525.   PSFactors = ^SFactors;
  5526.   SFactors = record
  5527.     x: Long;
  5528.     y: Long;
  5529.   end;
  5530.  
  5531. { Record for devesc_NextBand }
  5532.  
  5533.   PBandRect = ^BandRect;
  5534.   BandRect = record
  5535.     xleft:   Long;
  5536.     ybottom: Long;
  5537.     xright:  Long;
  5538.     ytop:    Long;
  5539.   end;
  5540.  
  5541. { Return codes for DevEscape }
  5542. const
  5543.   devesc_Error                  = -1;
  5544.   devesc_NotImplemented         = 0;
  5545.  
  5546. { codes for DevEscape }
  5547.   devesc_QueryEscSupport        = 0;
  5548.   devesc_GetScalingFactor       = 1;
  5549.   devesc_QueryVioCellSizes      = 2;
  5550.   devesc_GetCp                  = 8000;
  5551.  
  5552.   devesc_StartDoc               = 8150;
  5553.   devesc_EndDoc                 = 8151;
  5554.   devesc_NextBand               = 8152;
  5555.   devesc_AbortDoc               = 8153;
  5556.  
  5557.   devesc_NewFrame               = 16300;
  5558.   devesc_DraftMode              = 16301;
  5559.   devesc_FlushOutput            = 16302;
  5560.   devesc_RawData                = 16303;
  5561.   devesc_SetMode                = 16304;
  5562.  
  5563.   devesc_Dbe_First              = 24450;
  5564.   devesc_Dbe_Last               = 24455;
  5565.  
  5566. { DevEscape codes for adding extra space to character strings }
  5567.   devesc_Char_Extra             = 16998;
  5568.   devesc_Break_Extra            = 16999;
  5569.  
  5570. { Codes for DevEscape PM_Q_ESC spool files }
  5571.   devesc_Std_Journal            = 32600;
  5572.  
  5573. { Record for devesc_SetMode }
  5574. type
  5575.   PEscMode = ^EscMode;
  5576.   EscMode = record
  5577.     mode:     ULong;
  5578.     modedata: array[0..0] of Byte;
  5579.   end;
  5580.  
  5581. { Specific case of EscMode, used to set the code page of a printer }
  5582.   PEscSetMode = ^EscSetMode;
  5583.   EscSetMode = record
  5584.     mode:     ULong;
  5585.     CodePage: UShort;
  5586.   end;
  5587.  
  5588. { Return codes for DevPostDeviceModes }
  5589. const
  5590.   dpdm_Error                    = -1;
  5591.   dpdm_None                     = 0;
  5592.  
  5593. { Codes for DevPostDeviceModes }
  5594.   dpdm_PostJobProp              = 0;
  5595.   dpdm_ChangeProp               = 1;
  5596.   dpdm_QueryJobProp             = 2;
  5597.  
  5598. { String types for DevQueryDeviceNames }
  5599. type
  5600.   Str16 = array [0..15] of Char;
  5601.   Str32 = array [0..31] of Char;
  5602.   Str64 = array [0..63] of Char;
  5603.   PStr16 = ^Str16;
  5604.   PStr32 = ^Str32;
  5605.   PStr64 = ^Str64;
  5606.  
  5607. { Return code for DevQueryHardcopyCaps }
  5608. const
  5609.   dqhc_Error                    = -1;
  5610.  
  5611. { codes for DevQueryHardcopyCaps }
  5612.   hcaps_Current                 = 1;
  5613.   hcaps_Selectable              = 2;
  5614.  
  5615. { Record for DevQueryHardcopyCaps }
  5616. type
  5617.   PHcInfo = ^HcInfo;
  5618.   HcInfo = record
  5619.     szFormname: array [0..31] of Char;
  5620.     cx:             Long;
  5621.     cy:             Long;
  5622.     xLeftClip:      Long;
  5623.     yBottomClip:    Long;
  5624.     xRightClip:     Long;
  5625.     yTopClip:       Long;
  5626.     xPels:          Long;
  5627.     yPels:          Long;
  5628.     flAttributes:   Long;
  5629.   end;
  5630.  
  5631. { Device Context Functions }
  5632.  
  5633. function DevEscape(DC: HDC; Code,InCount: Long; InData: Pointer; var OutCount: Long;
  5634.   OutData: Pointer): Long;
  5635. function DevQueryDeviceNames(AB: HAB; DriverName: PChar; var dn: Long;
  5636.   DeviceName: PStr32; DeviceDesc: PStr64; var dt: Long; DataType: PStr16): Bool;
  5637. function DevQueryHardcopyCaps(DC: HDC; StartForm,Forms: Long; var HcInf: HcInfo): Long;
  5638. function DevPostDeviceModes(AB: HAB; DriverData: PDrivData; DriverName,
  5639.   DeviceName,Name: PChar; Options: ULong): Long;
  5640.  
  5641. {----[ PMHELP ]----}
  5642.  
  5643. { HelpSubTable entry structure }
  5644. type
  5645.   PHelpSubTable = ^HelpSubTable;
  5646.   HelpSubTable = record
  5647.     usSubItemSize: SmallWord;
  5648.     HelpSubTableEntry: array[0..0] of SmallWord;
  5649.   end;
  5650.  
  5651. { HelpTable entry structure }
  5652. type
  5653.   PHelpTable = ^HelpTable;
  5654.   HelpTable = record
  5655.     idAppWindow:      SmallWord;
  5656.     phstHelpSubTable: PHelpSubTable;
  5657.     idExtPanel:       SmallWord;
  5658.   end;
  5659.  
  5660. { IPF Initialization record used on the WinCreateHelpInstance call }
  5661.  
  5662.   PHelpInit = ^HelpInit;
  5663.   HelpInit = record
  5664.     cb:                       ULong;
  5665.     ulReturnCode:             ULong;
  5666.     pszTutorialName:          PChar;
  5667.     phtHelpTable:             PHelpTable;
  5668.     hmodHelpTableModule:      HModule;
  5669.     hmodAccelActionBarModule: HModule;
  5670.     idAccelTable:             ULong;
  5671.     idActionBar:              ULong;
  5672.     PCharHelpWindowTitle:     PChar;
  5673.     fShowPanelId:             ULong;
  5674.     PCharHelpLibraryName:     PChar;
  5675.   end;
  5676.  
  5677. { Search parent chain indicator for hm_Set_Active_Window message }
  5678. const
  5679.   hwnd_Parent                   = HWnd(0);
  5680.  
  5681. { Constants used to define whether user wants to display panel using }
  5682. { panel number or panel name                                         }
  5683.   hm_ResourceId                 = 0;
  5684.   hm_PanelName                  = 1;
  5685.  
  5686.   hmPanelType_Number            = 0;
  5687.   hmPanelType_Name              = 1;
  5688.  
  5689. { Constants used to define how the panel IDs are displayed on }
  5690. { help panels                                                 }
  5691.   cmic_Hide_Panel_Id            = $0000;
  5692.   cmic_Show_Panel_Id            = $0001;
  5693.   cmic_Toggle_Panel_Id          = $0002;
  5694.  
  5695. { Window Help API declarations }
  5696.  
  5697. function WinDestroyHelpInstance(HelpInstance: HWnd): Bool;
  5698. function WinCreateHelpInstance(AB: Hab; var InitHMInitRec: HelpInit): HWnd;
  5699. function WinAssociateHelpInstance(HelpInstance,App: HWnd): Bool;
  5700. function WinQueryHelpInstance(App: HWnd): HWnd;
  5701. function WinLoadHelpTable(HelpInstance: HWnd; IdHelpTable: ULong;
  5702.   Module: HModule): Bool;
  5703. function WinCreateHelpTable(HelpInstance: HWnd; var HelpTbl: HelpTable): Bool;
  5704.  
  5705. { IPF message base }
  5706. const
  5707.   hm_Msg_base                   = $0220;
  5708.   { Messages applications can send to the IPF }
  5709.   hm_Dismiss_Window             = hm_Msg_Base + $0001;
  5710.   hm_Display_Help               = hm_Msg_Base + $0002;
  5711.   hm_Ext_Help                   = hm_Msg_Base + $0003;
  5712.   hm_General_Help               = hm_Ext_Help;
  5713.   hm_Set_Active_Window          = hm_Msg_Base + $0004;
  5714.   hm_Load_Help_Table            = hm_Msg_Base + $0005;
  5715.   hm_Create_Help_Table          = hm_Msg_Base + $0006;
  5716.   hm_Set_Help_Window_Title      = hm_Msg_Base + $0007;
  5717.   hm_Set_Show_Panel_Id          = hm_Msg_Base + $0008;
  5718.   hm_Replace_Help_For_Help      = hm_Msg_Base + $0009;
  5719.   hm_Replace_Using_Help         = hm_Replace_Help_For_Help;
  5720.   hm_Help_Index                 = hm_Msg_Base + $000A;
  5721.   hm_Help_Contents              = hm_Msg_Base + $000B;
  5722.   hm_Keys_Help                  = hm_Msg_Base + $000C;
  5723.   hm_Set_Help_Library_Name      = hm_Msg_Base + $000D;
  5724.  
  5725.   hm_Set_ObjCom_Window          = hm_Msg_Base + $0018;
  5726.   hm_Update_ObjCom_Window_Chain = hm_Msg_Base + $0019;
  5727.   hm_Query_Ddf_Data             = hm_Msg_Base + $001A;
  5728.   hm_Invalidate_Ddf_Data        = hm_Msg_Base + $001B;
  5729.   hm_Query                      = hm_Msg_Base + $001C;
  5730.   hm_Set_CoverPage_Size         = hm_Msg_Base + $001D;
  5731.  
  5732. { Constants used to query the info from IPF in hm_Query message }
  5733. { Hi word in lParam 1 }
  5734.   hmqw_CoverPage                = $0001;
  5735.   hmqw_Index                    = $0002;
  5736.   hmqw_Toc                      = $0003;
  5737.   hmqw_Search                   = $0004;
  5738.   hmqw_ViewPages                = $0005;
  5739.   hmqw_Library                  = $0006;
  5740.   hmqw_ViewPort                 = $0007;
  5741.   hmqw_ObjCom_Window            = $0008;
  5742.   hmqw_Instance                 = $0009;
  5743.   hmqw_ActiveViewPort           = $000A;
  5744.   Control_Selected              = $000B;
  5745.  
  5746.   hmqw_Group_ViewPort           = $00F1;
  5747.   hmqw_Res_ViewPort             = $00F2;
  5748.   UserData                      = $00F3;
  5749.  
  5750. { Lo word in lParam1 of hmqw_ViewPort }
  5751.   hmqvp_Number                  = $0001;
  5752.   hmqvp_Name                    = $0002;
  5753.   hmqvp_Group                   = $0003;
  5754.  
  5755. { Predefined Control IDs }
  5756.   ctrl_Previous_Id              = $0001;
  5757.   ctrl_Search_Id                = $0002;
  5758.   ctrl_Print_Id                 = $0003;
  5759.   ctrl_Index_Id                 = $0004;
  5760.   ctrl_Contents_Id              = $0005;
  5761.   ctrl_Back_Id                  = $0006;
  5762.   ctrl_Forward_Id               = $0007;
  5763.   ctrl_Tutorial_Id              = $00FF;
  5764.  
  5765.   ctrl_User_Id_Base             = 257;
  5766.  
  5767. { Messages the IPF sends to the applications active window }
  5768. { as defined by the IPF.                                   }
  5769.   hm_Error                      = hm_Msg_Base + $000E;
  5770.   hm_HelpSubitem_Not_Found      = hm_Msg_Base + $000F;
  5771.   hm_Query_Keys_Help            = hm_Msg_Base + $0010;
  5772.   hm_Tutorial                   = hm_Msg_Base + $0011;
  5773.   hm_Ext_Help_Undefined         = hm_Msg_Base + $0012;
  5774.   hm_General_Help_Undefined     = hm_Ext_Help_Undefined;
  5775.   hm_ActionBar_Command          = hm_Msg_Base + $0013;
  5776.   hm_Inform                     = hm_Msg_Base + $0014;
  5777.   hm_Notify                     = hm_Msg_Base + $0022;
  5778.   hm_Set_UserData               = hm_Msg_Base + $0023;
  5779.   hm_Control                    = hm_Msg_Base + $0024;
  5780.  
  5781. { notify information for hm_Notify }
  5782.   open_CoverPage                = $0001;
  5783.   open_Page                     = $0002;
  5784.   swap_Page                     = $0003;
  5785.   open_Toc                      = $0004;
  5786.   open_Index                    = $0005;
  5787.   open_History                  = $0006;
  5788.   open_Search_Hit_List          = $0007;
  5789.   open_Library                  = $0008;
  5790.  
  5791. {  hmerr_No_Frame_Wnd_In_Chain - There is no frame window in the        }
  5792. {  window chain from which to find or set the associated help instance  }
  5793.   hmerr_No_Frame_Wnd_In_Chain   = $00001001;
  5794.  
  5795. { hmerr_Invalid_Assoc_App_Wnd - The application window handle specified }
  5796. { on the WinAssociateHelpInstance call is not a valid window handle     }
  5797.   hmerr_Invalid_Assoc_App_Wnd   = $00001002;
  5798.  
  5799. { hmerr_Invalid_Assoc_Help_Inst - The help instance handle specified on }
  5800. { the WinAssociateHelpInstance call is not a valid window handle        }
  5801.   hmerr_Invalid_Assoc_Help_Inst = $00001003;
  5802.  
  5803. { hmerr_Invalid_Destroy_Help_Inst - The window handle specified as the  }
  5804. { help instance to destroy is not of the help instance class            }
  5805.   hmerr_Invalid_Destroy_Help_Inst = $00001004;
  5806.  
  5807. { hmerr_No_Help_Inst_In_chain - The parent or owner chain of the        }
  5808. { application window specified does not have a help instance associated }
  5809. { with it }
  5810.   hmerr_No_Help_Inst_In_chain   = $00001005;
  5811.  
  5812. { hmerr_Invalid_Help_Instance_Hdl - The handle specified to be a help   }
  5813. { instance does not have the class name of a IPF help instance          }
  5814.   hmerr_Invalid_Help_Instance_Hdl = $00001006;
  5815.  
  5816. { hmerr_Invalid_Query_App_Wnd - The application window specified on     }
  5817. { a WinQueryHelpInstance call is not a valid window handle              }
  5818.   hmerr_Invalid_Query_App_Wnd   = $00001007;
  5819.  
  5820. { hmerr_Help_Inst_Called_Invalid - The handle of the help instance      }
  5821. { specified on an API call to the IPF does not have the class name of   }
  5822. { an IPF help instance }
  5823.   hmerr_Help_Inst_Called_Invalid = $00001008;
  5824.  
  5825.   hmerr_HelpTable_Undefine      = $00001009;
  5826.   hmerr_Help_Instance_Undefine  = $0000100A;
  5827.   hmerr_Helpitem_Not_Found      = $0000100B;
  5828.   hmerr_Invalid_HelpSubitem_Size = $0000100C;
  5829.   hmerr_HelpSubitem_Not_Found   = $0000100D;
  5830.  
  5831. { hmerr_Index_Not_Found - No index in library file }
  5832.   hmerr_Index_Not_Found         = $00002001;
  5833.  
  5834. { hmerr_Content_Not_Found - Library file does not have any contents }
  5835.   hmerr_Content_Not_Found       = $00002002;
  5836.  
  5837. { hmerr_Open_Lib_File - Cannot open library file }
  5838.   hmerr_Open_Lib_File           = $00002003;
  5839.  
  5840. { hmerr_Read_Lib_File - Cannot read library file }
  5841.   hmerr_Read_Lib_File           = $00002004;
  5842.  
  5843. { hmerr_Close_Lib_File - Cannot close library file }
  5844.   hmerr_Close_Lib_File          = $00002005;
  5845.  
  5846. { hmerr_Invalid_Lib_File - Improper library file provided }
  5847.   hmerr_Invalid_Lib_File        = $00002006;
  5848.  
  5849. {  hmerr_No_Memory - Unable to allocate the requested amount of memory }
  5850.   hmerr_No_Memory               = $00002007;
  5851.  
  5852. { hmerr_Allocate_Segment - Unable to allocate a segment of memory for memory }
  5853. { allocation requested from the IPF                                          }
  5854.   hmerr_Allocate_Segment        = $00002008;
  5855.  
  5856. { hmerr_Free_Memory - Unable to free allocated  memory }
  5857.   hmerr_FREE_MEMORY             = $00002009;
  5858.  
  5859. { hmerr_Panel_Not_Found - Unable to find a help panel requested to }
  5860. { help manager }
  5861.   hmerr_Panel_Not_Found         = $00002010;
  5862.  
  5863. { hmerr_Database_Not_Open - Unable to read the unopened database }
  5864.   hmerr_Database_Not_Open       = $00002011;
  5865.  
  5866. { hmerr_Load_Dll - Unable to load resource dll }
  5867.   hmerr_Load_Dll                = $00002013;
  5868.  
  5869. { AC Viewport stucture definitions }
  5870. type
  5871.   PAcVp = ^AcVp;
  5872.   AcVp = record
  5873.     cb:         ULong;
  5874.     hAB:        Hab;
  5875.     hmq:        Hmq;
  5876.     ObjectID:   ULong;          { object identifier }
  5877.     HWndParent: HWnd;           { IPF viewport client handle }
  5878.     HWndOwner:  HWnd;           { IPF viewport client handle }
  5879.     HWndACVP:   HWnd;           { applications frame window HWnd }
  5880.   end;
  5881.  
  5882. { DDF types and constants }
  5883.   Hddf = Pointer;
  5884.  
  5885. { DdfHyperText Flags }
  5886. const
  5887.   reference_By_Id               = 0;
  5888.   reference_By_Res              = 1;
  5889.  
  5890. { DdfBeginList formatting flags }
  5891.   hmbt_None                     = 1;
  5892.   hmbt_All                      = 2;
  5893.   hmbt_Fit                      = 3;
  5894.  
  5895.   hmls_SingleLine               = 1;
  5896.   hmls_DoubleLine               = 2;
  5897.  
  5898. { DdfBitmap alignment flags }
  5899.   art_RunIn                     = $10;
  5900.   art_Left                      = $01;
  5901.   art_Right                     = $02;
  5902.   art_Center                    = $04;
  5903.  
  5904. { DdfSetColor Color Flag }
  5905.   clr_Unchanged                 = -6;
  5906.  
  5907. { DDF API declarations }
  5908.  
  5909. function DdfInitialize(HelpInstance: HWnd; cbBuffer,Increment: ULong): Hddf;
  5910. function DdfPara(Ddf: Hddf): Bool;
  5911. function DdfSetFormat(Ddf: Hddf; FormatType: ULong): Bool;
  5912. function DdfSetTextAlign(Ddf: Hddf; Align: ULong): Bool;
  5913. function DdfSetColor(Ddf: Hddf; BackColor,ForColor: Color): Bool;
  5914. function DdfInform(Ddf: Hddf; Text: PChar; InformNumber: ULong): Bool;
  5915. function DdfSetFontStyle(Ddf: Hddf; FontStyle: ULong): Bool;
  5916. function DdfHyperText(Ddf: Hddf; Text,Reference: PChar; RefType: ULong): Bool;
  5917. function DdfBeginList(Ddf: Hddf; WidthDT,BreakType,Spacing: ULong): Bool;
  5918. function DdfListItem(Ddf: Hddf; Term,Description: PChar): Bool;
  5919. function DdfEndList(Ddf: Hddf): Bool;
  5920. function DdfMetafile(Ddf: Hddf; mf: Hmf; R: PRectL): Bool;
  5921. function DdfText(Ddf: Hddf; Text: PChar): Bool;
  5922. function DdfSetFont(Ddf: Hddf; FaceName: PChar; Width,Height: ULong): Bool;
  5923. function DdfBitmap(Ddf: Hddf; Hbm: HBitMap; Align: ULong): Bool;
  5924.  
  5925. { Error codes returned by DDF API functions }
  5926. const
  5927.   hmerr_Ddf_Memory              = $3001;
  5928.   hmerr_Ddf_Align_Type          = $3002;
  5929.   hmerr_Ddf_BackColor           = $3003;
  5930.   hmerr_Ddf_ForeColor           = $3004;
  5931.   hmerr_Ddf_FontStyle           = $3005;
  5932.   hmerr_Ddf_RefType             = $3006;
  5933.   hmerr_Ddf_List_Unclosed       = $3007;
  5934.   hmerr_Ddf_List_Uninitialized  = $3008;
  5935.   hmerr_Ddf_List_BreakType      = $3009;
  5936.   hmerr_Ddf_List_Spacing        = $300A;
  5937.   hmerr_Ddf_HInstance           = $300B;
  5938.   hmerr_Ddf_Exceed_Max_Length   = $300C;
  5939.   hmerr_Ddf_Exceed_Max_Inc      = $300D;
  5940.   hmerr_Ddf_Invalid_Ddf         = $300E;
  5941.   hmerr_Ddf_Format_Type         = $300F;
  5942.   hmerr_Ddf_Invalid_Parm        = $3010;
  5943.   hmerr_Ddf_Invalid_Font        = $3011;
  5944.   hmerr_Ddf_Severe              = $3012;
  5945.  
  5946. { From HMTAILOR.H }
  5947. { OS/2 Help window menu identifiers }
  5948.  
  5949.   idm_ChildVpSysMenu            = 810;
  5950.  
  5951.   idm_File                      = $7F00;
  5952.   idm_Search                    = $7F01;
  5953.   idm_Print                     = $7F02;
  5954.   idm_Viewport                  = $7F05;
  5955.  
  5956.   idm_Edit                      = $7F10;
  5957.   idm_Clip_Copy                 = $7F11;
  5958.   idm_Clip_Cf                   = $7F12;
  5959.   idm_Clip_Af                   = $7F13;
  5960.   idm_Libraries                 = $7F14;
  5961.  
  5962.   idm_Options                   = $7F20;
  5963.   idm_Viewpages                 = $7F21;
  5964.   idm_Toc                       = $7F23;
  5965.   idm_Option_ExpLevel           = $7F24;
  5966.   idm_Option_ExpBranch          = $7F25;
  5967.   idm_Option_ExpAll             = $7F26;
  5968.   idm_Option_ColBranch          = $7F27;
  5969.   idm_Option_ColAll             = $7F28;
  5970.   idm_Previous                  = $7F29;
  5971.  
  5972.   idm_Help                      = $7F30;
  5973.   idm_HelpHelp                  = $7F31;
  5974.   idm_Help_Extended             = $7F32;
  5975.   idm_Using_Help                = idm_HelpHelp;
  5976.   idm_General_Help              = idm_Help_Extended;
  5977.   idm_Help_Keys                 = $7F33;
  5978.   idm_Help_Index                = $7F34;
  5979.  
  5980.   idm_Tutorial                  = $7F37;
  5981.  
  5982. {----[ PMSHL ]----}
  5983.  
  5984. const
  5985.   { Maximum title length }
  5986.   MaxNameL                      = 60;
  5987.  
  5988. { program handle }
  5989. type
  5990.    PHProgram = ^HProgram;
  5991.    HProgram  = LHandle;
  5992.    HApp      = LHandle;
  5993.    { ini file handle }
  5994.    PHIni     = ^HIni;
  5995.    HIni      = LHandle;
  5996.  
  5997. const
  5998.   HIni_Profile                  = HIni( 0);
  5999.   HIni_UserProfile              = HIni(-1);
  6000.   HIni_SystemProfile            = HIni(-2);
  6001.   HIni_User                     = HIni_UserProfile;
  6002.   HIni_System                   = HIni_SystemProfile;
  6003.  
  6004. type
  6005.   PPrfProfile = ^PrfProfile;
  6006.   PrfProfile = record
  6007.     cchUserName: ULong;
  6008.     pszUserName: PChar;
  6009.     cchSysName:  ULong;
  6010.     pszSysName:  PChar;
  6011.   end;
  6012.  
  6013. { program list section }
  6014. { maximum path length  }
  6015. const
  6016.   MaxPathL                      = 128;
  6017.  
  6018. { root group handle }
  6019.   sgh_Root                      = HProgram(-1);
  6020.  
  6021. type
  6022.   PHProgArray   = ^HProgArray;
  6023.   HProgArray    = HProgram;
  6024.   PProgCategory = ^ProgCategory;
  6025.   ProgCategory  = ULong;
  6026.  
  6027. { values acceptable for ProgCategory for PM groups }
  6028. const
  6029.   prog_Default                  = ProgCategory(0);
  6030.   prog_FullScreen               = ProgCategory(1);
  6031.   prog_WindowableVio            = ProgCategory(2);
  6032.   prog_Pm                       = ProgCategory(3);
  6033.   prog_Group                    = ProgCategory(5);
  6034.   prog_Real                     = ProgCategory(4);
  6035.   prog_Vdm                      = ProgCategory(4);
  6036.   prog_WindowedVdm              = ProgCategory(7);
  6037.   prog_Dll                      = ProgCategory(6);
  6038.   prog_Pdd                      = ProgCategory(8);
  6039.   prog_Vdd                      = ProgCategory(9);
  6040.   prog_Window_Real              = ProgCategory(10);
  6041.   prog_Window_Prot              = ProgCategory(11);
  6042.   prog_Window_Auto              = ProgCategory(12);
  6043.   prog_SeamlessVdm              = ProgCategory(13);
  6044.   prog_SeamlessCommon           = ProgCategory(14);
  6045.   prog_Reserved                 = ProgCategory(255);
  6046.  
  6047. type
  6048.   PProgType = ^ProgType;
  6049.   ProgType = record
  6050.     progc:     ProgCategory;
  6051.     fbVisible: ULong;
  6052.   end;
  6053.  
  6054. { visibility flag for ProgType record }
  6055. const
  6056.   she_Visible                   = $00;
  6057.   she_Invisible                 = $01;
  6058.   she_Reserved                  = $FF;
  6059.  
  6060. { Protected group flag for ProgType record }
  6061.   she_Unprotected               = $00;
  6062.   she_Protected                 = $02;
  6063.  
  6064. { Records associated with 'Prf' calls }
  6065. type
  6066.   PProgDetails = ^ProgDetails;
  6067.   ProgDetails = record
  6068.     Length:         ULong;      { set this to SizeOf(ProgDetails)  }
  6069.     progt:          ProgType;
  6070.     pszTitle:       PChar;      { any of the pointers can be Nil   }
  6071.     pszExecutable:  PChar;
  6072.     pszParameters:  PChar;
  6073.     pszStartupDir:  PChar;
  6074.     pszIcon:        PChar;
  6075.     pszEnvironment: PChar;      { this is terminated by  #0#0      }
  6076.     swpInitial:     Swp;        { this replaces XYWINSIZE          }
  6077.   end;
  6078.  
  6079.   PProgTitle = ^ProgTitle;
  6080.   ProgTitle = record
  6081.     hprog:    HProgram;
  6082.     progt:    ProgType;
  6083.     pszTitle: PChar;
  6084.   end;
  6085.  
  6086. { Program List API Function Definitions }
  6087. { Program List API available 'Prf' calls }
  6088.  
  6089. function PrfQueryProgramTitles(Ini: HIni; PrgGroup: HProgram;
  6090.   Titles: PProgTitle; cchBufferMax: ULong; var Count: ULong): ULong;
  6091.  
  6092. {  NOTE: string information is concatanated after the array of      }
  6093. {        ProgTitle structures so you need to allocate storage       }
  6094. {        greater than SizeOf(ProgTitle)*cPrograms to query programs }
  6095. {        in a group.                                                }
  6096. {                                                                   }
  6097. {  PrfQueryProgramTitles recommended usage to obtain titles of all  }
  6098. {  programs in a group (Hgroup=sgh_Root is for all groups):         }
  6099. {                                                                   }
  6100. {  BufLen := PrfQueryProgramTitles(HIni, Hgroup, nil, 0 Count);     }
  6101. {                                                                   }
  6102. {  Alocate buffer of  Buflen                                        }
  6103. {                                                                   }
  6104. {  Len = PrfQueryProgramTitles(HIni, Hgroup, PProgTitle(pBuffer),   }
  6105. {                               BufLen, Count);                     }
  6106. {                                                                   }
  6107.  
  6108. function PrfAddProgram(Ini: HIni; pDetails: PProgDetails;
  6109.   ProgGroup: HProgram): HProgram;
  6110. function PrfChangeProgram(Ini: HIni; Prog: HProgram;
  6111.   Details: PProgDetails): Bool;
  6112. function PrfQueryDefinition(Ini: HIni; Prog: HProgram; Details: PProgDetails;
  6113.   cchBufferMax: ULong): ULong;
  6114.  
  6115. {  NOTE: string information is concatanated after the ProgDetails   }
  6116. {        field structure so you need to allocate storage greater    }
  6117. {        than SizeOf(ProgDetails) to query programs                 }
  6118. {                                                                   }
  6119. {  PrfQueryDefinition recomended usage:                             }
  6120. {                                                                   }
  6121. {  BufferLen := PrfQueryDefinition(HIni,Hprog,nil,0)                }
  6122. {                                                                   }
  6123. {  Alocate buffer of bufferlen bytes                                }
  6124. {  set Length field (0 will be supported)                           }
  6125. {                                                                   }
  6126. {  PProgDetails(pBuffer)^.Length := SizeOf(PProgDetails)            }
  6127. {                                                                   }
  6128. {  Len := PrfQueryDefinition(HIni, Hprog, PProgDetails(pBuffer),    }
  6129. {      bufferlen)                                                   }
  6130.  
  6131. function PrfRemoveProgram(Ini: HIni; Prog: HProgram): Bool;
  6132. function PrfQueryProgramHandle(Ini: HIni; pszExe: PChar;
  6133.   ProgArray: PHProgArray; cchBufferMax: ULong; var Count: ULong): ULong;
  6134. function PrfCreateGroup(Ini: HIni; Title: PChar; Visibility: Byte): HProgram;
  6135. function PrfDestroyGroup(Ini: HIni; ProgGroup: HProgram): Bool;
  6136. function PrfQueryProgramCategory(Ini: HIni; Exe: PChar): ProgCategory;
  6137. function WinStartApp(Notify: HWnd; Details: PProgDetails; Params: PChar;
  6138.   Reserved: Pointer; Options: ULong): HApp;
  6139.  
  6140. { bit values for Options parameter }
  6141. const
  6142.   saf_ValidFlags                = $001F;
  6143.   saf_InstalledCmdLine          = $0001;    { use installed parameters }
  6144.   saf_StartChildApp             = $0002;    { related application }
  6145.   saf_Maximized                 = $0004;    { Start App maximized }
  6146.   saf_Minimized                 = $0008;    { Start App minimized, if not saf_Maximized }
  6147.   saf_Background                = $0010;    { Start app in the background }
  6148.  
  6149. function WinTerminateApp(App: HApp): Bool;
  6150.  
  6151. { switch list section }
  6152.  
  6153. type
  6154.   PHSwitch = ^LHandle;
  6155.   HSwitch = LHandle;
  6156.  
  6157.   PSwCntrl = ^SwCntrl;
  6158.   SwCntrl = record
  6159.     hwnd:                  HWnd;
  6160.     hwndIcon:              HWnd;
  6161.     hprog:                 HProgram;
  6162.     idProcess:             Pid;
  6163.     idSession:             ULong;
  6164.     uchVisibility:         ULong;
  6165.     fbJump:                ULong;
  6166.     szSwtitle: array [0..MaxNameL+3] of Char;
  6167.     bProgType:             ULong;
  6168.   end;
  6169.  
  6170. { visibility flag for SwCntrl record }
  6171. const
  6172.   swl_Visible                   = $04;
  6173.   swl_Invisible                 = $01;
  6174.   swl_Grayed                    = $02;
  6175.  
  6176. { jump flag for SwCntrl record }
  6177.   swl_Jumpable                  = $02;
  6178.   swl_NotJumpable               = $01;
  6179.  
  6180. { Switching Program functions }
  6181.  
  6182. function WinAddSwitchEntry(Sw: PSwCntrl): HSwitch;
  6183. function WinRemoveSwitchEntry(Sw: HSwitch): ULong;
  6184.  
  6185. type
  6186.   PSwEntry = ^SwEntry;
  6187.   SwEntry = record
  6188.     HSwitch: HSwitch;
  6189.     swctl:   SwCntrl;
  6190.   end;
  6191.  
  6192.   PSwbLock = ^SwbLock;
  6193.   SwbLock = record
  6194.     cswentry: ULong;
  6195.     aswentry: SwEntry;
  6196.   end;
  6197.  
  6198. function WinChangeSwitchEntry(Switch: HSwitch; pswctlSwitchData: PSwCntrl): ULong;
  6199. function WinCreateSwitchEntry(AB: Hab; pswctlSwitchData: PSwCntrl): HSwitch;
  6200. function WinQuerySessionTitle(AB: Hab; Session: ULong; Title: PChar;
  6201.   Titlelen: ULong): ULong;
  6202. function WinQuerySwitchEntry(Switch: HSwitch; pswctlSwitchData: PSwCntrl): ULong;
  6203. function WinQuerySwitchHandle(Wnd: HWnd; Process: Pid): HSwitch;
  6204. function WinQuerySwitchList(AB: Hab; pswblkSwitchEntries: PSwbLock;
  6205.   DataLength: ULong): ULong;
  6206. function WinQueryTaskSizePos(AB: Hab; ScreenGroup: ULong; PositionData: PSwp): ULong;
  6207. function WinQueryTaskTitle(Session: ULong; Title: PChar; Titlelen: ULong): ULong;
  6208. function WinSwitchToProgram(HSwitchSwHandle: HSwitch): ULong;
  6209.  
  6210. { OS2.INI Access functions }
  6211.  
  6212. function PrfQueryProfileInt(Ini: HIni; App,Key: PChar; Default: Long): Long;
  6213. function PrfQueryProfileString(Ini: HIni; App,Key,Default: PChar;
  6214.   Buffer: Pointer; cchBufferMax: ULong): ULong;
  6215. function PrfWriteProfileString(Ini: HIni; App,Key,Data: PChar): Bool;
  6216. function PrfQueryProfileSize(Ini: HIni; App,Key: PChar; var ReqLen: ULong): Bool;
  6217. function PrfQueryProfileData(Ini: HIni; App,Key: PChar; Buffer: Pointer;
  6218.   var BufLen: ULong): Bool;
  6219. function PrfWriteProfileData(Ini: HIni; App,Key: PChar; Data: Pointer;
  6220.   DataLen: ULong): Bool;
  6221. function PrfOpenProfile(AB: Hab; FileName: PChar): HIni;
  6222. function PrfCloseProfile(Ini: HIni): Bool;
  6223. function PrfReset(AB: Hab; Prf: PPrfProfile): Bool;
  6224. function PrfQueryProfile(AB: Hab; Prf: PPrfProfile): Bool;
  6225.  
  6226. { public message, broadcast on WinReset }
  6227. const
  6228.   pl_Altered                    = $008E; { wm_ShellFirst + $0E }
  6229.  
  6230. {----[ PMTYPES ]----}
  6231.  
  6232. const
  6233.   dtyp_User                     = 16384;
  6234.   dtyp_Ctl_Array                = 1;
  6235.   dtyp_Ctl_PArray               = -1;
  6236.   dtyp_Ctl_offset               = 2;
  6237.   dtyp_Ctl_length               = 3;
  6238. { Ordinary datatypes }
  6239.   dtyp_Accel                    = 28;
  6240.   dtyp_AccelTable               = 29;
  6241.   dtyp_ArcParams                = 38;
  6242.   dtyp_AreaBundle               = 139;
  6243.   dtyp_Atom                     = 90;
  6244.   dtyp_BitMapInfo               = 60;
  6245.   dtyp_BitMapInfoHeader         = 61;
  6246.   dtyp_BitMapInfo2              = 170;
  6247.   dtyp_BitMapInfoHeader2        = 171;
  6248.   dtyp_Bit16                    = 20;
  6249.   dtyp_Bit32                    = 21;
  6250.   dtyp_Bit8                     = 19;
  6251.   dtyp_Bool                     = 18;
  6252.   dtyp_BtncData                 = 35;
  6253.   dtyp_Byte                     = 13;
  6254.   dtyp_CatchBuf                 = 141;
  6255.   dtyp_Char                     = 15;
  6256.   dtyp_CharBundle               = 135;
  6257.   dtyp_ClassInfo                = 95;
  6258.   dtyp_Count2                   = 93;
  6259.   dtyp_Count2b                  = 70;
  6260.   dtyp_Count2Ch                 = 82;
  6261.   dtyp_Count4                   = 152;
  6262.   dtyp_Count4b                  = 42;
  6263.   dtyp_Cpid                     = 57;
  6264.   dtyp_CreateStruct             = 98;
  6265.   dtyp_CursorInfo               = 34;
  6266.   dtyp_DevOpenStruc             = 124;
  6267.   dtyp_DlgTemplate              = 96;
  6268.   dtyp_DlgTItem                 = 97;
  6269.   dtyp_EntryFData               = 127;
  6270.   dtyp_ErrorId                  = 45;
  6271.   dtyp_FAttrs                   = 75;
  6272.   dtyp_Ffdescs                  = 142;
  6273.   dtyp_Fixed                    = 99;
  6274.   dtyp_FontMetrics              = 74;
  6275.   dtyp_FrameCData               = 144;
  6276.   dtyp_Gradientl                = 48;
  6277.   dtyp_Hab                      = 10;
  6278.   dtyp_Haccel                   = 30;
  6279.   dtyp_Happ                     = 146;
  6280.   dtyp_HAtomTbl                 = 91;
  6281.   dtyp_HBitMap                  = 62;
  6282.   dtyp_HcInfo                   = 46;
  6283.   dtyp_Hdc                      = 132;
  6284.   dtyp_HEnum                    = 117;
  6285.   dtyp_HHeap                    = 109;
  6286.   dtyp_HIni                     = 53;
  6287.   dtyp_HLib                     = 147;
  6288.   dtyp_Hmf                      = 85;
  6289.   dtyp_Hmq                      = 86;
  6290.   dtyp_HPointer                 = 106;
  6291.   dtyp_HProgram                 = 131;
  6292.   dtyp_Hps                      = 12;
  6293.   dtyp_HRgn                     = 116;
  6294.   dtyp_HSem                     = 140;
  6295.   dtyp_Hspl                     = 32;
  6296.   dtyp_HSwitch                  = 66;
  6297.   dtyp_Hvps                     = 58;
  6298.   dtyp_HWnd                     = 11;
  6299.   dtyp_Identity                 = 133;
  6300.   dtyp_Identity4                = 169;
  6301.   dtyp_ImageBundle              = 136;
  6302.   dtyp_Index2                   = 81;
  6303.   dtyp_Ipt                      = 155;
  6304.   dtyp_KerningPairs             = 118;
  6305.   dtyp_Length2                  = 68;
  6306.   dtyp_Length4                  = 69;
  6307.   dtyp_LineBundle               = 137;
  6308.   dtyp_Long                     = 25;
  6309.   dtyp_MarkerBundle             = 138;
  6310.   dtyp_Matrixlf                 = 113;
  6311.   dtyp_MlectlData               = 161;
  6312.   dtyp_MLeMargStruct            = 157;
  6313.   dtyp_MLeOverflow              = 158;
  6314.   dtyp_Offset2b                 = 112;
  6315.   dtyp_OwnerItem                = 154;
  6316.   dtyp_Pid                      = 92;
  6317.   dtyp_Pix                      = 156;
  6318.   dtyp_PointerInfo              = 105;
  6319.   dtyp_PointL                   = 77;
  6320.   dtyp_ProgCategory             = 129;
  6321.   dtyp_ProgramEntry             = 128;
  6322.   dtyp_ProgType                 = 130;
  6323.   dtyp_Property2                = 88;
  6324.   dtyp_Property4                = 89;
  6325.   dtyp_Qmsg                     = 87;
  6326.   dtyp_RectL                    = 121;
  6327.   dtyp_ResId                    = 125;
  6328.   dtyp_RGB                      = 111;
  6329.   dtyp_RgnRect                  = 115;
  6330.   dtyp_SbcData                  = 159;
  6331.   dtyp_SegOff                   = 126;
  6332.   dtyp_Short                    = 23;
  6333.   dtyp_SizeF                    = 101;
  6334.   dtyp_SizeL                    = 102;
  6335.   dtyp_StrL                     = 17;
  6336.   dtyp_Str16                    = 40;
  6337.   dtyp_Str32                    = 37;
  6338.   dtyp_Str64                    = 47;
  6339.   dtyp_Str8                     = 33;
  6340.   dtyp_SwBlock                  = 63;
  6341.   dtyp_SwCntrl                  = 64;
  6342.   dtyp_SwEntry                  = 65;
  6343.   dtyp_Swp                      = 31;
  6344.   dtyp_Tid                      = 104;
  6345.   dtyp_Time                     = 107;
  6346.   dtyp_TrackInfo                = 73;
  6347.   dtyp_UChar                    = 22;
  6348.   dtyp_ULong                    = 26;
  6349.   dtyp_UserButton               = 36;
  6350.   dtyp_UShort                   = 24;
  6351.   dtyp_Width4                   = 108;
  6352.   dtyp_WndParams                = 83;
  6353.   dtyp_WndProc                  = 84;
  6354.   dtyp_WPoint                   = 59;
  6355.   dtyp_WRect                    = 55;
  6356.   dtyp_xyMinSize                = 52;
  6357. { pointer datatypes }
  6358.   dtyp_PAccel                   = -28;
  6359.   dtyp_PAccelTable              = -29;
  6360.   dtyp_PArcParams               = -38;
  6361.   dtyp_PAreaBundle              = -139;
  6362.   dtyp_PAtom                    = -90;
  6363.   dtyp_PBitMapInfo              = -60;
  6364.   dtyp_PBitMapInfoHeader        = -61;
  6365.   dtyp_PBitMapInfo2             = -170;
  6366.   dtyp_PBitMapInfoHeader2       = -171;
  6367.   dtyp_PBit16                   = -20;
  6368.   dtyp_PBit32                   = -21;
  6369.   dtyp_PBit8                    = -19;
  6370.   dtyp_PBool                    = -18;
  6371.   dtyp_PBtnCData                = -35;
  6372.   dtyp_PByte                    = -13;
  6373.   dtyp_PCatchBuf                = -141;
  6374.   dtyp_PChar                    = -15;
  6375.   dtyp_PCharBundle              = -135;
  6376.   dtyp_PClassInfo               = -95;
  6377.   dtyp_PCount2                  = -93;
  6378.   dtyp_PCount2b                 = -70;
  6379.   dtyp_PCount2Ch                = -82;
  6380.   dtyp_PCount4                  = -152;
  6381.   dtyp_PCount4b                 = -42;
  6382.   dtyp_PCPid                    = -57;
  6383.   dtyp_PCreateStruct            = -98;
  6384.   dtyp_PCursorInfo              = -34;
  6385.   dtyp_PDevOpenStruc            = -124;
  6386.   dtyp_PDlgTemplate             = -96;
  6387.   dtyp_PDlgTItem                = -97;
  6388.   dtyp_PEntryFData              = -127;
  6389.   dtyp_PErrorId                 = -45;
  6390.   dtyp_PFAttrs                  = -75;
  6391.   dtyp_Pffdescs                 = -142;
  6392.   dtyp_PFixed                   = -99;
  6393.   dtyp_PFontMetrics             = -74;
  6394.   dtyp_PFrameCData              = -144;
  6395.   dtyp_PGradientl               = -48;
  6396.   dtyp_PHab                     = -10;
  6397.   dtyp_PHAccel                  = -30;
  6398.   dtyp_PHApp                    = -146;
  6399.   dtyp_PHAtomTbl                = -91;
  6400.   dtyp_PHBitMap                 = -62;
  6401.   dtyp_PHcInfo                  = -46;
  6402.   dtyp_PHdc                     = -132;
  6403.   dtyp_PHEnum                   = -117;
  6404.   dtyp_PHHeap                   = -109;
  6405.   dtyp_PHIni                    = -53;
  6406.   dtyp_PHLib                    = -147;
  6407.   dtyp_PHmf                     = -85;
  6408.   dtyp_PHmq                     = -86;
  6409.   dtyp_PHPointer                = -106;
  6410.   dtyp_PHProgram                = -131;
  6411.   dtyp_PHps                     = -12;
  6412.   dtyp_PHRgn                    = -116;
  6413.   dtyp_PHSem                    = -140;
  6414.   dtyp_PHSpl                    = -32;
  6415.   dtyp_PHSwitch                 = -66;
  6416.   dtyp_PHvps                    = -58;
  6417.   dtyp_PHWnd                    = -11;
  6418.   dtyp_PIdentity                = -133;
  6419.   dtyp_PIdentity4               = -169;
  6420.   dtyp_PImageBundle             = -136;
  6421.   dtyp_PIndex2                  = -81;
  6422.   dtyp_Pipt                     = -155;
  6423.   dtyp_PkerningPairs            = -118;
  6424.   dtyp_PLength2                 = -68;
  6425.   dtyp_PLength4                 = -69;
  6426.   dtyp_PLinebundle              = -137;
  6427.   dtyp_PLong                    = -25;
  6428.   dtyp_PMarkerBundle            = -138;
  6429.   dtyp_PMatrixlf                = -113;
  6430.   dtyp_PmLeCtlData              = -161;
  6431.   dtyp_PmLeMargStruct           = -157;
  6432.   dtyp_PmLeOverflow             = -158;
  6433.   dtyp_POffset2b                = -112;
  6434.   dtyp_POwnerItem               = -154;
  6435.   dtyp_PPid                     = -92;
  6436.   dtyp_PPix                     = -156;
  6437.   dtyp_PPointerInfo             = -105;
  6438.   dtyp_PPointL                  = -77;
  6439.   dtyp_PProgCategory            = -129;
  6440.   dtyp_PProgramEntry            = -128;
  6441.   dtyp_PProgType                = -130;
  6442.   dtyp_PProperty2               = -88;
  6443.   dtyp_PProperty4               = -89;
  6444.   dtyp_PQMsg                    = -87;
  6445.   dtyp_PRectL                   = -121;
  6446.   dtyp_PResid                   = -125;
  6447.   dtyp_PRGB                     = -111;
  6448.   dtyp_PRgnRect                 = -115;
  6449.   dtyp_PSbcData                 = -159;
  6450.   dtyp_PSegOff                  = -126;
  6451.   dtyp_PShort                   = -23;
  6452.   dtyp_PSizeF                   = -101;
  6453.   dtyp_PSizeL                   = -102;
  6454.   dtyp_PStrL                    = -17;
  6455.   dtyp_PStr16                   = -40;
  6456.   dtyp_PStr32                   = -37;
  6457.   dtyp_PStr64                   = -47;
  6458.   dtyp_PStr8                    = -33;
  6459.   dtyp_PSwBlock                 = -63;
  6460.   dtyp_PSwCntrl                 = -64;
  6461.   dtyp_PSwEntry                 = -65;
  6462.   dtyp_PSwp                     = -31;
  6463.   dtyp_PTid                     = -104;
  6464.   dtyp_PTime                    = -107;
  6465.   dtyp_PTrackInfo               = -73;
  6466.   dtyp_PUChar                   = -22;
  6467.   dtyp_PULong                   = -26;
  6468.   dtyp_PUserButton              = -36;
  6469.   dtyp_PUShort                  = -24;
  6470.   dtyp_PWidth4                  = -108;
  6471.   dtyp_PWndParams               = -83;
  6472.   dtyp_PWndProc                 = -84;
  6473.   dtyp_PWPoint                  = -59;
  6474.   dtyp_PWRect                   = -55;
  6475.   dtyp_PxyWinSize               = -52;
  6476.  
  6477. type
  6478. { Saved execution environment buffer }
  6479.   pCatchBuf = ^CatchBuf;
  6480.   CatchBuf = record
  6481.     Reserved: Array[1..4] of ULong;
  6482.   end;
  6483.  
  6484. { Program-entry structure }
  6485.   pProgramEntry = ^ProgramEntry;
  6486.   ProgramEntry = record
  6487.     hprog:   hprogram;
  6488.     ProgT:   ProgType;
  6489.     szTitle: Array[0..MaxNameL] of char;
  6490.   end;
  6491.  
  6492. { Window position and size structure }
  6493.   PXYWinSize = ^XYWinSize;
  6494.   XYWinSize = record
  6495.     x:        SmallInt;
  6496.     y:        SmallInt;
  6497.     cx:       SmallInt;
  6498.     cy:       SmallInt;
  6499.     fsWindow: SmallWord;
  6500.   end;
  6501.  
  6502. {----[ PMSTDDLG ]----}
  6503.  
  6504. {---------------[ F I L E    D I A L O G ]----------------}
  6505.  
  6506. { File Dialog Invocation Flag Definitions }
  6507. const
  6508.   fds_Center                    = $00000001; { Center within owner wnd   }
  6509.   fds_Custom                    = $00000002; { Use custom user template  }
  6510.   fds_FilterUnion               = $00000004; { Use union of filters      }
  6511.   fds_HelpButton                = $00000008; { Display Help button       }
  6512.   fds_ApplyButton               = $00000010; { Display Apply button      }
  6513.   fds_Preload_VolInfo           = $00000020; { Preload volume info       }
  6514.   fds_ModeLess                  = $00000040; { Make dialog modeless      }
  6515.   fds_Include_Eas               = $00000080; { Always load EA info       }
  6516.   fds_Open_Dialog               = $00000100; { Select Open dialog        }
  6517.   fds_Saveas_Dialog             = $00000200; { Select SaveAs dialog      }
  6518.   fds_MultipleSel               = $00000400; { Enable multiple selection }
  6519.   fds_EnableFileLb              = $00000800; { Enable SaveAs Listbox     }
  6520. { File Dialog Selection returned attribute }
  6521.   fds_EfSelection               = 0;
  6522.   fds_LbSelection               = 1;
  6523. { Error Return Codes from dialog (self defining) }
  6524.   fds_Successful                = 0;
  6525.   fds_Err_Deallocate_Memory     = 1;
  6526.   fds_Err_Filter_Trunc          = 2;
  6527.   fds_Err_Invalid_Dialog        = 3;
  6528.   fds_Err_Invalid_Drive         = 4;
  6529.   fds_Err_Invalid_Filter        = 5;
  6530.   fds_Err_Invalid_PathFile      = 6;
  6531.   fds_Err_Out_Of_Memory         = 7;
  6532.   fds_Err_Path_Too_Long         = 8;
  6533.   fds_Err_Too_Many_File_Types   = 9;
  6534.   fds_Err_Invalid_Version       = 10;
  6535.   fds_Err_Invalid_Custom_Handle = 11;
  6536.   fds_Err_Dialog_Load_Error     = 12;
  6537.   fds_Err_Drive_Error           = 13;
  6538. { File Dialog Messages }
  6539.   fdm_Filter                    = wm_User+40; { mp1 = PChar pszFileName}
  6540.   {                                      mp2 = Chap EA .TYPE value     }
  6541.   {                                      mr  = True -> keep file.      }
  6542.   fdm_Validate                  = wm_User+41; { mp1 = PChar pszPathName}
  6543.   {                                      mp2 = Word Field name id      }
  6544.   {                                      mr  = True -> Valid name      }
  6545.   fdm_Error                     = wm_User+42; { mp1 = Word Error message id }
  6546.   {                                      mp2 = nil   reserved          }
  6547.   {                                      mr  = nil -> Use default msg  }
  6548.  
  6549.   { Define the type that is a pointer to an array of pointers.         }
  6550.   {     Hence: pointer to an array of Z string pointers.               }
  6551. type
  6552.    PApSz = ^ApSz;
  6553.    ApSz  = array[0..1*1024*1024] of PChar;
  6554.  
  6555.   { File Dialog application data record }
  6556.    PFileDlg = ^FileDlg;
  6557.    FileDlg = record
  6558.      cbSize:          ULong;     { Size of FileDlg record.            }
  6559.      fl:              ULong;     { fds_ flags. Alter behavior of dlg. }
  6560.      ulUser:          ULong;     { User defined field.                }
  6561.      lReturn:         Long;      { Result code from dialog dismissal. }
  6562.      lSRC:            Long;      { System return code.                }
  6563.      pszTitle:        PChar;     { String to display in title bar.    }
  6564.      pszOKButton:     PChar;     { String to display in OK button.    }
  6565.      pfnDlgProc:      FnWp;      { Entry point to custom dialog proc. }
  6566.      pszIType:        PChar;     { Pointer to string containing       }
  6567.                                  {   initial EA type filter. Type     }
  6568.                                  {   does not have to exist in list.  }
  6569.      papszITypeList:  PApSz;     { Pointer to table of pointers that  }
  6570.                                  {    point to null terminated Type   }
  6571.                                  {    strings. End of table is marked }
  6572.                                  {    by a nil pointer.               }
  6573.      pszIDrive:       PChar;     { Pointer to string containing       }
  6574.                                  {   initial drive. Drive does not    }
  6575.                                  {   have to exist in drive list.     }
  6576.      papszIDriveList: PApSz;     { Pointer to table of pointers that  }
  6577.                                  {    point to null terminated Drive  }
  6578.                                  {    strings. End of table is marked }
  6579.                                  {    by a nil pointer.               }
  6580.      hMod:             HModule;  { Custom File Dialog template.       }
  6581.      szFullFile: array[0..cchMaxPath-1] of Char;{ Initial or selected }
  6582.                                  { fully qualified path and file.     }
  6583.      papszFQFilename:  PApSz;    { Pointer to table of pointers that  }
  6584.                                  {    point to null terminated FQFname}
  6585.                                  {    strings. End of table is marked }
  6586.                                  {    by a nil pointer.               }
  6587.      ulFQFCount:       ULong;    { Number of files selected           }
  6588.      usDlgId:          SmallWord;{ Custom dialog id.                  }
  6589.      x:                SmallInt; { X coordinate of the dialog         }
  6590.      y:                SmallInt; { Y coordinate of the dialog         }
  6591.      sEAType:          SmallInt; { Selected file's EA Type.           }
  6592.    end;
  6593.  
  6594. { File Dialog functions }
  6595.  
  6596. function WinFileDlg(WndP,WndO: HWnd; var fild: FileDlg): HWnd;
  6597. function WinDefFileDlgProc(Wnd: HWnd; Msg: ULong; Mp1,Mp2: MParam): MResult;
  6598. function WinFreeFileDlgList(papszFQFilename: PApSz): Bool;
  6599.  
  6600. { File Dialog - dialog and control ids }
  6601. const
  6602.   did_File_Dialog               = 256;
  6603.   did_Filename_Txt              = 257;
  6604.   did_Filename_Ed               = 258;
  6605.   did_Drive_Txt                 = 259;
  6606.   did_Drive_Cb                  = 260;
  6607.   did_Filter_Txt                = 261;
  6608.   did_Filter_Cb                 = 262;
  6609.   did_Directory_Txt             = 263;
  6610.   did_Directory_Lb              = 264;
  6611.   did_Files_Txt                 = 265;
  6612.   did_Files_Lb                  = 266;
  6613.   did_Help_Pb                   = 267;
  6614.   did_Apply_Pb                  = 268;
  6615.   did_Ok_Pb                     = did_Ok;
  6616.   did_Cancel_Pb                 = did_Cancel;
  6617.  
  6618.   ids_File_All_Files_Selector   = 1000;
  6619.   ids_File_Back_Cur_Path        = 1001;
  6620.   ids_File_Back_Prev_Path       = 1002;
  6621.   ids_File_Back_Slash           = 1003;
  6622.   ids_File_Base_Filter          = 1004;
  6623.   ids_File_Blank                = 1005;
  6624.   ids_File_Colon                = 1006;
  6625.   ids_File_Dot                  = 1007;
  6626.   ids_File_Drive_Letters        = 1008;
  6627.   ids_File_Fwd_Cur_Path         = 1009;
  6628.   ids_File_Fwd_Prev_Path        = 1010;
  6629.   ids_File_Forward_Slash        = 1011;
  6630.   ids_File_Parent_Dir           = 1012;
  6631.   ids_File_Q_Mark               = 1013;
  6632.   ids_File_Splat                = 1014;
  6633.   ids_File_Splat_Dot            = 1015;
  6634.   ids_File_SaveAs_Title         = 1016;
  6635.   ids_File_SaveAs_Filter_Txt    = 1017;
  6636.   ids_File_SaveAs_FileNm_Txt    = 1018;
  6637.   ids_File_Dummy_File_Name      = 1019;
  6638.   ids_File_Dummy_File_Ext       = 1020;
  6639.   ids_File_Dummy_Drive          = 1021;
  6640.   ids_File_Dummy_Root_Dir       = 1022;
  6641.   ids_File_Path_Ptr             = 1023;
  6642.   ids_File_Volume_Prefix        = 1024;
  6643.   ids_File_Volume_Suffix        = 1025;
  6644.   ids_File_Path_Ptr2            = 1026;
  6645.   ids_File_Invalid_Chars        = 1027;
  6646.  
  6647.   ids_File_Bad_Drive_Name       = 1100;
  6648.   ids_File_Bad_Drive_Or_Path_Name = 1101;
  6649.   ids_File_Bad_File_Name        = 1102;
  6650.   ids_File_Bad_Fqf              = 1103;
  6651.   ids_File_Bad_Network_Name     = 1104;
  6652.   ids_File_Bad_Sub_Dir_Name     = 1105;
  6653.   ids_File_Drive_Not_Available  = 1106;
  6654.   ids_File_Fqfname_Too_Long     = 1107;
  6655.   ids_File_Open_Dialog_Note     = 1108;
  6656.   ids_File_Path_Too_Long        = 1109;
  6657.   ids_File_SaveAs_Dialog_Note   = 1110;
  6658.  
  6659.   ids_File_Drive_Disk_Change    = 1120;
  6660.   ids_File_Drive_Not_Ready      = 1122;
  6661.   ids_File_Drive_Locked         = 1123;
  6662.   ids_File_Drive_No_Sector      = 1124;
  6663.   ids_File_Drive_Some_Error     = 1125;
  6664.   ids_File_Drive_Invalid        = 1126;
  6665.   ids_File_Insert_Disk_Note     = 1127;
  6666.   ids_File_Ok_When_Ready        = 1128;
  6667.  
  6668. {---------------[ F O N T    D I A L O G ]----------------}
  6669.  
  6670. { Font Dialog Creation record }
  6671. type
  6672.   PFontDlg = ^FontDlg;
  6673.   FontDlg = record
  6674.     cbSize:            ULong;      { SizeOf(FontDlg)                 }
  6675.     hpsScreen:         Hps;        { Screen presentation space       }
  6676.     hpsPrinter:        Hps;        { Printer presentation space      }
  6677.     pszTitle:          PChar;      { Application supplied title      }
  6678.     pszPreview:        PChar;      { String to print in preview wndw }
  6679.     pszPtSizeList:     PChar;      { Application provided size list  }
  6680.     pfnDlgProc:        FnWp;       { Dialog subclass procedure       }
  6681.     pszFamilyname:     PChar;      { Family name of font             }
  6682.     fxPointSize:       Fixed;      { Point size the user selected    }
  6683.     fl:                ULong;      { fnts_* flags - dialog styles    }
  6684.     flFlags:           ULong;      { fntf_* state flags              }
  6685.     flType:            ULong;      { Font type option bits           }
  6686.     flTypeMask:        ULong;      { Mask of which font types to use }
  6687.     flStyle:           ULong;      { The selected style bits         }
  6688.     flStyleMask:       ULong;      { Mask of which style bits to use }
  6689.     clrFore:           Long;       { Selected foreground color       }
  6690.     clrBack:           Long;       { Selected background color       }
  6691.     ulUser:            ULong;      { Blank field for application     }
  6692.     lReturn:           Long;       { Return Value of the Dialog      }
  6693.     lSRC:              Long;       { System return code.             }
  6694.     lEmHeight:         Long;       { Em height of the current font   }
  6695.     lXHeight:          Long;       { X height of the current font    }
  6696.     lExternalLeading:  Long;       { External Leading of font        }
  6697.     hMod:              HModule;    { Module to load custom template  }
  6698.     fAttrs:            FAttrs;     { Font attribute record           }
  6699.     sNominalPointSize: SmallWord;  { Nominal Point Size of font      }
  6700.     usWeight:          SmallWord;  { The boldness of the font        }
  6701.     usWidth:           SmallWord;  { The width of the font           }
  6702.     x:                 SmallInt;   { X coordinate of the dialog      }
  6703.     y:                 SmallInt;   { Y coordinate of the dialog      }
  6704.     usDlgId:           SmallWord;  { ID of a custom dialog template  }
  6705.     usFamilyBufLen:    SmallWord;  { Length of family buffer provided}
  6706.     usReserved:        SmallWord;  { reserved                        }
  6707.   end;
  6708.  
  6709. { Font Dialog Style Flags }
  6710. const
  6711.   fnts_Center                   = $00000001; { Center in owner dialog}
  6712.   fnts_Custom                   = $00000002; { Use custom template   }
  6713.   fnts_OwnerDrawPreview         = $00000004; { Allow app to draw     }
  6714.   fnts_HelpButton               = $00000008; { Display Help button   }
  6715.   fnts_ApplyButton              = $00000010; { Display Apply button  }
  6716.   fnts_ResetButton              = $00000020; { Display Reset button  }
  6717.   fnts_Modeless                 = $00000040; { Make dialog modeless  }
  6718.   fnts_InitFromFAttrs           = $00000080; { Initialize from FATTRs}
  6719.   fnts_BitmapOnly               = $00000100; { Only allow bitmap font}
  6720.   fnts_VectorOnly               = $00000200; { Only allow vector font}
  6721.   fnts_FixedWidthOnly           = $00000400; { Only allow monospaced }
  6722.   fnts_ProportionalOnly         = $00000800; { Only proportional font}
  6723.   fnts_NoSynthesizedFonts       = $00001000; { Don't synthesize fonts}
  6724. { Font Dialog Flags }
  6725.   fntf_NoViewScreenFonts        = 1;
  6726.   fntf_NoViewPrinterFonts       = 2;
  6727.   fntf_ScreenFontSelected       = 4;
  6728.   fntf_PrinterFontSelected      = 8;
  6729. { Color code definitions }
  6730.   clrc_Foreground               = 1;
  6731.   clrc_Background               = 2;
  6732. { Filter List message string identifiers }
  6733.   fnti_BitmapFont               = $0001;
  6734.   fnti_VectorFont               = $0002;
  6735.   fnti_FixedWidthFont           = $0004;
  6736.   fnti_ProportionalFont         = $0008;
  6737.   fnti_Synthesized              = $0010;
  6738.   fnti_DefaultList              = $0020;
  6739.   fnti_FamilyName               = $0100;
  6740.   fnti_StyleName                = $0200;
  6741.   fnti_PointSize                = $0400;
  6742. { Error Return Codes from dialog (self defining) }
  6743.   fnts_Successful               = 0;
  6744.   fnts_Err_Invalid_Dialog       = 3;
  6745.   fnts_Err_Alloc_Shared_Mem     = 4;
  6746.   fnts_Err_Invalid_Parm         = 5;
  6747.   fnts_Err_Out_Of_Memory        = 7;
  6748.   fnts_Err_Invalid_Version      = 10;
  6749.   fnts_Err_Dialog_Load_Error    = 12;
  6750. { Font Dialog Messages }
  6751.   fntm_FaceNameChanged          = wm_User+50; { mp1 = PChar pszFacename   }
  6752.   fntm_PointSizeChanged         = wm_User+51; { mp1 = PChar pszPointSize, }
  6753.                                               { mp2 = Fixed fxPointSize   }
  6754.   fntm_StyleChanged             = wm_User+52; { mp1 = PStyleChange pstyc  }
  6755.   fntm_ColorChanged             = wm_User+53; { mp1 = Long clr            }
  6756.                                               { mp2 = Word codeClr        }
  6757.   fntm_UpdatePreview            = wm_User+54; { mp1 = HWnd HWndPreview    }
  6758.   fntm_FilterList               = wm_User+55; { mp1 = PChar pszFacename   }
  6759.                                               { mp2 = Word usStrStyle     }
  6760.                                               { mr=True(Add),False(Dont)  }
  6761. { StyleChange message parameter record }
  6762. type
  6763.   PStyleChange = ^StyleChange;
  6764.   StyleChange = record
  6765.     usWeight:       SmallWord;
  6766.     usWeightOld:    SmallWord;
  6767.     usWidth:        SmallWord;
  6768.     usWidthOld:     SmallWord;
  6769.     flType:         ULong;
  6770.     flTypeOld:      ULong;
  6771.     flTypeMask:     ULong;
  6772.     flTypeMaskOld:  ULong;
  6773.     flStyle:        ULong;
  6774.     flStyleOld:     ULong;
  6775.     flStyleMask:    ULong;
  6776.     flStyleMaskOld: ULong;
  6777.   end;
  6778.  
  6779. { Font Dialog functions }
  6780.  
  6781. function WinFontDlg(WndP,WndO: HWnd; var fntd: FontDlg): HWnd;
  6782. function WinDefFontDlgProc(Wnd: HWnd; Msg: ULong; Mp1,Mp2: MParam): MResult;
  6783.  
  6784. { font dialog and control id's }
  6785. const
  6786.   did_Font_Dialog               = 300;
  6787.   did_Name                      = 301;
  6788.   did_Style                     = 302;
  6789.   did_Display_Filter            = 303;
  6790.   did_Printer_Filter            = 304;
  6791.   did_Size                      = 305;
  6792.   did_Sample                    = 306;
  6793.   did_Outline                   = 307;
  6794.   did_Underscore                = 308;
  6795.   did_Strikeout                 = 309;
  6796.   did_Help_Button               = 310;
  6797.   did_Apply_Button              = 311;
  6798.   did_Reset_Button              = 312;
  6799.   did_Ok_Button                 = did_OK;
  6800.   did_Cancel_Button             = did_Cancel;
  6801.   did_Name_Prefix               = 313;
  6802.   did_Style_Prefix              = 314;
  6803.   did_Size_Prefix               = 315;
  6804.   did_Sample_Groupbox           = 316;
  6805.   did_Emphasis_Groupbox         = 317;
  6806. { stringtable id's }
  6807.   ids_Font_Sample               = 350;
  6808.   ids_Font_Blank                = 351;
  6809.   ids_Font_Key_0                = 352;
  6810.   ids_Font_Key_9                = 353;
  6811.   ids_Font_Key_Sep              = 354;
  6812.   ids_Font_Disp_Only            = 355;
  6813.   ids_Font_Printer_Only         = 356;
  6814.   ids_Font_Combined             = 357;
  6815.   ids_Font_Weight1              = 358;
  6816.   ids_Font_Weight2              = 359;
  6817.   ids_Font_Weight3              = 360;
  6818.   ids_Font_Weight4              = 361;
  6819.   ids_Font_Weight5              = 362;
  6820.   ids_Font_Weight6              = 363;
  6821.   ids_Font_Weight7              = 364;
  6822.   ids_Font_Weight8              = 365;
  6823.   ids_Font_Weight9              = 366;
  6824.   ids_Font_Width1               = 367;
  6825.   ids_Font_Width2               = 368;
  6826.   ids_Font_Width3               = 369;
  6827.   ids_Font_Width4               = 370;
  6828.   ids_Font_Width5               = 371;
  6829.   ids_Font_Width6               = 372;
  6830.   ids_Font_Width7               = 373;
  6831.   ids_Font_Width8               = 374;
  6832.   ids_Font_Width9               = 375;
  6833.   ids_Font_Option0              = 376;
  6834.   ids_Font_Option1              = 377;
  6835.   ids_Font_Option2              = 378;
  6836.   ids_Font_Option3              = 379;
  6837.   ids_Font_Point_Size_List      = 380;
  6838.  
  6839. {---------------[ S P I N    B U T T O N ]----------------}
  6840.  
  6841. { SPINBUTTON Creation Flags }
  6842. const
  6843. { Character Acceptance      }
  6844.   spbs_AllCharActers            = $00000000; { Default: All chars accepted }
  6845.   spbs_NumericOnly              = $00000001; { Only 0 - 9 accepted & VKeys }
  6846.   spbs_ReadOnly                 = $00000002; { No chars allowed in entryfld}
  6847. { Type of Component }
  6848.   spbs_Master                   = $00000010;
  6849.   spbs_Servant                  = $00000000; { Default: Servant            }
  6850. { Type of Justification }
  6851.   spbs_JustDefault              = $00000000; { Default: Same as Left       }
  6852.   spbs_JustLeft                 = $00000008;
  6853.   spbs_JustRight                = $00000004;
  6854.   spbs_JustCenter               = $0000000C;
  6855. { Border or not }
  6856.   spbs_NoBorder                 = $00000020; { Borderless SpinField        }
  6857.                                              { Default is to have a border }
  6858. { Fast spin or not }
  6859.   spbs_FastSpin                 = $00000100; { Allow fast spinning.  Fast  }
  6860.                                              { spinning is performed by    }
  6861.                                              { skipping over numbers       }
  6862. { Pad numbers on front with 0's }
  6863.   spbs_PadWithZeros             = $00000080; { Pad the number with zeroes  }
  6864.  
  6865. { SPINBUTTON Messages }
  6866. { Notification from Spinbutton to the application is sent in a }
  6867. { wm_Control message.                                          }
  6868.   spbn_UpArrow                  = $20A;      { up arrow button was pressed  }
  6869.   spbn_DownArrow                = $20B;      { down arrow button was pressed}
  6870.   spbn_EndSpin                  = $20C;      { mouse button was released    }
  6871.   spbn_Change                   = $20D;      { spinfield text has changed   }
  6872.   spbn_SetFocus                 = $20E;      { spinfield received focus     }
  6873.   spbn_KillFocus                = $20F;      { spinfield lost focus         }
  6874. { Messages from application to Spinbutton }
  6875.   spbm_OverrideSetLimits        = $200; { Set spinbutton limits without }
  6876.                                         {   resetting the current value }
  6877.   spbm_QueryLimits              = $201; { Query limits set by           }
  6878.                                         {   spbm_SetLimits              }
  6879.   spbm_SetTextLimit             = $202; { Max entryfield characters     }
  6880.   spbm_SpinUp                   = $203; { Tell entry field to spin up   }
  6881.   spbm_SpinDown                 = $204; { Tell entry field to spin down }
  6882.   spbm_QueryValue               = $205; { Tell entry field to send      }
  6883.                                         { current value                 }
  6884. { Query Flags }
  6885.   spbq_UpdateIfValid            = 0;    { Default                       }
  6886.   spbq_AlwaysUpdate             = 1;
  6887.   spbq_DoNotUpdate              = 3;
  6888.  
  6889. { Return value for Empty Field }
  6890. { If ptr too Long, variable sent in query msg }
  6891.   spbm_SetArray                 = $206; { Change the data to spin      }
  6892.   spbm_SetLimits                = $207; { Change the numeric Limits    }
  6893.   spbm_SetCurrentValue          = $208; { Change the current value     }
  6894.   spbm_SetMaster                = $209; { Tell entryfield who master is}
  6895.  
  6896. type
  6897. { Spin Button control data structure }
  6898.   PspbcData = ^spbcData;
  6899.   spbcData = record
  6900.     cbSize:      ULong;   // Size of control block
  6901.     ulTextLimit: ULong;   // Entryfield text limit
  6902.     lLowerLimit: Long;    // Spin lower limit (numeric only)
  6903.     lUpperLimit: Long;    // Spin upper limit (numeric only)
  6904.     idMasterSpb: ULong;   // ID of the servant's master spb
  6905.     pHWXCtlData: Pointer; // reserved for Pen CtlData
  6906.   end;
  6907.  
  6908. const
  6909. {---------------[ DIRECT MANIPULATION ]-------------------}
  6910.  
  6911.   pmerr_Not_Dragging            = $1F00;
  6912.   pmerr_Already_Dragging        = $1F01;
  6913.  
  6914.   msgf_Drag                     = $0010    { message filter identifier };
  6915.  
  6916.   wm_DragFirst                  = $0310;
  6917.   wm_DragLast                   = $032F;
  6918.  
  6919.   dm_Drop                       = $032F;
  6920.   dm_DragOver                   = $032E;
  6921.   dm_DragLeave                  = $032D;
  6922.   dm_DropHelp                   = $032C;
  6923.   dm_EndConversation            = $032B;
  6924.   dm_Print                      = $032A;
  6925.   dm_Render                     = $0329;
  6926.   dm_RenderComplete             = $0328;
  6927.   dm_RenderPrepare              = $0327;
  6928.   dm_DragFileComplete           = $0326;
  6929.   dm_EmphasizeTarget            = $0325;
  6930.   dm_DragError                  = $0324;
  6931.   dm_FileRendered               = $0323;
  6932.   dm_RenderFile                 = $0322;
  6933.   dm_DragOverNotify             = $0321;
  6934.   dm_PrintObject                = $0320;
  6935.   dm_DiscardObject              = $031F;
  6936.   dm_DropNotify                 = $031e;
  6937.  
  6938.   drt_Asm                       = 'Assembler Code';  { drag type constants  }
  6939.   drt_Basic                     = 'BASIC Code';
  6940.   drt_BinData                   = 'Binary Data';
  6941.   drt_Bitmap                    = 'Bitmap';
  6942.   drt_C                         = 'C Code';
  6943.   drt_Cobol                     = 'COBOL Code';
  6944.   drt_Dll                       = 'Dynamic Link Library';
  6945.   drt_DosCmd                    = 'DOS Command File';
  6946.   drt_Exe                       = 'Executable';
  6947.   drt_Fortran                   = 'FORTRAN Code';
  6948.   drt_Icon                      = 'Icon';
  6949.   drt_Lib                       = 'Library';
  6950.   drt_MetaFile                  = 'Metafile';
  6951.   drt_Os2Cmd                    = 'OS/2 Command File';
  6952.   drt_Pascal                    = 'Pascal Code';
  6953.   drt_Resource                  = 'Resource File';
  6954.   drt_Text                      = 'Plain Text';
  6955.   drt_Unknown                   = 'Unknown';
  6956.  
  6957.   dor_NoDrop                    = $0000;  { dm_DragOver response codes }
  6958.   dor_Drop                      = $0001;
  6959.   dor_NoDropOp                  = $0002;
  6960.   dor_NeverDrop                 = $0003;
  6961.  
  6962.   do_Copyable                   = $0001;  { supported operation flags  }
  6963.   do_Moveable                   = $0002;
  6964.   do_Linkable                   = $0004;
  6965.   do_Creatable                  = $0008;
  6966.  
  6967.   dc_Open                       = $0001;  { source control flags       }
  6968.   dc_Ref                        = $0002;
  6969.   dc_Group                      = $0004;
  6970.   dc_Container                  = $0008;
  6971.   dc_Prepare                    = $0010;
  6972.   dc_RemoveableMedia            = $0020;
  6973.  
  6974.   do_Default                    = $BFFE;  { Default operation          }
  6975.   do_Unknown                    = $BFFF;  { Unknown operation          }
  6976.   do_Copy                       = $0010;
  6977.   do_Move                       = $0020;
  6978.   do_Link                       = $0018;
  6979.   do_Create                     = $0040;
  6980.  
  6981.   dgs_DragInProgress            = $0001;  { Standard Drag in Progress. }
  6982.   dgs_LazyDragInProgress        = $0002;  { Lazy Drag in Progress.     }
  6983.  
  6984.   dmfl_TargetSuccessful         = $0001;  { transfer reply flags       }
  6985.   dmfl_TargetFail               = $0002;
  6986.   dmfl_NativeRender             = $0004;
  6987.   dmfl_RenderRetry              = $0008;
  6988.   dmfl_RenderOk                 = $0010;
  6989.   dmfl_RenderFail               = $0020;
  6990.  
  6991.   drg_Icon                      = $00000001;    { drag image manipulation    }
  6992.   drg_Bitmap                    = $00000002;    {   flags                    }
  6993.   drg_Polygon                   = $00000004;
  6994.   drg_Stretch                   = $00000008;
  6995.   drg_Transparent               = $00000010;
  6996.   drg_Closed                    = $00000020;
  6997.   drg_MiniBitMap                = $00000040;
  6998.  
  6999.   dme_IgnoreAbort               = 1;            { dm_DragError return values }
  7000.   dme_IgnoreContinue            = 2;
  7001.   dme_Replace                   = 3;
  7002.   dme_Retry                     = 4;
  7003.  
  7004.   df_Move                       = $0001;        { dm_DragFileComplete flags  }
  7005.   df_Source                     = $0002;
  7006.   df_Successful                 = $0004;
  7007.  
  7008.   drr_Source                    = 1;
  7009.   drr_Target                    = 2;
  7010.   drr_Abort                     = 3;
  7011.  
  7012.   dff_Move                      = 1;            { dm_DragError operation IDs }
  7013.   dff_Copy                      = 2;
  7014.   dff_Delete                    = 3;
  7015.  
  7016. type
  7017.   HStr = LHandle;
  7018.   PDragItem = ^DragItem;
  7019.   DragItem = record
  7020.     hWndItem:          HWnd;           { conversation partner          }
  7021.     ulItemID:          ULong;          { identifies item being dragged }
  7022.     HStrType:          HStr;           { type of item                  }
  7023.     HStrRMF:           HStr;           { rendering mechanism and format}
  7024.     HStrContainerName: HStr;           { name of source container      }
  7025.     HStrSourceName:    HStr;           { name of item at source        }
  7026.     HStrTargetName:    HStr;           { suggested name of item at dest}
  7027.     cxOffset:          SmallInt;       { x offset of the origin of the }
  7028.                                        {   image from the mouse hotspot}
  7029.     cyOffset:          SmallInt;       { y offset of the origin of the }
  7030.                                        {   image from the mouse hotspot}
  7031.     fsControl:         SmallWord;      { source item control flags     }
  7032.     fsSupportedOps:    SmallWord;      { ops supported by source       }
  7033.   end;
  7034.  
  7035.   PDragInfo = ^DragInfo;
  7036.   DragInfo = record
  7037.     cbDraginfo:  ULong;                { Size of DragInfo and DragItems}
  7038.     cbDragitem:  SmallWord;            { size of DragItem              }
  7039.     usOperation: SmallWord;            { current drag operation        }
  7040.     hWndSource:  HWnd;                 { window handle of source       }
  7041.     xDrop:       SmallInt;             { x coordinate of drop position }
  7042.     yDrop:       SmallInt;             { y coordinate of drop position }
  7043.     cditem:      SmallWord;            { count of DragItems            }
  7044.     usReserved:  SmallWord;            { reserved for future use       }
  7045.   end;
  7046.  
  7047.   PDragImage = ^DragImage;
  7048.   DragImage = record
  7049.     cb:          SmallWord;            { size control block            }
  7050.     cptl:        SmallWord;            { count of pts, if drg_Polygon  }
  7051.     hImage:      LHandle;              { image handle passed to DrgDrag}
  7052.     sizlStretch: SizeL;                { size to strecth ico or bmp to }
  7053.     fl:          ULong;                { flags passed to DrgDrag       }
  7054.     cxOffset:    SmallInt;             { x offset of the origin of the }
  7055.                                        {   image from the mouse hotspot}
  7056.     cyOffset:    SmallInt;             { y offset of the origin of the }
  7057.   end;                                 {   image from the mouse hotspot}
  7058.  
  7059.   PDragTransfer = ^DragTransfer;
  7060.   DragTransfer = record
  7061.     cb:               ULong;           { size of control block         }
  7062.     hWndClient:       HWnd;            { handle of target              }
  7063.     pditem:           PDragItem;       { DragItem being transferred    }
  7064.     HStrSelectedRMF:  HStr;            { rendering mech & fmt of choice}
  7065.     HStrRenderToName: HStr;            { name source will use          }
  7066.     ulTargetInfo:     ULong;           { reserved for target's use     }
  7067.     usOperation:      SmallWord;       { operation being performed     }
  7068.     fsReply:          SmallWord;       { reply flags                   }
  7069.   end;
  7070.  
  7071.   PRenderFile = ^RenderFile;
  7072.   RenderFile = record
  7073.     hWndDragFiles: HWnd;               { conversation window           }
  7074.     HStrSource:    HStr;               { handle to source file name    }
  7075.     HStrTarget:    HStr;               { handle to target file name    }
  7076.     fMove:         SmallWord;          { True - move, False - copy     }
  7077.     usRsvd:        SmallWord;          { reserved                      }
  7078.   end;
  7079.  
  7080. function DrgAcceptDroppedFiles(Wnd: HWnd; Path,Types: PChar;
  7081.   DefaultOp,Reserved: ULong): Bool;
  7082. function DrgAllocDraginfo(cditem: ULong): PDragInfo;
  7083. function DrgAllocDragtransfer(cdxfer: ULong): PDragTransfer;
  7084. function DrgDrag(Source: HWnd; var dinfo: DragInfo; var dimg: DragImage;
  7085.   cdimg: ULong; vkTerminate: Long; Reserved: Pointer): HWnd;
  7086. function DrgDragFiles(Wnd: HWnd; var apszFiles,apszTypes,apszTargets: PChar;
  7087.   cFiles: ULong; hptrDrag: HPointer; vkTerm: ULong; fSourceRender: Bool; Reserved: ULong): Bool;
  7088. function DrgPostTransferMsg(Wnd: HWnd; Msg: ULong; var dxfer: DragTransfer;
  7089.   fl,Reserved: ULong; fRetry: Bool): Bool;
  7090. function DrgQueryDragitem(var dinfo: DragInfo; cbBuffer: ULong; var ditem: DragItem;
  7091.   iItem: ULong): Bool;
  7092. function DrgQueryDragitemCount(var dinfo: DragInfo): ULong;
  7093. function DrgQueryDragitemPtr(var dinfo: DragInfo; I: ULong): PDragItem;
  7094. function DrgQueryNativeRMF(var ditem: DragItem; cbBuffer: ULong; var Buffer): Bool;
  7095. function DrgQueryNativeRMFLen(var ditem: DragItem): ULong;
  7096. function DrgQueryStrName(Str: HStr; cbBuffer: ULong; Buffer: PChar): ULong;
  7097. function DrgQueryStrNameLen(Str: HStr): ULong;
  7098. function DrgQueryTrueType(var ditem: DragItem; cbBuffer: ULong; Buffer: PChar): Bool;
  7099. function DrgQueryTrueTypeLen(var ditem: DragItem): ULong;
  7100. function DrgSendTransferMsg(Wnd: HWnd; Msg: ULong; Mp1,Mp2: MParam): MResult;
  7101. function DrgSetDragitem(var dinfo: DragInfo; var ditem: DragItem;
  7102.   cbBuffer,iItem: ULong): Bool;
  7103. function DrgSetDragImage(var dinfo: DragInfo; var dimg: DragImage; cdimg: ULong;
  7104.   Reserved: Pointer): Bool;
  7105. function DrgVerifyTypeSet(var ditem: DragItem; pszType: PChar; cbMatch: ULong;
  7106.   pszMatch: PChar): Bool;
  7107. function DrgAccessDraginfo(var dinfo: DragInfo): Bool;
  7108. function DrgAddStrHandle(P: PChar): HStr;
  7109. function DrgDeleteDraginfoStrHandles(var dinfo: DragInfo): Bool;
  7110. function DrgDeleteStrHandle(Str: HStr): Bool;
  7111. function DrgFreeDraginfo(var dinfo: DragInfo): Bool;
  7112. function DrgFreeDragtransfer(var dxfer: DragTransfer): Bool;
  7113. function DrgGetPS(Wnd: HWnd): Hps;
  7114. function DrgPushDraginfo(var dinfo: DragInfo; WndDest: HWnd): Bool;
  7115. function DrgReleasePS(PS: Hps): Bool;
  7116. function DrgSetDragPointer(var dinfo: DragInfo; hptr: HPointer): Bool;
  7117. function DrgVerifyNativeRMF(var ditem: DragItem; pszRMF: PChar): Bool;
  7118. function DrgVerifyRMF(var ditem: DragItem; Mech,Fmt: PChar): Bool;
  7119. function DrgVerifyTrueType(var ditem: DragItem; pszType: PChar): Bool;
  7120. function DrgVerifyType(var ditem: DragItem; pszType: PChar): Bool;
  7121. { Lazy Drag API's.                               }
  7122. function DrgLazyDrag(hwndSource: HWnd; var dInfo: DragInfo;
  7123.   var dimg: DragImage; cdimg: ULong; pRsvd: Pointer ) : Bool;
  7124. procedure DrgCancelLazyDrag;
  7125. function DrgLazyDrop(hwndTarget: HWnd; ulOperation: ULong;
  7126.   var ptlDrop: PointL ): Bool;
  7127. function DrgQueryDraginfoPtr( pRsvd: PDRAGINFO  ) : pDragInfo;
  7128. function DrgQueryDraginfoPtrFromHwnd( hwndSource: HWnd ) : pDragInfo;
  7129. function DrgQueryDraginfoPtrFromDragitem( var ditem: DragItem ) : pDragInfo;
  7130. function DrgQueryDragStatus : ULong;
  7131. function DrgReallocDraginfo (var dinfoOld: DragInfo; cditem: ULong) : pDragInfo;
  7132.  
  7133. {---------------[ C O N T A I N E R ]---------------------}
  7134.  
  7135. const
  7136. { Error constants }
  7137.   pmerr_Nofiltered_Items        = $1F02;
  7138.   pmerr_Comparison_Failed       = $1F03;
  7139.   pmerr_Record_Currently_Inserted = $1F04;
  7140.   pmerr_Fi_Currently_Inserted   = $1F05;
  7141. { Container control styles }
  7142.   ccs_ExtendSel                 = $00000001;
  7143.   ccs_MultipleSel               = $00000002;
  7144.   ccs_SingleSel                 = $00000004;
  7145.   ccs_AutoPosition              = $00000008;
  7146.   ccs_VerifyPointers            = $00000010;
  7147.   ccs_ReadOnly                  = $00000020;
  7148.   ccs_MiniRecordCore            = $00000040;
  7149. { view identifiers (flWindowAttr) }
  7150.   cv_Text                       = $00000001;  { text view            }
  7151.   cv_Name                       = $00000002;  { name view            }
  7152.   cv_Icon                       = $00000004;  { icon view            }
  7153.   cv_Detail                     = $00000008;  { detail view          }
  7154.   cv_Flow                       = $00000010;  { flow items           }
  7155.   cv_Mini                       = $00000020;  { use mini icon        }
  7156.   cv_Tree                       = $00000040;  { tree view            }
  7157.   cv_ExactLength                = $10000000;  { Exact match for SearchString    }
  7158. { Container Attributes (flWindowAttr) }
  7159.   ca_ContainerTitle             = $00000200;
  7160.   ca_TitleSeparator             = $00000400;
  7161.   ca_TitleLeft                  = $00000800;
  7162.   ca_TitleRight                 = $00001000;
  7163.   ca_TitleCenter                = $00002000;
  7164.   ca_OwnerDraw                  = $00004000;
  7165.   ca_DetailsViewTitles          = $00008000;
  7166.   ca_OrderedTargetEmph          = $00010000;
  7167.   ca_DrawBitmap                 = $00020000;
  7168.   ca_DrawIcon                   = $00040000;
  7169.   ca_TitleReadOnly              = $00080000;
  7170.   ca_OwnerPaintBackground       = $00100000;
  7171.   ca_MixedTargetEmph            = $00200000;
  7172.   ca_TreeLine                   = $00400000;
  7173. { child window IDs }
  7174.   cid_LeftColTitleWnd           = $7FF0;   { column title (left)       }
  7175.   cid_RightColTitleWnd          = $7FF1;   { right column title        }
  7176.   cid_BlankBox                  = $7FF2;   { blank box at bottom right }
  7177.   cid_HScroll                   = $7FF3;   { horizontal scroll bar     }
  7178.   cid_RighthScroll              = $7FF4;   { right horz scroll bar     }
  7179.   cid_CnrTitleWnd               = $7FF5;   { Container title window    }
  7180.   cid_LeftDvWnd                 = $7FF7;   { Left Details View window  }
  7181.   cid_RightDvWnd                = $7FF8;   { Right Details View window }
  7182.   cid_VScroll                   = $7FF9;   { vertical scroll bar       }
  7183.   cid_Mle                       = $7FFA;   { MLE window for direct edit}
  7184.  
  7185. { Bitmap descriptor array element }
  7186.  
  7187. type
  7188.   PTreeItemDesc = ^TreeItemDesc;
  7189.   TreeItemDesc = record
  7190.     hbmExpanded:   HBitMap;
  7191.     hbmCollapsed:  HBitMap;
  7192.     hptrExpanded:  HPointer;
  7193.     hptrCollapsed: HPointer;
  7194.   end;
  7195.  
  7196. { Field Info data record, attribute and data types, cv_Detail }
  7197.  
  7198.   PFieldInfo = ^FieldInfo;
  7199.   FieldInfo = record
  7200.     cb:           ULong;              { size of FieldInfo record         }
  7201.     flData:       ULong;              { attributes of field's data       }
  7202.     flTitle:      ULong;              { attributes of field's title      }
  7203.     pTitleData:   Pointer;            { title data (default is string)   }
  7204.                                       { If cft_Bitmap, must be HBitMap   }
  7205.     offStruct:    ULong;              { offset from RecordCore to data   }
  7206.     pUserData:    Pointer;            { pointer to user data             }
  7207.     pNextFieldInfo: PFieldInfo;       { pointer to next linked FieldInfo }
  7208.     cxWidth:      ULong;              { width of field in pels           }
  7209.   end;
  7210.  
  7211. { RecordCore data record, attribute values }
  7212.  
  7213.   PRecordCore = ^RecordCore;
  7214.   RecordCore = record
  7215.     cb:              ULong;
  7216.     flRecordAttr:    ULong;            { record attributes                }
  7217.     ptlIcon:         PointL;           { Position of cv_Icon item         }
  7218.     preccNextRecord: PRecordCore;      { ptr to next record               }
  7219.     pszIcon:         PChar;            { Text for cv_Icon view            }
  7220.     hptrIcon:        HPointer;         { Icon to display for not cv_Mini  }
  7221.     hptrMiniIcon:    HPointer;         { Icon to display for cv_Mini      }
  7222.     hbmBitmap:       HBitMap;          { Bitmap to display for not cv_Mini}
  7223.     hbmMiniBitmap:   HBitMap;          { Bitmap to display for cv_Mini    }
  7224.     TreeItemDesc:    PTreeItemDesc;    { Icons for the tree view          }
  7225.     pszText:         PChar;            { Text for cv_Text view            }
  7226.     pszName:         PChar;            { Text for cv_Name view            }
  7227.     pszTree:         PChar;            { Text for cv_Tree view            }
  7228.   end;
  7229.  
  7230. { MiniRecordCore data record, attribute values }
  7231.  
  7232.   PMiniRecordCore = ^MiniRecordCore;
  7233.   MiniRecordCore = record
  7234.     cb:              ULong;
  7235.     flRecordAttr:    ULong;          { record attributes              }
  7236.     ptlIcon:         PointL;         { Position of cv_Icon item       }
  7237.     preccNextRecord: PMiniRecordCore;{ ptr to next record             }
  7238.     pszIcon:         PChar;          { Text for cv_Icon view          }
  7239.     hptrIcon:        HPointer;       { Icon to display for not cv_Mini}
  7240.   end;
  7241.  
  7242. { Data structure for moving nodes in a tree to a new parent }
  7243.  
  7244.   PTreeMove = ^TreeMove;
  7245.   TreeMove = record
  7246.     preccMove:      pRecordCore;   // Record to be moved.
  7247.     preccNewParent: pRecordCore;   // New parent for preccMove.
  7248.     pRecordOrder:   pRecordCore;   // Record order for siblings.
  7249.     flMoveSiblings: Bool;          // TRUE: Siblings after preccMove
  7250.                                    // move to new parent as well.
  7251.   end;
  7252. { CnrInfo data record, describes the container control }
  7253.  
  7254.   PCnrInfo = ^CnrInfo;
  7255.   CnrInfo = record
  7256.     cb:                 ULong;       { size of CnrInfo record        }
  7257.     pSortRecord:        Pointer;     { ptr to sort function,         }
  7258.                                      { RecordCore                    }
  7259.     PFieldInfoLast:     PFieldInfo;  { pointer to last column in     }
  7260.                                      { left pane of a split window.  }
  7261.     PFieldInfoObject:   PFieldInfo;  { Pointer to a column to        }
  7262.                                      { represent an object.  This is }
  7263.                                      { the column which will receive }
  7264.                                      { IN-USE emphasis.              }
  7265.     pszCnrTitle:        PChar;       { text for container title. One }
  7266.                                      { string separated by line      }
  7267.                                      { separators for multi-lines    }
  7268.     flWindowAttr:       ULong;       { container attrs - cv_*, ca_*  }
  7269.     ptlOrigin:          PointL;      { lower-left origin in virtual  }
  7270.                                      {   coordinates. cv_Icon view   }
  7271.     cDelta:             ULong;       { Application defined threshold }
  7272.                                      {   or number of records from   }
  7273.                                      {   either end of the list.     }
  7274.     cRecords:           ULong;       { number of records in container}
  7275.     slBitmapOrIcon:     SizeL;       { size of bitmap in pels        }
  7276.     slTreeBitmapOrIcon: SizeL;       { size of tree bitmaps in pels  }
  7277.     hbmExpanded:        HBitMap;     { bitmap  for tree node         }
  7278.     hbmCollapsed:       HBitMap;     { bitmap  for tree node         }
  7279.     hptrExpanded:       HPointer;    { icon    for tree node         }
  7280.     hptrCollapsed:      HPointer;    { icon    for tree node         }
  7281.     cyLineSpacing:      Long;        { space between two rows        }
  7282.     cxTreeIndent:       Long;        { indent for children           }
  7283.     cxTreeLine:         Long;        { thickness of the Tree Line    }
  7284.     cFields:            ULong;       { number of fields  in container}
  7285.     xVertSplitbar:      Long;        { position relative to the      }
  7286.                                      {   container (cv_Detail): if   }
  7287.                                      {   $FFFF then unsplit          }
  7288.   end;
  7289.  
  7290.   PCDate = ^CDate;
  7291.   CDate = record
  7292.     day:   Byte;                     { current day               }
  7293.     month: Byte;                     { current month             }
  7294.     year:  SmallWord;                { current year              }
  7295.   end;
  7296.  
  7297.   PCTime = ^CTime;
  7298.   CTime = record
  7299.     hours:      Byte;                { current hour              }
  7300.     minutes:    Byte;                { current minute            }
  7301.     seconds:    Byte;                { current second            }
  7302.     ucReserved: Byte;                { reserved                  }
  7303.   end;
  7304.  
  7305. { attribute and type values for flData and flTitle members of }
  7306. { FieldInfo, cfa_ (attributes), cft_ (types)                  }
  7307. const
  7308.   cfa_Left                      = $00000001; { left align text            }
  7309.   cfa_Right                     = $00000002; { right align text           }
  7310.   cfa_Center                    = $00000004; { center text                }
  7311.   cfa_Top                       = $00000008; { top-align text             }
  7312.   cfa_VCenter                   = $00000010; { vertically center text     }
  7313.   cfa_Bottom                    = $00000020; { bottom-align text          }
  7314.   cfa_Invisible                 = $00000040; { Specify invisible column.  }
  7315.   cfa_BitmapOrIcon              = $00000100; { field title is bitmap      }
  7316.   cfa_Separator                 = $00000200; { vert sep, right of fld     }
  7317.   cfa_HorzSeparator             = $00000400; { horz sep, bottom of fld    }
  7318.  
  7319.   cfa_String                    = $00000800; { string of characters       }
  7320.   cfa_Owner                     = $00001000; { ownerdraw field            }
  7321.   cfa_Date                      = $00002000; { date record                }
  7322.   cfa_Time                      = $00004000; { time record                }
  7323.   cfa_FiReadOnly                = $00008000; { Column is read-only.       }
  7324.   cfa_FiTitleReadOnly           = $00010000; { Column Title is read-only  }
  7325.   cfa_ULong                     = $00020000; { Column is number format    }
  7326.   cfa_Ignore                    = $80000000; { flData bit for FieldInfo   }
  7327. { attribute values for flRecordAttr member of RecordCore }
  7328.   cra_Selected                  = $00000001; { record is selected         }
  7329.   cra_Target                    = $00000002; { record has target emphasis }
  7330.   cra_Cursored                  = $00000004; { cursor is on the record    }
  7331.   cra_Inuse                     = $00000008; { record has in-use emphasis }
  7332.   cra_Filtered                  = $00000010; { record has been filtered   }
  7333.   cra_Droponable                = $00000020; { record can be dropped on   }
  7334.   cra_RecordReadOnly            = $00000040; { record is read-only        }
  7335.   cra_Expanded                  = $00000080; { record is expanded         }
  7336.   cra_Collapsed                 = $00000100; { record is collapsed        }
  7337.   cra_Ignore                    = $00008000; { flRecordAttr bit for Recordcore }
  7338.   cra_Source                    = $00004000; { flRecordAttr bit for Recordcore }
  7339.   cra_Disabled                  = $00001000; { flRecordAttr bit for Recordcore }
  7340.   cra_OwnerFree                 = $00010000; { flRecordAttr bit for Recordcore }
  7341.   cra_OwnerDraw                 = $00020000; { flRecordAttr bit for Recordcore }
  7342.  
  7343. { Container messages }
  7344.   cm_AllocDetailFieldInfo       = $0330;
  7345.   cm_AllocRecord                = $0331;
  7346.   cm_Arrange                    = $0332;
  7347.   cm_EraseRecord                = $0333;
  7348.   cm_Filter                     = $0334;
  7349.   cm_FreeDetailFieldInfo        = $0335;
  7350.   cm_FreeRecord                 = $0336;
  7351.   cm_HorzScrollSplitWindow      = $0337;
  7352.   cm_InsertDetailFieldInfo      = $0338;
  7353.   cm_InsertRecord               = $0339;
  7354.   cm_InvalidateDetailFieldInfo  = $033A;
  7355.   cm_InvalidateRecord           = $033B;
  7356.   cm_PaintBackground            = $033C;
  7357.   cm_QueryCnrInfo               = $033D;
  7358.   cm_QueryDetailFieldInfo       = $033E;
  7359.   cm_QueryDragImage             = $033F;
  7360.   cm_QueryRecord                = $0340;
  7361.   cm_QueryRecordEmphasis        = $0341;
  7362.   cm_QueryRecordFromRect        = $0342;
  7363.   cm_QueryRecordRect            = $0343;
  7364.   cm_QueryViewPortRect          = $0344;
  7365.   cm_RemoveDetailFieldInfo      = $0345;
  7366.   cm_RemoveRecord               = $0346;
  7367.   cm_ScrollWindow               = $0347;
  7368.   cm_SearchString               = $0348;
  7369.   cm_SetCnrInfo                 = $0349;
  7370.   cm_SetRecordEmphasis          = $034A;
  7371.   cm_SortRecord                 = $034B;
  7372.   cm_OpenEdit                   = $034C;
  7373.   cm_CloseEdit                  = $034D;
  7374.   cm_CollapseTree               = $034E;
  7375.   cm_ExpandTree                 = $034F;
  7376.   cm_QueryRecordInfo            = $0350;
  7377. { Container notifications }
  7378.   cn_DragAfter                  = 101;
  7379.   cn_DragLeave                  = 102;
  7380.   cn_DragOver                   = 103;
  7381.   cn_Drop                       = 104;
  7382.   cn_DropHelp                   = 105;
  7383.   cn_Enter                      = 106;
  7384.   cn_InitDrag                   = 107;
  7385.   cn_Emphasis                   = 108;
  7386.   cn_KillFocus                  = 109;
  7387.   cn_Scroll                     = 110;
  7388.   cn_QueryDelta                 = 111;
  7389.   cn_SetFocus                   = 112;
  7390.   cn_ReallocPsz                 = 113;
  7391.   cn_BeginEdit                  = 114;
  7392.   cn_EndEdit                    = 115;
  7393.   cn_CollapseTree               = 116;
  7394.   cn_ExpandTree                 = 117;
  7395.   cn_Help                       = 118;
  7396.   cn_ContextMenu                = 119;
  7397.   cn_VerifyEdit                 = 134;
  7398.   cn_Pickup                     = 135;
  7399.   cn_DropNotify                 = 136;
  7400.  
  7401. { Data records for Message Parameters   }
  7402. { Container Direct Manipulation records }
  7403. type
  7404.   PCnrDragInit = ^CnrDragInit;
  7405.   CnrDragInit = record
  7406.     hWndCnr: HWnd;                      { Container window handle   }
  7407.     pRecord: PRecordCore;               { record under mouse ptr    }
  7408.     x:       Long;                      { x coordinate of mouse ptr }
  7409.     y:       Long;                      { y coordinate of mouse ptr }
  7410.     cx:      Long;                      { x offset from record      }
  7411.     cy:      Long;                      { y offset from record      }
  7412.   end;
  7413.  
  7414. { Data record for cm_insertDetailFieldInfo                       }
  7415. { This record is used by the application to specify the position }
  7416. { of the FieldInfo records they are inserting.                   }
  7417.  
  7418.   PFieldInfoInsert = ^FieldInfoInsert;
  7419.   FieldInfoInsert = record
  7420.     cb:                   ULong;        { Size of record.           }
  7421.     PFieldInfoOrder:      PFieldInfo;   { Specifies the order of the}
  7422.                                         {  FieldInfo records.       }
  7423.     fInvalidateFieldInfo: ULong;        { Invalidate on Insert.     }
  7424.     cFieldInfoInsert:     ULong;        { The number of FieldInfo   }
  7425.                                         { records to insert.        }
  7426.   end;
  7427.  
  7428. { Data record for cm_InsertRecord }
  7429.  
  7430.   PRecordInsert = ^RecordInsert;
  7431.   RecordInsert = record
  7432.     cb:                ULong;
  7433.     pRecordOrder:      PRecordCore;
  7434.     pRecordParent:     PRecordCore;
  7435.     fInvalidateRecord: ULong;
  7436.     zOrder:            ULong;
  7437.     cRecordsInsert:    ULong;
  7438.   end;
  7439.  
  7440. { Data record for cm_QueryRecordFromRect }
  7441.  
  7442.   PQueryRecFromRect = ^QueryRecFromRect;
  7443.   QueryRecFromRect = record
  7444.     cb:       ULong;
  7445.     rect:     RectL;
  7446.     fsSearch: ULong;
  7447.   end;
  7448.  
  7449. { Data record for cm_QueryRecordRect }
  7450.  
  7451.   PQueryRecordRect = ^QueryRecordRect;
  7452.   QueryRecordRect = record
  7453.     cb:                ULong;
  7454.     pRecord:           PRecordCore;
  7455.     fRightSplitWindow: ULong;
  7456.     fsExtent:          ULong;
  7457.   end;
  7458.  
  7459. { Data record for cm_SearchString }
  7460.  
  7461.   PSearchString = ^SearchString;
  7462.   SearchString = record
  7463.     cb:              ULong;
  7464.     pszSearch:       PChar;
  7465.     fsPrefix:        ULong;
  7466.     fsCaseSensitive: ULong;
  7467.     usView:          ULong;
  7468.   end;
  7469.  
  7470.   { Data record for cn_DragLeave,cn_DragOver,cn_Drop,cn_DropHelp }
  7471.  
  7472.   PCnrDragInfo = ^CnrDragInfo;
  7473.   CnrDragInfo = record
  7474.     PDragInfo: PDragInfo;
  7475.     pRecord:  PRecordCore;
  7476.   end;
  7477.  
  7478. { Data Structure for cn_DropNotify }
  7479.  
  7480.   PCnrLazyDragInfo = ^CnrLazyDragInfo;
  7481.   CnrLazyDragInfo = record
  7482.     PDragInfo:  PDragInfo;
  7483.     pRecord:    PRecordCore;
  7484.     hwndTarget: HWnd;
  7485.   end;
  7486.  
  7487. { Data record for cn_Emphasis }
  7488.  
  7489.   PNotifyRecordEmphasis = ^NotifyRecordEmphasis;
  7490.   NotifyRecordEmphasis = record
  7491.     hWndCnr:       HWnd;
  7492.     pRecord:       PRecordCore;
  7493.     fEmphasisMask: ULong;
  7494.   end;
  7495.  
  7496. { Data record for cn_Enter }
  7497.  
  7498.   PNotifyRecordEnter = ^NotifyRecordEnter;
  7499.   NotifyRecordEnter = record
  7500.     hWndCnr: HWnd;
  7501.     fKey:    ULong;
  7502.     pRecord: PRecordCore;
  7503.   end;
  7504.  
  7505. { Data record for cn_QueryDelta }
  7506.  
  7507.   PNotifyDelta = ^NotifyDelta;
  7508.   NotifyDelta = record
  7509.     hWndCnr: HWnd;
  7510.     fDelta:  ULong;
  7511.   end;
  7512.  
  7513. { Data record for cn_Scroll }
  7514.  
  7515.   PNotifyScroll = ^NotifyScroll;
  7516.   NotifyScroll = record
  7517.     hWndCnr:    HWnd;
  7518.     lScrollInc: Long;
  7519.     fScroll:    ULong;
  7520.   end;
  7521.  
  7522. { Data record for cn_ReallocPsz }
  7523.  
  7524.   PPChar = ^PChar;
  7525.   PCnrEditData = ^CnrEditData;
  7526.   CnrEditData = record
  7527.     cb:         ULong;
  7528.     hWndCnr:    HWnd;
  7529.     pRecord:    PRecordCore;
  7530.     PFieldInfo: PFieldInfo;
  7531.     ppszText:   PPChar;               { address of PChar      }
  7532.     cbText:     ULong;                { size of the new text  }
  7533.     id:         ULong;
  7534.   end;
  7535.  
  7536. { Data record for cm_PaintBackground }
  7537.  
  7538.   POwnerBackground = ^OwnerBackground;
  7539.   OwnerBackground = record
  7540.     hWnd:          HWnd;
  7541.     Hps:           Hps;
  7542.     rclBackground: RectL;
  7543.     idWindow:      Long;
  7544.   end;
  7545.  
  7546. { Data record used as part of wm_DragItem }
  7547.  
  7548.   PCnrDrawItemInfo = ^CnrDrawItemInfo;
  7549.   CnrDrawItemInfo = record
  7550.     pRecord:    PRecordCore;
  7551.     PFieldInfo: PFieldInfo;
  7552.   end;
  7553.  
  7554. { Message parameter flags }
  7555. const
  7556.   cma_Top                       = $0001;      { Place at top of zorder   }
  7557.   cma_Bottom                    = $0002;      { Place at bottom of zorder}
  7558.   cma_Left                      = $0004;
  7559.   cma_Right                     = $0008;
  7560.  
  7561.   cma_First                     = $0010;      { Add record as first      }
  7562.   cma_Last                      = $0020;
  7563.   cma_End                       = $0040;      { Add record to end of list}
  7564.   cma_Prev                      = $0080;
  7565.   cma_Next                      = $0100;
  7566.  
  7567.   cma_Horizontal                = $0200;
  7568.   cma_Vertical                  = $0400;
  7569.   cma_Icon                      = $0800;
  7570.   cma_Text                      = $1000;
  7571.   cma_Partial                   = $2000;
  7572.   cma_Complete                  = $4000;
  7573.  
  7574.   cma_Parent                    = $0001;
  7575.   cma_FirstChild                = $0002;
  7576.   cma_LastChild                 = $0004;
  7577.  
  7578.   cma_CnrTitle                  = $0001;      { Container title          }
  7579.   cma_Delta                     = $0002;      { Application defined      }
  7580.   cma_FlWindowAttr              = $0004;      { Container attributes     }
  7581.   cma_LineSpacing               = $0008;
  7582.   cma_PFieldInfoLast            = $0010;      { Ptr to last column in    }
  7583.  
  7584.   cma_PSortRecord               = $0020;      { Pointer to sort function }
  7585.   cma_PtlOrigin                 = $0040;      { Lower left origin        }
  7586.   cma_SlBitmapOrIcon            = $0080;      { Size  of bitmap          }
  7587.   cma_XVertSplitBar             = $0100;      { Splitbar position        }
  7588.   cma_PFieldInfoObject          = $0200;      { Pointer to IN-USE        }
  7589.                                               {   emphasis column.       }
  7590.  
  7591.   cma_TreeIcon                  = $0400;      { Icon for tree node       }
  7592.   cma_TreeBitmap                = $0800;      { bitmap for tree node     }
  7593.   cma_CxTreeIndent              = $1000;      { indent for children      }
  7594.   cma_CxTreeLine                = $2000;      { thickness of tree line   }
  7595.   cma_SlTreeBitmapOrIcon        = $4000;      { size of icon of tree node}
  7596.  
  7597.   cma_ItemOrder                 = $0001;      { QueryRecord search flags }
  7598.   cma_Window                    = $0002;
  7599.   cma_Workspace                 = $0004;
  7600.   cma_ZOrder                    = $0008;
  7601.  
  7602.   cma_DeltaTop                  = $0001;      { Industrial - top delta   }
  7603.   cma_DeltaBot                  = $0002;      { Industrial - bottom delta}
  7604.   cma_DeltaHome                 = $0004;      { Industrial - top of list }
  7605.   cma_DeltaEnd                  = $0008;      { Industrial - end of list }
  7606.  
  7607.   cma_NoReposition              = $0001;      { InvalidateRecord flags   }
  7608.   cma_Reposition                = $0002;
  7609.   cma_TextChanged               = $0004;
  7610.   cma_Erase                     = $0008;
  7611.  
  7612.   cma_Free                      = $0001;
  7613.   cma_Invalidate                = $0002;
  7614.   cma_Filter                    = $1000;      { Filtering through invalidation  }
  7615.  
  7616. {---------------[ S L I D E R ]---------------------------}
  7617.  
  7618. { Define messages for the slider control }
  7619.   slm_AddDetent                 = $0369;    { Add detent niche          }
  7620.   slm_QueryDetentPos            = $036A;    { Query position of detent  }
  7621.   slm_QueryScaleText            = $036B;    { Query text at tick number }
  7622.   slm_QuerySliderInfo           = $036C;    { Query slider information  }
  7623.   slm_QueryTickPos              = $036D;    { Query position of tick    }
  7624.   slm_QueryTickSize             = $036E;    { Query size of tick        }
  7625.   slm_RemoveDetent              = $036F;    { Remove detent niche       }
  7626.   slm_SetScaleText              = $0370;    { Set text above tick       }
  7627.   slm_SetSliderInfo             = $0371;    { Set slider parameters     }
  7628.   slm_SetTickSize               = $0372;    { Set size of tick          }
  7629.   sln_Change                    = 1;        { Slider position changed   }
  7630.   sln_SliderTrack               = 2;        { Slider dragged by user    }
  7631.   sln_SetFocus                  = 3;        { Slider gaining focus      }
  7632.   sln_KillFocus                 = 4;        { Slider losing focus       }
  7633.  
  7634. { Slider control data record }
  7635. type
  7636.   PSldCData = ^SldCData;
  7637.   SldCData = record
  7638.     cbSize:             ULong;     { Size of control block             }
  7639.     usScale1Increments: SmallWord; { # of divisions on scale           }
  7640.     usScale1Spacing:    SmallWord; { Space in pels between increments  }
  7641.     usScale2Increments: SmallWord; { # of divisions on scale           }
  7642.     usScale2Spacing:    SmallWord; { Space in pels between increments  }
  7643.   end;
  7644.  
  7645. { Slider control style flag definition }
  7646. const
  7647.   sls_Horizontal                = $00000000; { Orient slider horizontally}
  7648.   sls_Vertical                  = $00000001; { Orient slider vertically  }
  7649.   sls_Center                    = $00000000; { Center shaft in window    }
  7650.   sls_Bottom                    = $00000002; { Offset shaft to bottom (H)}
  7651.   sls_Top                       = $00000004; { Offset shaft to top (H)   }
  7652.   sls_Left                      = $00000002; { Offset shaft to left (V)  }
  7653.   sls_Right                     = $00000004; { Offset shaft to right (V) }
  7654.   sls_SnapToIncrement           = $00000008; { Snap to nearest increment }
  7655.   sls_ButtonsBottom             = $00000010; { Add buttons at shaft bot. }
  7656.   sls_ButtonStop                = $00000020; { Add buttons at shaft top  }
  7657.   sls_ButtonsLeft               = $00000010; { Add buttons left of shaft }
  7658.   sls_ButtonsRight              = $00000020; { Add buttons right of shaft}
  7659.   sls_OwnerDraw                 = $00000040; { Owner draw some fields    }
  7660.   sls_ReadOnly                  = $00000080; { Provide a read only slider}
  7661.   sls_RibbonStrip               = $00000100; { Provide a ribbon strip    }
  7662.   sls_HomeBottom                = $00000000; { Set home position at bot. }
  7663.   sls_HomeTop                   = $00000200; { Set home position at top  }
  7664.   sls_HomeLeft                  = $00000000; { Set home position at left }
  7665.   sls_HomeRight                 = $00000200; { Set home position at right}
  7666.   sls_PrimaryScale1             = $00000000; { Scale 1 is primary scale  }
  7667.   sls_PrimaryScale2             = $00000400; { Scale 2 is primary scale  }
  7668.  
  7669. { Message attributes for setting and querying slider components }
  7670.   sma_Scale1                    = $0001;
  7671.   sma_Scale2                    = $0002;
  7672.   sma_ShaftDimensions           = $0000;
  7673.   sma_ShaftPosition             = $0001;
  7674.   sma_SliderArmDimensions       = $0002;
  7675.   sma_SliderArmPosition         = $0003;
  7676.   sma_RangeValue                = $0000;
  7677.   sma_IncrementValue            = $0001;
  7678.   sma_SetAllTicks               = $FFFF;
  7679.  
  7680. { Ownerdraw flag definitions }
  7681.   sda_RibbonStrip               = $0001;
  7682.   sda_SliderShaft               = $0002;
  7683.   sda_Background                = $0003;
  7684.   sda_SliderArm                 = $0004;
  7685.  
  7686. { Error return codes }
  7687.   pmerr_Update_In_Progress      = $1F06;
  7688.   slderr_Invalid_Parameters     = -1;
  7689.  
  7690. {-------------[ C I R C U L A R   S L I D E R ]------------}
  7691.  
  7692. { Messages for the circular slider control }
  7693.   csm_QueryRange                = $053D;
  7694.   csm_SetRange                  = $053E;
  7695.   csm_QueryValue                = $053F;
  7696.   csm_SetValue                  = $0540;
  7697.   csm_QueryRadius               = $0541;
  7698.   csm_SetIncrement              = $0542;
  7699.   csm_QueryIncrement            = $0543;
  7700.   csm_SetBitMapData             = $0544;
  7701.   csn_SetFocus                  = $0548;
  7702.   csn_Changed                   = $0549;
  7703.   csn_Tracking                  = $054A;
  7704.   csn_QueryBackgroundColor      = $054B;
  7705.  
  7706.   css_NoButton                  = $0001;
  7707.   css_NoText                    = $0002;
  7708.   css_NoNumber                  = $0004;
  7709.   css_PointSelect               = $0008;
  7710.   css_360                       = $0010;
  7711.   css_MidPoint                  = $0020;
  7712.   css_ProportionalTicks         = $0040;
  7713.   css_NoTicks                   = $0080;
  7714.   css_CircularValue             = $0100;
  7715.  
  7716. type
  7717.   { Circular Slider structure }
  7718.   pcsBitMapData = ^csBitMapData;
  7719.   csBitMapData = Record
  7720.     hbmLeftUp    : hBitMap;
  7721.     hbmLeftDown  : hBitMap;
  7722.     hbmRightUp   : hBitMap;
  7723.     hbmRightDown : hBitMap;
  7724.   end;
  7725.  
  7726. {---------------[ V A L U E   S E T ]---------------------}
  7727.  
  7728. Const
  7729. { Define messages for the value set control }
  7730.   vm_QueryItem                  = $0375;    { Query item at location    }
  7731.   vm_QueryItemAttr              = $0376;    { Query item attributes     }
  7732.   vm_QueryMetrics               = $0377;    { Query metrics of control  }
  7733.   vm_QuerySelectEdItem          = $0378;    { Query selected item       }
  7734.   vm_SelectItem                 = $0379;    { Set selected item         }
  7735.   vm_SetItem                    = $037A;    { Set item at location      }
  7736.   vm_SetItemAttr                = $037B;    { Set item attributes       }
  7737.   vm_SetMetrics                 = $037C;    { Set metrics of control    }
  7738.  
  7739.   vn_Select                     = 120;      { Item selected by user     }
  7740.   vn_Enter                      = 121;      { Item entered by user      }
  7741.   vn_DragLeave                  = 122;      { Drag left control         }
  7742.   vn_DragOver                   = 123;      { Drag is over item         }
  7743.   vn_Drop                       = 124;      { Drop occurred on item     }
  7744.   vn_DropHelp                   = 125;      { Request help for drop     }
  7745.   vn_InitDrag                   = 126;      { Drag initiated on item    }
  7746.   vn_SetFocus                   = 127;      { Value set gaining focus   }
  7747.   vn_KillFocus                  = 128;      { Value set losing focus    }
  7748.   vn_Help                       = 129;      { Help requested by user    }
  7749.  
  7750. { Value set control data record }
  7751. type
  7752.   PVSCData = ^VSCData;
  7753.   VSCData = record
  7754.     cbSize:        ULong;          { Size of control block             }
  7755.     usRowCount:    SmallWord;      { Number of rows in value set       }
  7756.     usColumnCount: SmallWord;      { Number of columns in value set    }
  7757.   end;
  7758.  
  7759. { Value set drag initialization record }
  7760.  
  7761.   PVSDragInit = ^VSDragInit;
  7762.   VSDragInit = record
  7763.     hWnd:     HWnd;                { Window handle of value set control}
  7764.     x:        Long;                { X coordinate of pointer on desktop}
  7765.     y:        Long;                { Y coordinate of pointer on desktop}
  7766.     cx:       Long;                { X offset from pointer hot spot    }
  7767.     cy:       Long;                { Y offset from pointer hot spot    }
  7768.     usRow:    SmallWord;           { Number of rows in value set       }
  7769.     usColumn: SmallWord;           { Number of columns in value set    }
  7770.   end;
  7771.  
  7772. { Value set drag information record }
  7773.   PVSDragInfo = ^VSDragInfo;
  7774.   VSDragInfo = record
  7775.     PDragInfo: PDragInfo;          { Pointer to a drag info record     }
  7776.     usRow:     SmallWord;          { Number of rows in value set       }
  7777.     usColumn:  SmallWord;          { Number of columns in value set    }
  7778.   end;
  7779.  
  7780. { Value set query item text record }
  7781.  
  7782.   PVSText = ^VSText;
  7783.   VSText = record
  7784.     pszItemText: PChar;            { Pointer to string for item text      }
  7785.     ulBufLen:    ULong;            { Length of buffer to copy string into }
  7786.   end;
  7787.  
  7788. { Value set control style flag definition }
  7789. const
  7790.   vs_Bitmap                     = $0001;  { Default all items to bitmaps      }
  7791.   vs_Icon                       = $0002;  { Default all items to icons        }
  7792.   vs_Text                       = $0004;  { Default all items to text strings }
  7793.   vs_RGB                        = $0008;  { Default all items to color info   }
  7794.   vs_ColorIndex                 = $0010;  { Default all items to color indices}
  7795.   vs_Border                     = $0020;  { Add a border around the control   }
  7796.   vs_ItemBorder                 = $0040;  { Add a border around each item     }
  7797.   vs_ScaleBitmaps               = $0080;  { Scale bitmaps to cell size        }
  7798.   vs_RightToLeft                = $0100;  { Support right to left ordering    }
  7799.   vs_OwnerDraw                  = $0200;  { Owner draws value set background  }
  7800.  
  7801. { Value set item attribute definition }
  7802.   via_Bitmap                    = $0001; { If set, item contains a bitmap    }
  7803.   via_Icon                      = $0002; { If set, item contains an icon     }
  7804.   via_Text                      = $0004; { If set, item contains text string }
  7805.   via_RGB                       = $0008; { If set, item contains color value }
  7806.   via_ColorIndex                = $0010; { If set, item contains color index }
  7807.   via_OwnerDraw                 = $0020; { If set, item is ownerdraw         }
  7808.   via_Disabled                  = $0040; { If set, item is unselectable      }
  7809.   via_Draggable                 = $0080; { If set, item can be source of drag}
  7810.   via_Droponable                = $0100; { If set, item can be target of drop}
  7811.  
  7812. { Message parameter attributes for sizing and spacing of items }
  7813.   vma_ItemSize                  = $0001;
  7814.   vma_ItemSpacing               = $0002;
  7815.  
  7816. { Ownerdraw flag definitions }
  7817.   vda_Item                      = $0001;
  7818.   vda_ItemBackground            = $0002;
  7819.   vda_Surrounding               = $0003;
  7820.   vda_Background                = $0004;
  7821.  
  7822. { Error return codes }
  7823.   vserr_Invalid_Parameters      = -1;
  7824.  
  7825. {---------------[ N O T E B O O K ]-----------------------}
  7826.  
  7827. { Message ids }
  7828.   bkm_CalcPageRect              = $0353; { Calc book/page rectangle  }
  7829.   bkm_DeletePage                = $0354; { Delete page(s)            }
  7830.   bkm_InsertPage                = $0355; { Insert page               }
  7831.   bkm_InvalidateTabs            = $0356; { Invalidate tab area       }
  7832.   bkm_TurnToPage                = $0357; { Turn to page              }
  7833.   bkm_QueryPageCount            = $0358; { Query number of pages     }
  7834.   bkm_QueryPageId               = $0359; { Query page identifier     }
  7835.   bkm_QueryPageData             = $035A; { Query page user data      }
  7836.   bkm_QueryPageWindowHWnd       = $035B; { Query page window handle  }
  7837.   bkm_QueryTabBitmap            = $035C; { Query tab bitmap handle   }
  7838.   bkm_QueryTabText              = $035D; { Query tab text pointer    }
  7839.   bkm_SetDimensions             = $035E; { Set tab/dogear dimensions }
  7840.   bkm_SetPageData               = $035F; { Set page user data        }
  7841.   bkm_SetPageWindowHWnd         = $0360; { Set page window handle    }
  7842.   bkm_SetStatusLineText         = $0361; { Set status line text      }
  7843.   bkm_SetTabBitmap              = $0362; { Set tab bitmap            }
  7844.   bkm_SetTabText                = $0363; { Set tab text              }
  7845.   bkm_SetNotebookColors         = $0364; { Set Notebook colors       }
  7846.   bkm_QueryPageStyle            = $0365; { Query page style          }
  7847.   bkm_QueryStatusLineText       = $0366; { Query status line text    }
  7848.  
  7849.   bkn_PageSelected              = 130;   { New page selected by user }
  7850.   bkn_NewPageSize               = 131;   { App page size changed     }
  7851.   bkn_Help                      = 132;   { Help notification         }
  7852.   bkn_PageDeleted               = 133;   { Page deleted notification }
  7853.  
  7854. { Page deletion flags (usDeleteFlag) }
  7855.   bka_All                       = $0001; { all pages                 }
  7856.   bka_Single                    = $0002; { single page               }
  7857.   bka_Tab                       = $0004; { minor/major section       }
  7858.  
  7859. { Page insertion/query order (usPageOrder, usQueryOrder) }
  7860.   bka_Last                      = $0002; { Insert/Query last page    }
  7861.   bka_First                     = $0004; { Insert/Query first page   }
  7862.   bka_Next                      = $0008; { Insert/Query after page   }
  7863.   bka_Prev                      = $0010; { Insert/Query before page  }
  7864.   bka_Top                       = $0020; { Query topmost page        }
  7865.  
  7866. { Notebook region types (usBookRegion, usType) }
  7867.   bka_MajorTab                  = $0001; { Major Tab                 }
  7868.   bka_MinorTab                  = $0002; { Minor Tab                 }
  7869.   bka_PageButton                = $0100; { Page Turning Button       }
  7870.  
  7871. { Page insertion/query styles (usPageStyle,usQueryEnd) }
  7872.   bka_StatusTextOn              = $0001; { status area text          }
  7873.   bka_Major                     = $0040; { Major Tab                 }
  7874.   bka_Minor                     = $0080; { Minor Tab                 }
  7875.   bka_AutoPageSize              = $0100; { Page window position/size }
  7876.   bka_End                       = $0200; { Query to end of book      }
  7877.  
  7878. { Tab window contents (usTabDisplay) }
  7879.   bka_Text                      = $0400; { text data                 }
  7880.   bka_Bitmap                    = $0800; { bitmap                    }
  7881.  
  7882. { Notebook window styles (ulNotebookStyles) }
  7883.  
  7884.   bks_BackPageSbr               = $00000001; { Bottom right          }
  7885.   bks_BackPageSbl               = $00000002; { Bottom left           }
  7886.   bks_BackPageStr               = $00000004; { Top right             }
  7887.   bks_BackPageStl               = $00000008; { Top left              }
  7888.  
  7889. { Major Tab Side }
  7890.   bks_MajorTabRight             = $00000010; { Major tabs right      }
  7891.   bks_MajorTabLeft              = $00000020; { Major tabs left       }
  7892.   bks_MajorTabTop               = $00000040; { Major tabs top        }
  7893.   bks_MajorTabBottom            = $00000080; { Major tabs bottom     }
  7894.  
  7895. { Tab Type }
  7896.   bks_SquareTabs                = $00000000; { Square edged tabs     }
  7897.   bks_RoundedTabs               = $00000100; { Round edged tabs      }
  7898.   bks_PolygonTabs               = $00000200; { Polygon edged tabs    }
  7899.  
  7900. { Binding type }
  7901.   bks_SolidBind                 = $00000000; { Solid binding         }
  7902.   bks_SpiralBind                = $00000400; { Spiral binding        }
  7903.  
  7904. { Status line text justification }
  7905.   bks_StatusTextLeft            = $00000000; { Left justify text     }
  7906.   bks_StatusTextRight           = $00001000; { Right justify text    }
  7907.   bks_StatusTextCenter          = $00002000; { Center text           }
  7908.  
  7909. { Tab text justification }
  7910.   bks_TabTextLeft               = $00000000; { Left justify tab text }
  7911.   bks_TabTextRight              = $00004000; { Right justify tab text}
  7912.   bks_TabTextCenter             = $00008000; { Center tab text       }
  7913.  
  7914. { Notebook color presentation param attributes }
  7915.   bka_BackgroundPageColorIndex  = $0001; { Page Background       }
  7916.   bka_BackgroundPageColor       = $0002;
  7917.   bka_BackgroundMajorColorIndex = $0003; { Major Tab Background  }
  7918.   bka_BackgroundMajorColor      = $0004;
  7919.   bka_BackgroundMinorColorIndex = $0005; { Minor Tab Background  }
  7920.   bka_BackgroundMinorColor      = $0006;
  7921.   bka_ForegroundMajorColorIndex = $0007; { Major Tab Text        }
  7922.   bka_ForegroundMajorColor      = $0008;
  7923.   bka_ForegroundMinorColorIndex = $0009; { Minor Tab Text        }
  7924.   bka_ForegroundMinorColor      = $000A;
  7925.  
  7926. { Error message ids }
  7927.   bookerr_Invalid_Parameters    = -1;   { Invalid parameters     }
  7928.  
  7929. { BKM_SETPAGINFO flags for bSetPageInfoFlags. }
  7930.   bfa_PageData                  = $00000001; // Set page data
  7931.   bfa_PageFromHWnd              = $00000002; // Set page window hwnd
  7932.   bfa_PageFromDlgTemplate       = $00000004; // Set page window hwnd
  7933.   // from dialog template
  7934.   bfa_PageFromDlgRes            = $00000008; // Set page window hwnd
  7935.   // from dialog resource
  7936.   bfa_StatusLine                = $00000010; // Set status text
  7937.   bfa_MajorTabBitmap            = $00000020; // Set major tab bitmap
  7938.   bfa_MinorTabBitmap            = $00000040; // Set minor tab bitmap
  7939.   bfa_MajorTabtext              = $00000080; // Set major tab text
  7940.   bfa_MinorTabtext              = $00000100; // Set minor tab text
  7941.   bfa_BidiInfo                  = $00000200; // Reserved: bidirectional languages support
  7942.  
  7943. type
  7944. { bkm_SetPagInfo message structure }
  7945.   pBookPageInfo = ^BookPageInfo;
  7946.   BookPageInfo = record
  7947.     cb:                   ULong;        { Page flags - BFA_         }
  7948.     fl:                   ULong;        { Page flags - BFA_         }
  7949.     bLoadDlg:             Bool;         { TRUE: Load dialog now     }
  7950.                                         { FALSE: Load dialog on turn}
  7951.     ulPageData:           ULong;        { data to associate w/page  }
  7952.     hwndPage:             HWnd;         { hwnd to associate w/ page }
  7953.     pfnPageDlgProc:       pFn;          { auto load of dialogs for  }
  7954.     idPageDlg:            ULong;        { the application.          }
  7955.     hmodPageDlg:          hModule;      { Resource info used for    }
  7956.     pPageDlgCreateParams: Pointer;
  7957.     pdlgtPage:            pDlgTemplate;
  7958.     cbStatusLine:         ULong;        { Page flags - BFA_         }
  7959.     pszStatusLine:        PChar;        { Status line text string   }
  7960.     hbmMajorTab:          hBitmap;      { Major tab bitmap handle   }
  7961.     hbmMinorTab:          hBitmap;      { Minor tab bitmap handle   }
  7962.     cbMajorTab:           ULong;        { Page flags - BFA_         }
  7963.     pszMajorTab:          PChar;        { Major tab text string     }
  7964.     cbMinorTab:           ULong;        { Page flags - BFA_         }
  7965.     pszMinorTab:          PChar;        { Minor tab text string     }
  7966.     pBidiInfo:            Pointer;      { Reserved: Bidirectional support }
  7967.   end;
  7968.  
  7969. { bkm_QueryTabText and bkm_QueryStatusLineText message record }
  7970.   PBookText = ^BookText;
  7971.   BookText = record
  7972.     pString: PChar;                     { ptr to string buffer      }
  7973.     textLen: ULong;                     { length of string to query }
  7974.   end;
  7975.  
  7976. { bkn_PageDeleted notify message record }
  7977.  
  7978.   PDeleteNotify = ^DeleteNotify;
  7979.   DeleteNotify = record
  7980.     hWndBook:      HWnd;                { Notebook window handle    }
  7981.     hWndPage:      HWnd;                { App. page window handle   }
  7982.     ulAppPageData: ULong;               { App. page data            }
  7983.     hbmTab:        HBitMap;             { App. tab bitmap handle    }
  7984.   end;
  7985.  
  7986. { bkn_PageSelected notify message record }
  7987.  
  7988.   PPageSelectNotify = ^PageSelectNotify;
  7989.   PageSelectNotify = record
  7990.     hWndBook:    HWnd;                  { Notebook window handle    }
  7991.     ulPageIdCur: ULong;                 { Previous top page id      }
  7992.     ulPageIdNew: ULong;                 { New top Page id           }
  7993.   end;
  7994.  
  7995. {----[ PMAVIO]----}
  7996.  
  7997. type
  7998.   HVPS = SmallWord;
  7999.   PHVPS = ^HVPS;
  8000.  
  8001. {$Far16+}
  8002.  
  8003. function VioAssociate(DC: HDC; VPS: HVPS): SmallWord;
  8004. function VioCreateLogFont(var fatattrs: FAttrs; llcid: Long; Name: PStr8; VPS: HVPS): SmallWord;
  8005. function VioCreatePS(var VPS: HVPS; Depth,Width,Format,Attrs: SmallWord; Reserved: HVPS): SmallWord;
  8006. function VioDeleteSetId(llcid: Long; VPS: HVPS): SmallWord;
  8007. function VioDestroyPS(VPS: HVPS): SmallWord;
  8008. function VioGetDeviceCellSize(var Height,Width: SmallWord; VPS: HVPS): SmallWord;
  8009. function VioGetOrg(var Row,Column: SmallWord; VPS: HVPS): SmallWord;
  8010. function VioQueryFonts(var Remfonts: Long; var fmMetrics: FontMetrics; lMetricsLength: LONG; var Fonts: Long; Facename: PChar; flOptions: ULong; VPS: HVPS): SmallWord;
  8011. function VioQuerySetIds(var allcids: Long; Names: PStr8; var alTypes: Long; count: Long; VPS: HVPS): SmallWord;
  8012. function VioSetDeviceCellSize(Height,Width: SmallWord; VPS: HVPS): SmallWord;
  8013. function VioSetOrg(Row,Column: SmallWord; VPS: HVPS): SmallWord;
  8014. function VioShowPS(Depth,Width,offCell: SmallWord; VPS: HVPS): SmallWord;
  8015.  
  8016. { WinDefAVioWindowProc -- Default message processing for AVio PS's }
  8017.  
  8018. function WinDefAVioWindowProc(WND: HWnd; Msg: SmallWord; Mp1,Mp2: ULong): MResult;
  8019.  
  8020. {$Cdecl+}
  8021.  
  8022. {----[ PMERR ]----}
  8023.  
  8024. { Window Manager error codes }
  8025. const
  8026.   pmerr_Invalid_HWnd            = $1001;
  8027.   pmerr_Invalid_Hmq             = $1002;
  8028.   pmerr_Parameter_Out_Of_Range  = $1003;
  8029.   pmerr_Window_Lock_Underflow   = $1004;
  8030.   pmerr_Window_Lock_Overflow    = $1005;
  8031.   pmerr_Bad_Window_Lock_Count   = $1006;
  8032.   pmerr_Window_Not_Locked       = $1007;
  8033.   pmerr_Invalid_Selector        = $1008;
  8034.   pmerr_Call_From_Wrong_Thread  = $1009;
  8035.   pmerr_Resource_Not_Found      = $100A;
  8036.   pmerr_Invalid_String_Parm     = $100B;
  8037.   pmerr_Invalid_HHeap           = $100C;
  8038.   pmerr_Invalid_Heap_Pointer    = $100D;
  8039.   pmerr_Invalid_Heap_Size_Parm  = $100E;
  8040.   pmerr_Invalid_Heap_Size       = $100F;
  8041.   pmerr_Invalid_Heap_Size_Word  = $1010;
  8042.   pmerr_Heap_Out_Of_Memory      = $1011;
  8043.   pmerr_Heap_Max_Size_Reached   = $1012;
  8044.   pmerr_Invalid_HAtomTbl        = $1013;
  8045.   pmerr_Invalid_Atom            = $1014;
  8046.   pmerr_Invalid_Atom_Name       = $1015;
  8047.   pmerr_Invalid_Integer_Atom    = $1016;
  8048.   pmerr_Atom_Name_Not_Found     = $1017;
  8049.   pmerr_Queue_Too_Large         = $1018;
  8050.   pmerr_Invalid_Flag            = $1019;
  8051.   pmerr_Invalid_HAccel          = $101A;
  8052.   pmerr_Invalid_HPtr            = $101B;
  8053.   pmerr_Invalid_HEnum           = $101C;
  8054.   pmerr_Invalid_Src_CodePage    = $101D;
  8055.   pmerr_Invalid_Dst_CodePage    = $101E;
  8056.  
  8057. { These are not real error codes, but just used to access special  }
  8058. { error message strings used by WinGetErrorInfo to format an error }
  8059. { message.                                                         }
  8060.  
  8061.   pmerr_Unknown_Component_Id    = $101f;
  8062.   pmerr_Unknown_Error_Code      = $1020;
  8063.   pmerr_Severity_Levels         = $1021;
  8064.  
  8065. { $1022 - $1033, $1035, $104B - $104C used elsewhere }
  8066.   pmerr_Invalid_Resource_Format = $1034;
  8067.   pmerr_No_Msg_Queue            = $1036;
  8068.   pmerr_Win_Debugmsg            = $1037;
  8069.   pmerr_Queue_Full              = $1038;
  8070.  
  8071.   pmerr_Library_Load_Failed     = $1039;
  8072.   pmerr_Procedure_Load_Failed   = $103A;
  8073.   pmerr_Library_Delete_Failed   = $103B;
  8074.   pmerr_Procedure_Delete_Failed = $103C;
  8075.   pmerr_Array_Too_Large         = $103D;
  8076.   pmerr_Array_Too_Small         = $103E;
  8077.   pmerr_Datatype_Entry_Bad_Index = $103F;
  8078.   pmerr_Datatype_Entry_Ctl_Bad  = $1040;
  8079.   pmerr_Datatype_Entry_Ctl_Miss = $1041;
  8080.   pmerr_Datatype_Entry_Invalid  = $1042;
  8081.   pmerr_Datatype_Entry_Not_Num  = $1043;
  8082.   pmerr_Datatype_Entry_Not_Off  = $1044;
  8083.   pmerr_Datatype_Invalid        = $1045;
  8084.   pmerr_Datatype_Not_Unique     = $1046;
  8085.   pmerr_Datatype_Too_Long       = $1047;
  8086.   pmerr_Datatype_Too_Small      = $1048;
  8087.   pmerr_Direction_Invalid       = $1049;
  8088.   pmerr_Invalid_Hab             = $104A;
  8089.   pmerr_Invalid_Hstruct         = $104D;
  8090.   pmerr_Length_Too_Small        = $104E;
  8091.   pmerr_Msgid_Too_Small         = $104F;
  8092.   pmerr_No_Handle_Alloc         = $1050;
  8093.   pmerr_Not_In_A_Pm_Session     = $1051;
  8094.   pmerr_Msg_Queue_Already_Exists = $1052;
  8095.   pmerr_Old_Resource            = $1055;
  8096.  
  8097. { SOM error codes }
  8098.   pmerr_WPDServer_is_active     = $1056;
  8099.   pmerr_WPDServer_not_started   = $1057;
  8100.   pmerr_SOMDD_is_active         = $1058;
  8101.   pmerr_SOMDD_not_started       = $1059;
  8102.  
  8103. { Window Manager error codes }
  8104.   pmerr_Invalid_Pib             = $1101;
  8105.   pmerr_Insuff_Space_To_Add     = $1102;
  8106.   pmerr_Invalid_Group_Handle    = $1103;
  8107.   pmerr_Duplicate_Title         = $1104;
  8108.   pmerr_Invalid_Title           = $1105;
  8109.   pmerr_Handle_Not_In_Group     = $1107;
  8110.   pmerr_Invalid_Target_Handle   = $1106;
  8111.   pmerr_Invalid_Path_Statement  = $1108;
  8112.   pmerr_No_Program_Found        = $1109;
  8113.   pmerr_Invalid_Buffer_Size     = $110A;
  8114.   pmerr_Buffer_Too_Small        = $110B;
  8115.   pmerr_Pl_Initialisation_Fail  = $110C;
  8116.   pmerr_Cant_Destroy_Sys_Group  = $110D;
  8117.   pmerr_Invalid_Type_Change     = $110E;
  8118.   pmerr_Invalid_Program_Handle  = $110F;
  8119.  
  8120.   pmerr_Not_Current_Pl_Version  = $1110;
  8121.   pmerr_Invalid_Circular_Ref    = $1111;
  8122.   pmerr_Memory_Allocation_Err   = $1112;
  8123.   pmerr_Memory_Deallocation_Err = $1113;
  8124.   pmerr_Task_Header_Too_Big     = $1114;
  8125.  
  8126.   pmerr_Invalid_Ini_File_Handle = $1115;
  8127.   pmerr_Memory_Share            = $1116;
  8128.   pmerr_Open_Queue              = $1117;
  8129.   pmerr_Create_Queue            = $1118;
  8130.   pmerr_Write_Queue             = $1119;
  8131.   pmerr_Read_Queue              = $111A;
  8132.   pmerr_Call_Not_Executed       = $111B;
  8133.   pmerr_Unknown_Apipkt          = $111C;
  8134.   pmerr_Inithread_Exists        = $111D;
  8135.   pmerr_Create_Thread           = $111E;
  8136.   pmerr_No_Hk_Profile_Installed = $111F;
  8137.   pmerr_Invalid_Directory       = $1120;
  8138.   pmerr_Wildcard_In_Filename    = $1121;
  8139.   pmerr_Filename_Buffer_Full    = $1122;
  8140.   pmerr_Filename_Too_Long       = $1123;
  8141.   pmerr_Ini_File_Is_Sys_Or_User = $1124;
  8142.   pmerr_Broadcast_Plmsg         = $1125;
  8143.   pmerr_190_Init_Done           = $1126;
  8144.   pmerr_Hmod_For_Pmshapi        = $1127;
  8145.   pmerr_Set_Hk_Profile          = $1128;
  8146.   pmerr_Api_Not_Allowed         = $1129;
  8147.   pmerr_Ini_Still_Open          = $112A;
  8148.  
  8149.   pmerr_Progdetails_Not_In_Ini  = $112B;
  8150.   pmerr_Pibstruct_Not_In_Ini    = $112C;
  8151.   pmerr_Invalid_Diskprogdetails = $112D;
  8152.   pmerr_Progdetails_Read_Failure  = $112E;
  8153.   pmerr_Progdetails_Write_Failure = $112F;
  8154.   pmerr_Progdetails_Qsize_Failure = $1130;
  8155.   pmerr_Invalid_Progdetails     = $1131;
  8156.   pmerr_Sheprofilehook_Not_Found = $1132;
  8157.   pmerr_190plconverted          = $1133;
  8158.   pmerr_Failed_To_Convert_Ini_Pl = $1134;
  8159.   pmerr_Pmshapi_Not_Initialised = $1135;
  8160.   pmerr_Invalid_Shell_Api_Hook_Id = $1136;
  8161.  
  8162.   pmerr_Dos_Error               = $1200;
  8163.  
  8164.   pmerr_No_Space                = $1201;
  8165.   pmerr_Invalid_Switch_Handle   = $1202;
  8166.   pmerr_No_Handle               = $1203;
  8167.   pmerr_Invalid_Process_Id      = $1204;
  8168.   pmerr_Not_Shell               = $1205;
  8169.   pmerr_Invalid_Window          = $1206;
  8170.   pmerr_Invalid_Post_Msg        = $1207;
  8171.   pmerr_Invalid_Parameters      = $1208;
  8172.   pmerr_Invalid_Program_Type    = $1209;
  8173.   pmerr_Not_Extended_Focus      = $120A;
  8174.   pmerr_Invalid_Session_Id      = $120B;
  8175.   pmerr_Smg_Invalid_Icon_File   = $120C;
  8176.   pmerr_Smg_Icon_Not_Created    = $120D;
  8177.   pmerr_Shl_Debug               = $120E;
  8178.  
  8179.   pmerr_Opening_Ini_File        = $1301;
  8180.   pmerr_Ini_File_Corrupt        = $1302;
  8181.   pmerr_Invalid_Parm            = $1303;
  8182.   pmerr_Not_In_Idx              = $1304;
  8183.   pmerr_No_Entries_In_Group     = $1305;
  8184.  
  8185.   pmerr_Ini_Write_Fail          = $1306;
  8186.   pmerr_Idx_Full                = $1307;
  8187.   pmerr_Ini_Protected           = $1308;
  8188.   pmerr_Memory_Alloc            = $1309;
  8189.   pmerr_Ini_Init_Already_Done   = $130A;
  8190.   pmerr_Invalid_Integer         = $130B;
  8191.   pmerr_Invalid_Asciiz          = $130C;
  8192.   pmerr_Can_Not_Call_Spooler    = $130D;
  8193.   pmerr_Validation_Rejected     = pmerr_Can_Not_Call_Spooler;
  8194.  
  8195.   pmerr_Warning_Window_Not_Killed = $1401;
  8196.   pmerr_Error_Invalid_Window    = $1402;
  8197.   pmerr_Already_Initialized     = $1403;
  8198.   pmerr_Msg_Prog_No_Mou         = $1405;
  8199.   pmerr_Msg_Prog_Non_Recov      = $1406;
  8200.   pmerr_Winconv_Invalid_Path    = $1407;
  8201.   pmerr_Pi_Not_Initialised      = $1408;
  8202.   pmerr_Pl_Not_Initialised      = $1409;
  8203.   pmerr_No_Task_Manager         = $140A;
  8204.   pmerr_Save_Not_In_Progress    = $140B;
  8205.   pmerr_No_Stack_Space          = $140C;
  8206.   pmerr_Invalid_Colr_Field      = $140d;
  8207.   pmerr_Invalid_Colr_Value      = $140e;
  8208.   pmerr_Colr_Write              = $140f;
  8209.  
  8210.   pmerr_Target_File_Exists      = $1501;
  8211.   pmerr_Source_Same_As_Target   = $1502;
  8212.   pmerr_Source_File_Not_Found   = $1503;
  8213.   pmerr_Invalid_New_Path        = $1504;
  8214.   pmerr_Target_File_Not_Found   = $1505;
  8215.   pmerr_Invalid_Drive_Number    = $1506;
  8216.   pmerr_Name_Too_Long           = $1507;
  8217.   pmerr_Not_Enough_Room_On_Disk = $1508;
  8218.   pmerr_Not_Enough_Mem          = $1509;
  8219.  
  8220.   pmerr_Log_Drv_Does_Not_Exist  = $150B;
  8221.   pmerr_Invalid_Drive           = $150C;
  8222.   pmerr_Access_Denied           = $150D;
  8223.   pmerr_No_First_Slash          = $150E;
  8224.   pmerr_Read_Only_File          = $150F;
  8225.   pmerr_Group_Protected         = $151F;
  8226.   pmerr_Invalid_Program_Category = $152F;
  8227.   pmerr_Invalid_Appl            = $1530;
  8228.   pmerr_Cannot_Start            = $1531;
  8229.   pmerr_Started_In_Background   = $1532;
  8230.   pmerr_Invalid_Happ            = $1533;
  8231.   pmerr_Cannot_Stop             = $1534;
  8232.  
  8233. { Errors generated by Language Bindings layer    }
  8234. { (Range $1600 thru $16FF reserved for Bindings) }
  8235. { severity_Unrecoverable }
  8236.   pmerr_Internal_Error_1        = $1601;
  8237.   pmerr_Internal_Error_2        = $1602;
  8238.   pmerr_Internal_Error_3        = $1603;
  8239.   pmerr_Internal_Error_4        = $1604;
  8240.   pmerr_Internal_Error_5        = $1605;
  8241.   pmerr_Internal_Error_6        = $1606;
  8242.   pmerr_Internal_Error_7        = $1607;
  8243.   pmerr_Internal_Error_8        = $1608;
  8244.   pmerr_Internal_Error_9        = $1609;
  8245.   pmerr_Internal_Error_10       = $160A;
  8246.   pmerr_Internal_Error_11       = $160B;
  8247.   pmerr_Internal_Error_12       = $160C;
  8248.   pmerr_Internal_Error_13       = $160D;
  8249.   pmerr_Internal_Error_14       = $160E;
  8250.   pmerr_Internal_Error_15       = $160F;
  8251.   pmerr_Internal_Error_16       = $1610;
  8252.   pmerr_Internal_Error_17       = $1611;
  8253.   pmerr_Internal_Error_18       = $1612;
  8254.   pmerr_Internal_Error_19       = $1613;
  8255.   pmerr_Internal_Error_20       = $1614;
  8256.   pmerr_Internal_Error_21       = $1615;
  8257.   pmerr_Internal_Error_22       = $1616;
  8258.   pmerr_Internal_Error_23       = $1617;
  8259.   pmerr_Internal_Error_24       = $1618;
  8260.   pmerr_Internal_Error_25       = $1619;
  8261.   pmerr_Internal_Error_26       = $161A;
  8262.   pmerr_Internal_Error_27       = $161B;
  8263.   pmerr_Internal_Error_28       = $161C;
  8264.   pmerr_Internal_Error_29       = $161D;
  8265.  
  8266. { severity_Warning }
  8267.   pmerr_Invalid_Free_Message_Id = $1630;
  8268.  
  8269. { severity_Error }
  8270.  
  8271.   pmerr_Function_Not_Supported  = $1641;
  8272.   pmerr_Invalid_Array_Count     = $1642;
  8273.   pmerr_Invalid_Length          = $1643;
  8274.   pmerr_Invalid_Bundle_Type     = $1644;
  8275.   pmerr_Invalid_Parameter       = $1645;
  8276.   pmerr_Invalid_Number_Of_Parms = $1646;
  8277.   pmerr_Greater_Than_64k        = $1647;
  8278.   pmerr_Invalid_Parameter_Type  = $1648;
  8279.   pmerr_Negative_Strcond_Dim    = $1649;
  8280.   pmerr_Invalid_Number_Of_Types = $164A;
  8281.   pmerr_Incorrect_Hstruct       = $164B;
  8282.   pmerr_Invalid_Array_Size      = $164C;
  8283.   pmerr_Invalid_Control_Datatype = $164D;
  8284.   pmerr_Incomplete_Control_Sequ = $164E;
  8285.   pmerr_Invalid_Datatype        = $164F;
  8286.   pmerr_Incorrect_Datatype      = $1650;
  8287.   pmerr_Not_Self_Describing_Dtyp = $1651;
  8288.   pmerr_Invalid_Ctrl_Seq_Index  = $1652;
  8289.   pmerr_Invalid_Type_For_Length = $1653;
  8290.   pmerr_Invalid_Type_For_Offset = $1654;
  8291.   pmerr_Invalid_Type_For_Mparam = $1655;
  8292.   pmerr_Invalid_Message_Id      = $1656;
  8293.   pmerr_C_Length_Too_Small      = $1657;
  8294.   pmerr_Appl_Structure_Too_Small = $1658;
  8295.   pmerr_Invalid_Errorinfo_Handle = $1659;
  8296.   pmerr_Invalid_Character_Index = $165A;
  8297.  
  8298. { Workplace Shell error codes }
  8299.   wperr_Protected_Class         = $1700;
  8300.   wperr_Invalid_Class           = $1701;
  8301.   wperr_Invalid_Superclass      = $1702;
  8302.   wperr_No_Memory               = $1703;
  8303.   wperr_Semaphore_Error         = $1704;
  8304.   wperr_Buffer_Too_Small        = $1705;
  8305.   wperr_Clsloadmod_Failed       = $1706;
  8306.   wperr_Clsprocaddr_Failed      = $1707;
  8307.   wperr_Objword_Location        = $1708;
  8308.   wperr_Invalid_Object          = $1709;
  8309.   wperr_Memory_Cleanup          = $170A;
  8310.   wperr_Invalid_Module          = $170B;
  8311.   wperr_Invalid_Oldclass        = $170C;
  8312.   wperr_Invalid_Newclass        = $170D;
  8313.   wperr_Not_Immediate_Child     = $170E;
  8314.   wperr_Not_Workplace_Class     = $170F;
  8315.   wperr_Cant_Replace_Metacls    = $1710;
  8316.   wperr_Ini_File_Write          = $1711;
  8317.   wperr_Invalid_Folder          = $1712;
  8318.   wperr_Buffer_Overflow         = $1713;
  8319.   wperr_Object_Not_Found        = $1714;
  8320.   wperr_Invalid_Hfind           = $1715;
  8321.   wperr_Invalid_Count           = $1716;
  8322.   wperr_Invalid_Buffer          = $1717;
  8323.   wperr_Already_Exists          = $1718;
  8324.   wperr_Invalid_Flags           = $1719;
  8325.   wperr_Invalid_Objectid        = $1720;
  8326.  
  8327. { GPI error codes }
  8328.   pmerr_Ok                      = $0000;
  8329.   pmerr_Already_In_Area         = $2001;
  8330.   pmerr_Already_In_Element      = $2002;
  8331.   pmerr_Already_In_Path         = $2003;
  8332.   pmerr_Already_In_Seg          = $2004;
  8333.   pmerr_Area_Incomplete         = $2005;
  8334.   pmerr_Base_Error              = $2006;
  8335.   pmerr_Bitblt_Length_Exceeded  = $2007;
  8336.   pmerr_Bitmap_In_Use           = $2008;
  8337.   pmerr_Bitmap_Is_Selected      = $2009;
  8338.   pmerr_Bitmap_Not_Found        = $200A;
  8339.   pmerr_Bitmap_Not_Selected     = $200B;
  8340.   pmerr_Bounds_Overflow         = $200C;
  8341.   pmerr_Called_Seg_Is_Chained   = $200D;
  8342.   pmerr_Called_Seg_Is_Current   = $200E;
  8343.   pmerr_Called_Seg_Not_Found    = $200F;
  8344.   pmerr_Cannot_Delete_All_Data  = $2010;
  8345.   pmerr_Cannot_Replace_Element_0 = $2011;
  8346.   pmerr_Col_Table_Not_Realizable = $2012;
  8347.   pmerr_Col_Table_Not_Realized  = $2013;
  8348.   pmerr_Coordinate_Overflow     = $2014;
  8349.   pmerr_Corr_Format_Mismatch    = $2015;
  8350.   pmerr_Data_Too_Long           = $2016;
  8351.   pmerr_Dc_Is_Associated        = $2017;
  8352.   pmerr_Desc_String_Truncated   = $2018;
  8353.   pmerr_Device_Driver_Error_1   = $2019;
  8354.   pmerr_Device_Driver_Error_2   = $201A;
  8355.   pmerr_Device_Driver_Error_3   = $201B;
  8356.   pmerr_Device_Driver_Error_4   = $201C;
  8357.   pmerr_Device_Driver_Error_5   = $201D;
  8358.   pmerr_Device_Driver_Error_6   = $201E;
  8359.   pmerr_Device_Driver_Error_7   = $201F;
  8360.   pmerr_Device_Driver_Error_8   = $2020;
  8361.   pmerr_Device_Driver_Error_9   = $2021;
  8362.   pmerr_Device_Driver_Error_10  = $2022;
  8363.   pmerr_Dev_Func_Not_Installed  = $2023;
  8364.   pmerr_Dosopen_Failure         = $2024;
  8365.   pmerr_Dosread_Failure         = $2025;
  8366.   pmerr_Driver_Not_Found        = $2026;
  8367.   pmerr_Dup_Seg                 = $2027;
  8368.   pmerr_Dynamic_Seg_Seq_Error   = $2028;
  8369.   pmerr_Dynamic_Seg_Zero_Inv    = $2029;
  8370.   pmerr_Element_Incomplete      = $202A;
  8371.   pmerr_Esc_Code_Not_Supported  = $202B;
  8372.   pmerr_Exceeds_Max_Seg_Length  = $202C;
  8373.   pmerr_Font_And_Mode_Mismatch  = $202D;
  8374.   pmerr_Font_File_Not_Loaded    = $202E;
  8375.   pmerr_Font_Not_Loaded         = $202F;
  8376.   pmerr_Font_Too_Big            = $2030;
  8377.   pmerr_Hardware_Init_Failure   = $2031;
  8378.   pmerr_Hbitmap_Busy            = $2032;
  8379.   pmerr_Hdc_Busy                = $2033;
  8380.   pmerr_Hrgn_Busy               = $2034;
  8381.   pmerr_Huge_Fonts_Not_Supported = $2035;
  8382.   pmerr_Id_Has_No_Bitmap        = $2036;
  8383.   pmerr_Image_Incomplete        = $2037;
  8384.   pmerr_Incompat_Color_Format   = $2038;
  8385.   pmerr_Incompat_Color_Options  = $2039;
  8386.   pmerr_Incompatible_Bitmap     = $203A;
  8387.   pmerr_Incompatible_Metafile   = $203B;
  8388.   pmerr_Incorrect_Dc_Type       = $203C;
  8389.   pmerr_Insufficient_Disk_Space = $203D;
  8390.   pmerr_Insufficient_Memory     = $203E;
  8391.   pmerr_Inv_Angle_Parm          = $203F;
  8392.   pmerr_Inv_Arc_Control         = $2040;
  8393.   pmerr_Inv_Area_Control        = $2041;
  8394.   pmerr_Inv_Arc_Points          = $2042;
  8395.   pmerr_Inv_Attr_Mode           = $2043;
  8396.   pmerr_Inv_Background_Col_Attr = $2044;
  8397.   pmerr_Inv_Background_Mix_Attr = $2045;
  8398.   pmerr_Inv_Bitblt_Mix          = $2046;
  8399.   pmerr_Inv_Bitblt_Style        = $2047;
  8400.   pmerr_Inv_Bitmap_Dimension    = $2048;
  8401.   pmerr_Inv_Box_Control         = $2049;
  8402.   pmerr_Inv_Box_Rounding_Parm   = $204A;
  8403.   pmerr_Inv_Char_Angle_Attr     = $204B;
  8404.   pmerr_Inv_Char_Direction_Attr = $204C;
  8405.   pmerr_Inv_Char_Mode_Attr      = $204D;
  8406.   pmerr_Inv_Char_Pos_Options    = $204E;
  8407.   pmerr_Inv_Char_Set_Attr       = $204F;
  8408.   pmerr_Inv_Char_Shear_Attr     = $2050;
  8409.   pmerr_Inv_Clip_Path_Options   = $2051;
  8410.   pmerr_Inv_Codepage            = $2052;
  8411.   pmerr_Inv_Color_Attr          = $2053;
  8412.   pmerr_Inv_Color_Data          = $2054;
  8413.   pmerr_Inv_Color_Format        = $2055;
  8414.   pmerr_Inv_Color_Index         = $2056;
  8415.   pmerr_Inv_Color_Options       = $2057;
  8416.   pmerr_Inv_Color_Start_Index   = $2058;
  8417.   pmerr_Inv_Coord_Offset        = $2059;
  8418.   pmerr_Inv_Coord_Space         = $205A;
  8419.   pmerr_Inv_Coordinate          = $205B;
  8420.   pmerr_Inv_Correlate_Depth     = $205C;
  8421.   pmerr_Inv_Correlate_Type      = $205D;
  8422.   pmerr_Inv_Cursor_Bitmap       = $205E;
  8423.   pmerr_Inv_Dc_Data             = $205F;
  8424.   pmerr_Inv_Dc_Type             = $2060;
  8425.   pmerr_Inv_Device_Name         = $2061;
  8426.   pmerr_Inv_Dev_Modes_Options   = $2062;
  8427.   pmerr_Inv_Draw_Control        = $2063;
  8428.   pmerr_Inv_Draw_Value          = $2064;
  8429.   pmerr_Inv_Drawing_Mode        = $2065;
  8430.   pmerr_Inv_Driver_Data         = $2066;
  8431.   pmerr_Inv_Driver_Name         = $2067;
  8432.   pmerr_Inv_Draw_Border_Option  = $2068;
  8433.   pmerr_Inv_Edit_Mode           = $2069;
  8434.   pmerr_Inv_Element_Offset      = $206A;
  8435.   pmerr_Inv_Element_Pointer     = $206B;
  8436.   pmerr_Inv_End_Path_Options    = $206C;
  8437.   pmerr_Inv_Esc_Code            = $206D;
  8438.   pmerr_Inv_Escape_Data         = $206E;
  8439.   pmerr_Inv_Extended_Lcid       = $206F;
  8440.   pmerr_Inv_Fill_Path_Options   = $2070;
  8441.   pmerr_Inv_First_Char          = $2071;
  8442.   pmerr_Inv_Font_Attrs          = $2072;
  8443.   pmerr_Inv_Font_File_Data      = $2073;
  8444.   pmerr_Inv_For_This_Dc_Type    = $2074;
  8445.   pmerr_Inv_Format_Control      = $2075;
  8446.   pmerr_Inv_Forms_Code          = $2076;
  8447.   pmerr_Inv_Fontdef             = $2077;
  8448.   pmerr_Inv_Geom_Line_Width_Attr = $2078;
  8449.   pmerr_Inv_Getdata_Control     = $2079;
  8450.   pmerr_Inv_Graphics_Field      = $207A;
  8451.   pmerr_Inv_Hbitmap             = $207B;
  8452.   pmerr_Inv_Hdc                 = $207C;
  8453.   pmerr_Inv_Hjournal            = $207D;
  8454.   pmerr_Inv_Hmf                 = $207E;
  8455.   pmerr_Inv_Hps                 = $207F;
  8456.   pmerr_Inv_Hrgn                = $2080;
  8457.   pmerr_Inv_Id                  = $2081;
  8458.   pmerr_Inv_Image_Data_Length   = $2082;
  8459.   pmerr_Inv_Image_Dimension     = $2083;
  8460.   pmerr_Inv_Image_Format        = $2084;
  8461.   pmerr_Inv_In_Area             = $2085;
  8462.   pmerr_Inv_In_Called_Seg       = $2086;
  8463.   pmerr_Inv_In_Current_Edit_Mode = $2087;
  8464.   pmerr_Inv_In_Draw_Mode        = $2088;
  8465.   pmerr_Inv_In_Element          = $2089;
  8466.   pmerr_Inv_In_Image            = $208A;
  8467.   pmerr_Inv_In_Path             = $208B;
  8468.   pmerr_Inv_In_Retain_Mode      = $208C;
  8469.   pmerr_Inv_In_Seg              = $208D;
  8470.   pmerr_Inv_In_Vector_Symbol    = $208E;
  8471.   pmerr_Inv_Info_Table          = $208F;
  8472.   pmerr_Inv_Journal_Option      = $2090;
  8473.   pmerr_Inv_Kerning_Flags       = $2091;
  8474.   pmerr_Inv_Length_Or_Count     = $2092;
  8475.   pmerr_Inv_Line_End_Attr       = $2093;
  8476.   pmerr_Inv_Line_Join_Attr      = $2094;
  8477.   pmerr_Inv_Line_Type_Attr      = $2095;
  8478.   pmerr_Inv_Line_Width_Attr     = $2096;
  8479.   pmerr_Inv_Logical_Address     = $2097;
  8480.   pmerr_Inv_Marker_Box_Attr     = $2098;
  8481.   pmerr_Inv_Marker_Set_Attr     = $2099;
  8482.   pmerr_Inv_Marker_Symbol_Attr  = $209A;
  8483.   pmerr_Inv_Matrix_Element      = $209B;
  8484.   pmerr_Inv_Max_Hits            = $209C;
  8485.   pmerr_Inv_Metafile            = $209D;
  8486.   pmerr_Inv_Metafile_Length     = $209E;
  8487.   pmerr_Inv_Metafile_Offset     = $209F;
  8488.   pmerr_Inv_Microps_Draw_Control = $20A0;
  8489.   pmerr_Inv_Microps_Function    = $20A1;
  8490.   pmerr_Inv_Microps_Order       = $20A2;
  8491.   pmerr_Inv_Mix_Attr            = $20A3;
  8492.   pmerr_Inv_Mode_For_Open_Dyn   = $20A4;
  8493.   pmerr_Inv_Mode_For_Reopen_Seg = $20A5;
  8494.   pmerr_Inv_Modify_Path_Mode    = $20A6;
  8495.   pmerr_Inv_Multiplier          = $20A7;
  8496.   pmerr_Inv_Nested_Figures      = $20A8;
  8497.   pmerr_Inv_Or_Incompat_Options = $20A9;
  8498.   pmerr_Inv_Order_Length        = $20AA;
  8499.   pmerr_Inv_Ordering_Parm       = $20AB;
  8500.   pmerr_Inv_Outside_Draw_Mode   = $20AC;
  8501.   pmerr_Inv_Page_Viewport       = $20AD;
  8502.   pmerr_Inv_Path_Id             = $20AE;
  8503.   pmerr_Inv_Path_Mode           = $20AF;
  8504.   pmerr_Inv_Pattern_Attr        = $20B0;
  8505.   pmerr_Inv_Pattern_Ref_Pt_Attr = $20B1;
  8506.   pmerr_Inv_Pattern_Set_Attr    = $20B2;
  8507.   pmerr_Inv_Pattern_Set_Font    = $20B3;
  8508.   pmerr_Inv_Pick_Aperture_Option = $20B4;
  8509.   pmerr_Inv_Pick_Aperture_Posn  = $20B5;
  8510.   pmerr_Inv_Pick_Aperture_Size  = $20B6;
  8511.   pmerr_Inv_Pick_Number         = $20B7;
  8512.   pmerr_Inv_Play_Metafile_Option = $20B8;
  8513.   pmerr_Inv_Primitive_Type      = $20B9;
  8514.   pmerr_Inv_Ps_Size             = $20BA;
  8515.   pmerr_Inv_Putdata_Format      = $20BB;
  8516.   pmerr_Inv_Query_Element_No    = $20BC;
  8517.   pmerr_Inv_Rect                = $20BD;
  8518.   pmerr_Inv_Region_Control      = $20BE;
  8519.   pmerr_Inv_Region_Mix_Mode     = $20BF;
  8520.   pmerr_Inv_Replace_Mode_Func   = $20C0;
  8521.   pmerr_Inv_Reserved_Field      = $20C1;
  8522.   pmerr_Inv_Reset_Options       = $20C2;
  8523.   pmerr_Inv_Rgbcolor            = $20C3;
  8524.   pmerr_Inv_Scan_Start          = $20C4;
  8525.   pmerr_Inv_Seg_Attr            = $20C5;
  8526.   pmerr_Inv_Seg_Attr_Value      = $20C6;
  8527.   pmerr_Inv_Seg_Ch_Length       = $20C7;
  8528.   pmerr_Inv_Seg_Name            = $20C8;
  8529.   pmerr_Inv_Seg_Offset          = $20C9;
  8530.   pmerr_Inv_Setid               = $20CA;
  8531.   pmerr_Inv_Setid_Type          = $20CB;
  8532.   pmerr_Inv_Set_Viewport_Option = $20CC;
  8533.   pmerr_Inv_Sharpness_Parm      = $20CD;
  8534.   pmerr_Inv_Source_Offset       = $20CE;
  8535.   pmerr_Inv_Stop_Draw_Value     = $20CF;
  8536.   pmerr_Inv_Transform_Type      = $20D0;
  8537.   pmerr_Inv_Usage_Parm          = $20D1;
  8538.   pmerr_Inv_Viewing_Limits      = $20D2;
  8539.   pmerr_Jfile_Busy              = $20D3;
  8540.   pmerr_Jnl_Func_Data_Too_Long  = $20D4;
  8541.   pmerr_Kerning_Not_Supported   = $20D5;
  8542.   pmerr_Label_Not_Found         = $20D6;
  8543.   pmerr_Matrix_Overflow         = $20D7;
  8544.   pmerr_Metafile_Internal_Error = $20D8;
  8545.   pmerr_Metafile_In_Use         = $20D9;
  8546.   pmerr_Metafile_Limit_Exceeded = $20DA;
  8547.   pmerr_Name_Stack_Full         = $20DB;
  8548.   pmerr_Not_Created_By_Devopendc = $20DC;
  8549.   pmerr_Not_In_Area             = $20DD;
  8550.   pmerr_Not_In_Draw_Mode        = $20DE;
  8551.   pmerr_Not_In_Element          = $20DF;
  8552.   pmerr_Not_In_Image            = $20E0;
  8553.   pmerr_Not_In_Path             = $20E1;
  8554.   pmerr_Not_In_Retain_Mode      = $20E2;
  8555.   pmerr_Not_In_Seg              = $20E3;
  8556.   pmerr_No_Bitmap_Selected      = $20E4;
  8557.   pmerr_No_Current_Element      = $20E5;
  8558.   pmerr_No_Current_Seg          = $20E6;
  8559.   pmerr_No_Metafile_Record_Handle = $20E7;
  8560.   pmerr_Order_Too_Big           = $20E8;
  8561.   pmerr_Other_Set_Id_Refs       = $20E9;
  8562.   pmerr_Overran_Seg             = $20EA;
  8563.   pmerr_Own_Set_Id_Refs         = $20EB;
  8564.   pmerr_Path_Incomplete         = $20EC;
  8565.   pmerr_Path_Limit_Exceeded     = $20ED;
  8566.   pmerr_Path_Unknown            = $20EE;
  8567.   pmerr_Pel_Is_Clipped          = $20EF;
  8568.   pmerr_Pel_Not_Available       = $20F0;
  8569.   pmerr_Primitive_Stack_Empty   = $20F1;
  8570.   pmerr_Prolog_Error            = $20F2;
  8571.   pmerr_Prolog_Seg_Attr_Not_Set = $20F3;
  8572.   pmerr_Ps_Busy                 = $20F4;
  8573.   pmerr_Ps_Is_Associated        = $20F5;
  8574.   pmerr_Ram_Jnl_File_Too_Small  = $20F6;
  8575.   pmerr_Realize_Not_Supported   = $20F7;
  8576.   pmerr_Region_Is_Clip_Region   = $20F8;
  8577.   pmerr_Resource_Depletion      = $20F9;
  8578.   pmerr_Seg_And_Refseg_Are_Same = $20FA;
  8579.   pmerr_Seg_Call_Recursive      = $20FB;
  8580.   pmerr_Seg_Call_Stack_Empty    = $20FC;
  8581.   pmerr_Seg_Call_Stack_Full     = $20FD;
  8582.   pmerr_Seg_Is_Current          = $20FE;
  8583.   pmerr_Seg_Not_Chained         = $20FF;
  8584.   pmerr_Seg_Not_Found           = $2100;
  8585.   pmerr_Seg_Store_Limit_Exceeded = $2101;
  8586.   pmerr_Setid_In_Use            = $2102;
  8587.   pmerr_Setid_Not_Found         = $2103;
  8588.   pmerr_Startdoc_Not_Issued     = $2104;
  8589.   pmerr_Stop_Draw_Occurred      = $2105;
  8590.   pmerr_Too_Many_Metafiles_In_Use = $2106;
  8591.   pmerr_Truncated_Order         = $2107;
  8592.   pmerr_Unchained_Seg_Zero_Inv  = $2108;
  8593.   pmerr_Unsupported_Attr        = $2109;
  8594.   pmerr_Unsupported_Attr_Value  = $210A;
  8595.   pmerr_Enddoc_Not_Issued       = $210B;
  8596.   pmerr_Ps_Not_Associated       = $210C;
  8597.   pmerr_Inv_Flood_Fill_Options  = $210D;
  8598.   pmerr_Inv_Facename            = $210E;
  8599.   pmerr_Palette_Selected        = $210F;
  8600.   pmerr_No_Palette_Selected     = $2110;
  8601.   pmerr_Inv_Hpal                = $2111;
  8602.   pmerr_Palette_Busy            = $2112;
  8603.   pmerr_Start_Point_Clipped     = $2113;
  8604.   pmerr_No_Fill                 = $2114;
  8605.   pmerr_Inv_Facenamedesc        = $2115;
  8606.   pmerr_Inv_Bitmap_Data         = $2116;
  8607.   pmerr_Inv_Char_Align_Attr     = $2117;
  8608.   pmerr_Inv_Hfont               = $2118;
  8609.   pmerr_Hfont_Is_Selected       = $2119;
  8610.  
  8611. { Device Manager error codes }
  8612. { None yet }
  8613.  
  8614. { Spooler error codes }
  8615.   pmerr_Spl_Driver_Error        = $4001;
  8616.   pmerr_Spl_Device_Error        = $4002;
  8617.   pmerr_Spl_Device_Not_Installed = $4003;
  8618.   pmerr_Spl_Queue_Error         = $4004;
  8619.   pmerr_Spl_Inv_Hspl            = $4005;
  8620.   pmerr_Spl_No_Disk_Space       = $4006;
  8621.   pmerr_Spl_No_Memory           = $4007;
  8622.   pmerr_Spl_Print_Abort         = $4008;
  8623.   pmerr_Spl_Spooler_Not_Installed = $4009;
  8624.   pmerr_Spl_Inv_Forms_Code      = $400A;
  8625.   pmerr_Spl_Inv_Priority        = $400B;
  8626.   pmerr_Spl_No_Free_Job_Id      = $400C;
  8627.   pmerr_Spl_No_Data             = $400D;
  8628.   pmerr_Spl_Inv_Token           = $400E;
  8629.   pmerr_Spl_Inv_Datatype        = $400F;
  8630.   pmerr_Spl_Processor_Error     = $4010;
  8631.   pmerr_Spl_Inv_Job_Id          = $4011;
  8632.   pmerr_Spl_Job_Not_Printing    = $4012;
  8633.   pmerr_Spl_Job_Printing        = $4013;
  8634.   pmerr_Spl_Queue_Already_Exists = $4014;
  8635.   pmerr_Spl_Inv_Queue_Name      = $4015;
  8636.   pmerr_Spl_Queue_Not_Empty     = $4016;
  8637.   pmerr_Spl_Device_Already_Exists = $4017;
  8638.   pmerr_Spl_Device_Limit_Reached  = $4018;
  8639.   pmerr_Spl_Status_String_Trunc = $4019;
  8640.   pmerr_Spl_Inv_Length_Or_Count = $401A;
  8641.   pmerr_Spl_File_Not_Found      = $401B;
  8642.   pmerr_Spl_Cannot_Open_File    = $401C;
  8643.   pmerr_Spl_Driver_Not_Installed  = $401D;
  8644.   pmerr_Spl_Inv_Processor_Dattype = $401E;
  8645.   pmerr_Spl_Inv_Driver_Datatype = $401F;
  8646.   pmerr_Spl_Processor_Not_Inst  = $4020;
  8647.   pmerr_Spl_No_Such_Log_Address = $4021;
  8648.   pmerr_Spl_Printer_Not_Found   = $4022;
  8649.   pmerr_Spl_Dd_Not_Found        = $4023;
  8650.   pmerr_Spl_Queue_Not_Found     = $4024;
  8651.   pmerr_Spl_Many_Queues_Assoc   = $4025;
  8652.   pmerr_Spl_No_Queues_Associated = $4026;
  8653.   pmerr_Spl_Ini_File_Error      = $4027;
  8654.   pmerr_Spl_No_Default_Queue    = $4028;
  8655.   pmerr_Spl_No_Current_Forms_Code = $4029;
  8656.   pmerr_Spl_Not_Authorised      = $402A;
  8657.   pmerr_Spl_Temp_Network_Error  = $402B;
  8658.   pmerr_Spl_Hard_Network_Error  = $402C;
  8659.   pmerr_Del_Not_Allowed         = $402D;
  8660.   pmerr_Cannot_Del_Qp_Ref       = $402E;
  8661.   pmerr_Cannot_Del_Qname_Ref    = $402F;
  8662.   pmerr_Cannot_Del_Printer_Dd_Ref = $4030;
  8663.   pmerr_Cannot_Del_Prn_Name_Ref = $4031;
  8664.   pmerr_Cannot_Del_Prn_Addr_Ref = $4032;
  8665.   pmerr_Spooler_Qp_Not_Defined  = $4033;
  8666.   pmerr_Prn_Name_Not_Defined    = $4034;
  8667.   pmerr_Prn_Addr_Not_Defined    = $4035;
  8668.   pmerr_Printer_Dd_Not_Defined  = $4036;
  8669.   pmerr_Printer_Queue_Not_Defined = $4037;
  8670.   pmerr_Prn_Addr_In_Use         = $4038;
  8671.   pmerr_Spl_Too_Many_Open_Files = $4039;
  8672.   pmerr_Spl_Cp_Not_Reqd         = $403A;
  8673.   pmerr_Unable_To_Close_Device  = $4040;
  8674.  
  8675.   pmerr_Spl_Error_1             = splerr_Base + 4001;
  8676.   pmerr_Spl_Error_2             = splerr_Base + 4002;
  8677.   pmerr_Spl_Error_3             = splerr_Base + 4003;
  8678.   pmerr_Spl_Error_4             = splerr_Base + 4004;
  8679.   pmerr_Spl_Error_5             = splerr_Base + 4005;
  8680.   pmerr_Spl_Error_6             = splerr_Base + 4006;
  8681.   pmerr_Spl_Error_7             = splerr_Base + 4007;
  8682.   pmerr_Spl_Error_8             = splerr_Base + 4008;
  8683.   pmerr_Spl_Error_9             = splerr_Base + 4009;
  8684.   pmerr_Spl_Error_10            = splerr_Base + 4010;
  8685.   pmerr_Spl_Error_11            = splerr_Base + 4011;
  8686.   pmerr_Spl_Error_12            = splerr_Base + 4012;
  8687.   pmerr_Spl_Error_13            = splerr_Base + 4013;
  8688.   pmerr_Spl_Error_14            = splerr_Base + 4014;
  8689.   pmerr_Spl_Error_15            = splerr_Base + 4015;
  8690.   pmerr_Spl_Error_16            = splerr_Base + 4016;
  8691.   pmerr_Spl_Error_17            = splerr_Base + 4017;
  8692.   pmerr_Spl_Error_18            = splerr_Base + 4018;
  8693.   pmerr_Spl_Error_19            = splerr_Base + 4019;
  8694.   pmerr_Spl_Error_20            = splerr_Base + 4020;
  8695.   pmerr_Spl_Error_21            = splerr_Base + 4021;
  8696.   pmerr_Spl_Error_22            = splerr_Base + 4022;
  8697.   pmerr_Spl_Error_23            = splerr_Base + 4023;
  8698.   pmerr_Spl_Error_24            = splerr_Base + 4024;
  8699.   pmerr_Spl_Error_25            = splerr_Base + 4025;
  8700.   pmerr_Spl_Error_26            = splerr_Base + 4026;
  8701.   pmerr_Spl_Error_27            = splerr_Base + 4027;
  8702.   pmerr_Spl_Error_28            = splerr_Base + 4028;
  8703.   pmerr_Spl_Error_29            = splerr_Base + 4029;
  8704.   pmerr_Spl_Error_30            = splerr_Base + 4030;
  8705.   pmerr_Spl_Error_31            = splerr_Base + 4031;
  8706.   pmerr_Spl_Error_32            = splerr_Base + 4032;
  8707.   pmerr_Spl_Error_33            = splerr_Base + 4033;
  8708.   pmerr_Spl_Error_34            = splerr_Base + 4034;
  8709.   pmerr_Spl_Error_35            = splerr_Base + 4035;
  8710.   pmerr_Spl_Error_36            = splerr_Base + 4036;
  8711.   pmerr_Spl_Error_37            = splerr_Base + 4037;
  8712.   pmerr_Spl_Error_38            = splerr_Base + 4038;
  8713.   pmerr_Spl_Error_39            = splerr_Base + 4039;
  8714.   pmerr_Spl_Error_40            = splerr_Base + 4040;
  8715.  
  8716.   pmerr_SplMsgBox_Info_caption          = splerr_Base + 4041;
  8717.   pmerr_SplMsgBox_Warning_caption       = splerr_Base + 4042;
  8718.   pmerr_SplMsgBox_Error_caption         = splerr_Base + 4043;
  8719.   pmerr_SplMsgBox_Severe_caption        = splerr_Base + 4044;
  8720.  
  8721.   pmerr_SplMsgBox_Job_details           = splerr_Base + 4045;
  8722.  
  8723.   pmerr_SplMsgBox_Error_action          = splerr_Base + 4046;
  8724.   pmerr_SplMsgBox_Severe_action         = splerr_Base + 4047;
  8725.  
  8726.   pmerr_SplMsgBox_Bit_0_Text            = splerr_Base + 4048;
  8727.   pmerr_SplMsgBox_Bit_1_Text            = splerr_Base + 4049;
  8728.   pmerr_SplMsgBox_Bit_2_Text            = splerr_Base + 4050;
  8729.   pmerr_SplMsgBox_Bit_3_Text            = splerr_Base + 4051;
  8730.   pmerr_SplMsgBox_Bit_4_Text            = splerr_Base + 4052;
  8731.   pmerr_SplMsgBox_Bit_5_Text            = splerr_Base + 4053;
  8732.   pmerr_SplMsgBox_Bit_15_Text           = splerr_Base + 4054;
  8733.   pmerr_Spl_NoPathBuffer                = splerr_Base + 4055;
  8734.  
  8735.   pmerr_Spl_Already_Initialised         = splerr_Base + 4093;
  8736.   pmerr_Spl_Error                       = splerr_Base + 4095;
  8737.  
  8738. { Picture utilities error codes }
  8739.   pmerr_Inv_Type                = $5001;
  8740.   pmerr_Inv_Conv                = $5002;
  8741.   pmerr_Inv_SegLen              = $5003;
  8742.   pmerr_Dup_SegName             = $5004;
  8743.   pmerr_Inv_XForm               = $5005;
  8744.   pmerr_Inv_ViewLim             = $5006;
  8745.   pmerr_Inv_3dcoord             = $5007;
  8746.   pmerr_Smb_Ovflow              = $5008;
  8747.   pmerr_Seg_Ovflow              = $5009;
  8748.   pmerr_Pic_Dup_FileName        = $5010;
  8749.  
  8750. { Numbers from $5100 to $5FFF are reserved }
  8751.  
  8752. { Network/Spooler error codes from PMErr.h }
  8753.  
  8754.   NErr_Base                     = 2100;
  8755.   NErr_NetNotStarted            = NErr_Base+2;   // The NETWKSTA.SYS workstation driver isn't installed.
  8756.   NErr_RedirectedPath           = NErr_Base+17;  // The operation is invalid on a redirected resource.
  8757.   NErr_BufTooSmall              = NErr_Base+23;  // The API return buffer is too small.
  8758.   NErr_InvalidAPI               = NErr_Base+42;  // The requested API isn't supported on the remote server.
  8759.   NErr_QNotFound                = NErr_Base+50;  // The printer queue does not exist.
  8760.   NErr_JobNotFound              = NErr_Base+51;  // The print job does not exist.
  8761.   NErr_DestNotFound             = NErr_Base+52;  // The printer destination cannot be found.
  8762.   NErr_DestExists               = NErr_Base+53;  // The printer destination already exists.
  8763.   NErr_QExists                  = NErr_Base+54;  // The printer queue already exists.
  8764.   NErr_QNoRoom                  = NErr_Base+55;  // No more printer queues can be added.
  8765.   NErr_JobNoRoom                = NErr_Base+56;  // No more print jobs can be added.
  8766.   NErr_DestNoRoom               = NErr_Base+57;  // No more printer destinations can be added.
  8767.   NErr_DestIdle                 = NErr_Base+58;  // This printer destination is idle and cannot accept control operations.
  8768.   NErr_DestInvalidOp            = NErr_Base+59;  // This printer destination request contains an invalid control function.
  8769.   NErr_SpoolerNotLoaded         = NErr_Base+61;  // The spooler is not running.
  8770.   NErr_DestInvalidState         = NErr_Base+62;  // This operation cannot be performed on the print destination in its current state
  8771.   NErr_QInvalidState            = NErr_Base+63;  // This operation cannot be performed on the queue in its current state
  8772.   NErr_JobInvalidState          = NErr_Base+64;  // This operation cannot be performed on the print job in its current state.
  8773.   NErr_SpoolNoMemory            = NErr_Base+65;  // A spooler memory allocation failure occurred.
  8774.   NErr_DriverNotFound           = NErr_Base+66;  // The device driver does not exist.
  8775.   NErr_DataTypeInvalid          = NErr_Base+67;  // The datatype is not supported by the processor.
  8776.   NErr_ProcNotFound             = NErr_Base+68;  // The print processor is not installed.
  8777.   NErr_BadDev                   = NErr_Base+241; // The requested device is invalid.
  8778.   NErr_CommDevInUse             = NErr_Base+243; // This device is already in use as a communications device.
  8779.   NErr_InvalidComputer          = NErr_Base+251; // This computername is invalid.
  8780.   NErr_OpenFiles                = NErr_Base+301; // There are open files on the connection.
  8781.   NErr_LocalDrive               = NErr_Base+305; // The drive letter is in use locally.
  8782.  
  8783. implementation
  8784.  
  8785. function WinRegisterObjectClass;         external;
  8786. function WinDeregisterObjectClass;       external;
  8787. function WinReplaceObjectClass;          external;
  8788. function WinEnumObjectClasses;           external;
  8789. function WinCreateObject;                external;
  8790. function WinSetObjectData;               external;
  8791. function WinDestroyObject;               external;
  8792. function WinQueryObject;                 external;
  8793. function WinSaveObject;                  external;
  8794. function WinOpenObject;                  external;
  8795. function WinMoveObject;                  external;
  8796. function WinCopyObject;                  external;
  8797. function WinCreateShadow;                external;
  8798. function WinQueryActiveDesktopPathname;  external;
  8799. function WinQueryObjectPath;             external;
  8800. function WinRestartWPDServer;            external;
  8801. function WinIsWPDServerReady;            external;
  8802. function WinRestartSOMDD;                external;
  8803. function WinIsSOMDDReady;                external;
  8804. function WinSetFileIcon;                 external;
  8805. function WinSetFileIconN;                external;
  8806. function WinFreeFileIcon;                external;
  8807. function WinLoadFileIcon;                external;
  8808. function WinLoadFileIconN;               external;
  8809. function WinStoreWindowPos;              external;
  8810. function WinRestoreWindowPos;            external;
  8811. function WinShutdownSystem;              external;
  8812. function WinStretchPointer;              external;
  8813. function SplQpOpen;                      external;
  8814. function SplQpPrint;                     external;
  8815. function SplQpClose;                     external;
  8816. function SplQpControl;                   external;
  8817. function SplQpQueryDt;                   external;
  8818. function SplQpInstall;                   external;
  8819. function SplQpQueryFlags;                external;
  8820. function SplQmOpen;                      external;
  8821. function SplQmStartDoc;                  external;
  8822. function SplQmWrite;                     external;
  8823. function SplQmEndDoc;                    external;
  8824. function SplQmClose;                     external;
  8825. function SplQmAbort;                     external;
  8826. function SplQmAbortDoc;                  external;
  8827. function SplMessageBox;                  external;
  8828. function PrtOpen;                        external;
  8829. function PrtClose;                       external;
  8830. function PrtWrite;                       external;
  8831. function PrtDevIOCtl;                    external;
  8832. procedure PrtAbort;                      external;
  8833. function SplStdOpen;                     external;
  8834. function SplStdClose;                    external;
  8835. function SplStdStart;                    external;
  8836. function SplStdStop;                     external;
  8837. function SplStdDelete;                   external;
  8838. function SplStdGetBits;                  external;
  8839. function SplStdQueryLength;              external;
  8840. function SplCreateDevice;                external;
  8841. function SplControlDevice;               external;
  8842. function SplDeleteDevice;                external;
  8843. function SplEnumDevice;                  external;
  8844. function SplQueryDevice;                 external;
  8845. function SplSetDevice;                   external;
  8846. function SplReleaseJob;                  external;
  8847. function SplDeleteJob;                   external;
  8848. function SplEnumJob;                     external;
  8849. function SplQueryJob;                    external;
  8850. function SplHoldJob;                     external;
  8851. function SplSetJob;                      external;
  8852. function SplCreateQueue;                 external;
  8853. function SplReleaseQueue;                external;
  8854. function SplDeleteQueue;                 external;
  8855. function SplEnumQueue;                   external;
  8856. function SplQueryQueue;                  external;
  8857. function SplHoldQueue;                   external;
  8858. function SplPurgeQueue;                  external;
  8859. function SplSetQueue;                    external;
  8860. function SplEnumDriver;                  external;
  8861. function SplEnumPort;                    external;
  8862. function SplEnumQueueProcessor;          external;
  8863. function SplEnumPrinter;                 external;
  8864. function SplCopyJob;                     external;
  8865. function SplQmGetJobID;                  external;
  8866. function SplQmNewPage;                   external;
  8867. function SplCreatePort;                  external;
  8868. function SplQueryPort;                   external;
  8869. function SplDeletePort;                  external;
  8870. function SplSetPort;                     external;
  8871. function SplDisable;                     external;
  8872. function SplRegister;                    external;
  8873. function SplUnRegister;                  external;
  8874. function SplQueryPath;                   external;
  8875. function SplRegisterControlPanel;        external;
  8876. function SplDisplayControlPanel;         external;
  8877. function SplGetControlPanelList;         external;
  8878. function SplQueryControlPanel;           external;
  8879. function SplGetPortFromQ;                external;
  8880. function DdfBeginList;                   external;
  8881. function DdfBitmap;                      external;
  8882. function DdfEndList;                     external;
  8883. function DdfHyperText;                   external;
  8884. function DdfInform;                      external;
  8885. function DdfInitialize;                  external;
  8886. function DdfListItem;                    external;
  8887. function DdfMetafile;                    external;
  8888. function DdfPara;                        external;
  8889. function DdfSetColor;                    external;
  8890. function DdfSetFont;                     external;
  8891. function DdfSetFontStyle;                external;
  8892. function DdfSetFormat;                   external;
  8893. function DdfSetTextAlign;                external;
  8894. function DdfText;                        external;
  8895. function DevCloseDC;                     external;
  8896. function DevEscape;                      external;
  8897. function DevOpenDC;                      external;
  8898. function DevPostDeviceModes;             external;
  8899. function DevQueryCaps;                   external;
  8900. function DevQueryDeviceNames;            external;
  8901. function DevQueryHardcopyCaps;           external;
  8902. function DrgAcceptDroppedFiles;          external;
  8903. function DrgAccessDraginfo;              external;
  8904. function DrgAddStrHandle;                external;
  8905. function DrgAllocDraginfo;               external;
  8906. function DrgAllocDragtransfer;           external;
  8907. function DrgDeleteDraginfoStrHandles;    external;
  8908. function DrgDeleteStrHandle;             external;
  8909. function DrgDrag;                        external;
  8910. function DrgDragFiles;                   external;
  8911. function DrgFreeDraginfo;                external;
  8912. function DrgFreeDragtransfer;            external;
  8913. function DrgGetPS;                       external;
  8914. function DrgPostTransferMsg;             external;
  8915. function DrgPushDraginfo;                external;
  8916. function DrgQueryDragitem;               external;
  8917. function DrgQueryDragitemCount;          external;
  8918. function DrgQueryDragitemPtr;            external;
  8919. function DrgQueryNativeRMF;              external;
  8920. function DrgQueryNativeRMFLen;           external;
  8921. function DrgQueryStrName;                external;
  8922. function DrgQueryStrNameLen;             external;
  8923. function DrgQueryTrueType;               external;
  8924. function DrgQueryTrueTypeLen;            external;
  8925. function DrgReleasePS;                   external;
  8926. function DrgSendTransferMsg;             external;
  8927. function DrgSetDragImage;                external;
  8928. function DrgSetDragPointer;              external;
  8929. function DrgSetDragitem;                 external;
  8930. function DrgVerifyNativeRMF;             external;
  8931. function DrgVerifyRMF;                   external;
  8932. function DrgVerifyTrueType;              external;
  8933. function DrgVerifyType;                  external;
  8934. function DrgVerifyTypeSet;               external;
  8935. function DrgLazyDrag;                    external;
  8936. procedure DrgCancelLazyDrag;             external;
  8937. function DrgLazyDrop;                    external;
  8938. function DrgQueryDraginfoPtr;            external;
  8939. function DrgQueryDraginfoPtrFromHwnd;    external;
  8940. function DrgQueryDraginfoPtrFromDragitem;external;
  8941. function DrgQueryDragStatus;             external;
  8942. function DrgReallocDraginfo;             external;
  8943. function GpiAnimatePalette;              external;
  8944. function GpiAssociate;                   external;
  8945. function GpiBeginArea;                   external;
  8946. function GpiBeginElement;                external;
  8947. function GpiBeginPath;                   external;
  8948. function GpiBitBlt;                      external;
  8949. function GpiBox;                         external;
  8950. function GpiCallSegmentMatrix;           external;
  8951. function GpiCharString;                  external;
  8952. function GpiCharStringAt;                external;
  8953. function GpiCharStringPos;               external;
  8954. function GpiCharStringPosAt;             external;
  8955. function GpiCloseFigure;                 external;
  8956. function GpiCloseSegment;                external;
  8957. function GpiCombineRegion;               external;
  8958. function GpiComment;                     external;
  8959. function GpiConvert;                     external;
  8960. function GpiConvertWithMatrix;           external;
  8961. function GpiCopyMetaFile;                external;
  8962. function GpiCorrelateChain;              external;
  8963. function GpiCorrelateFrom;               external;
  8964. function GpiCorrelateSegment;            external;
  8965. function GpiCreateBitmap;                external;
  8966. function GpiCreateLogColorTable;         external;
  8967. function GpiCreateLogFont;               external;
  8968. function GpiCreatePS;                    external;
  8969. function GpiCreatePalette;               external;
  8970. function GpiCreateRegion;                external;
  8971. function GpiDeleteBitmap;                external;
  8972. function GpiDeleteElement;               external;
  8973. function GpiDeleteElementRange;          external;
  8974. function GpiDeleteElementsBetweenLabels; external;
  8975. function GpiDeleteMetaFile;              external;
  8976. function GpiDeletePalette;               external;
  8977. function GpiDeleteSegment;               external;
  8978. function GpiDeleteSegments;              external;
  8979. function GpiDeleteSetId;                 external;
  8980. function GpiDestroyPS;                   external;
  8981. function GpiDestroyRegion;               external;
  8982. function GpiDrawBits;                    external;
  8983. function GpiDrawChain;                   external;
  8984. function GpiDrawDynamics;                external;
  8985. function GpiDrawFrom;                    external;
  8986. function GpiDrawSegment;                 external;
  8987. function GpiElement;                     external;
  8988. function GpiEndArea;                     external;
  8989. function GpiEndElement;                  external;
  8990. function GpiEndPath;                     external;
  8991. function GpiEqualRegion;                 external;
  8992. function GpiErase;                       external;
  8993. function GpiErrorSegmentData;            external;
  8994. function GpiExcludeClipRectangle;        external;
  8995. function GpiFillPath;                    external;
  8996. function GpiFloodFill;                   external;
  8997. function GpiFrameRegion;                 external;
  8998. function GpiFullArc;                     external;
  8999. function GpiGetData;                     external;
  9000. function GpiImage;                       external;
  9001. function GpiIntersectClipRectangle;      external;
  9002. function GpiLabel;                       external;
  9003. function GpiLine;                        external;
  9004. function GpiLoadBitmap;                  external;
  9005. function GpiLoadFonts;                   external;
  9006. function GpiLoadMetaFile;                external;
  9007. function GpiLoadPublicFonts;             external;
  9008. function GpiMarker;                      external;
  9009. function GpiModifyPath;                  external;
  9010. function GpiMove;                        external;
  9011. function GpiOffsetClipRegion;            external;
  9012. function GpiOffsetElementPointer;        external;
  9013. function GpiOffsetRegion;                external;
  9014. function GpiOpenSegment;                 external;
  9015. function GpiOutlinePath;                 external;
  9016. function GpiPaintRegion;                 external;
  9017. function GpiPartialArc;                  external;
  9018. function GpiPathToRegion;                external;
  9019. function GpiPlayMetaFile;                external;
  9020. function GpiPointArc;                    external;
  9021. function GpiPolyFillet;                  external;
  9022. function GpiPolyFilletSharp;             external;
  9023. function GpiPolyLine;                    external;
  9024. function GpiPolyLineDisjoint;            external;
  9025. function GpiPolyMarker;                  external;
  9026. function GpiPolySpline;                  external;
  9027. function GpiPolygons;                    external;
  9028. function GpiPop;                         external;
  9029. function GpiPtInRegion;                  external;
  9030. function GpiPtVisible;                   external;
  9031. function GpiPutData;                     external;
  9032. function GpiQueryArcParams;              external;
  9033. function GpiQueryAttrMode;               external;
  9034. function GpiQueryAttrs;                  external;
  9035. function GpiQueryBackColor;              external;
  9036. function GpiQueryBackMix;                external;
  9037. function GpiQueryBitmapBits;             external;
  9038. function GpiQueryBitmapDimension;        external;
  9039. function GpiQueryBitmapHandle;           external;
  9040. function GpiQueryBitmapInfoHeader;       external;
  9041. function GpiQueryBitmapParameters;       external;
  9042. function GpiQueryBoundaryData;           external;
  9043. function GpiQueryCharAngle;              external;
  9044. function GpiQueryCharBox;                external;
  9045. function GpiQueryCharBreakExtra;         external;
  9046. function GpiQueryCharDirection;          external;
  9047. function GpiQueryCharExtra;              external;
  9048. function GpiQueryCharMode;               external;
  9049. function GpiQueryCharSet;                external;
  9050. function GpiQueryCharShear;              external;
  9051. function GpiQueryCharStringPos;          external;
  9052. function GpiQueryCharStringPosAt;        external;
  9053. function GpiQueryClipBox;                external;
  9054. function GpiQueryClipRegion;             external;
  9055. function GpiQueryColor;                  external;
  9056. function GpiQueryColorData;              external;
  9057. function GpiQueryColorIndex;             external;
  9058. function GpiQueryCp;                     external;
  9059. function GpiQueryCurrentPosition;        external;
  9060. function GpiQueryDefArcParams;           external;
  9061. function GpiQueryDefAttrs;               external;
  9062. function GpiQueryDefCharBox;             external;
  9063. function GpiQueryDefTag;                 external;
  9064. function GpiQueryDefViewingLimits;       external;
  9065. function GpiQueryDefaultViewMatrix;      external;
  9066. function GpiQueryDevice;                 external;
  9067. function GpiQueryDeviceBitmapFormats;    external;
  9068. function GpiQueryDrawControl;            external;
  9069. function GpiQueryDrawingMode;            external;
  9070. function GpiQueryEditMode;               external;
  9071. function GpiQueryElement;                external;
  9072. function GpiQueryElementPointer;         external;
  9073. function GpiQueryElementType;            external;
  9074. function GpiQueryFaceString;             external;
  9075. function GpiQueryFontAction;             external;
  9076. function GpiQueryFontFileDescriptions;   external;
  9077. function GpiQueryFontMetrics;            external;
  9078. function GpiQueryFonts;                  external;
  9079. function GpiQueryFullFontFileDescs;      external;
  9080. function GpiQueryGraphicsField;          external;
  9081. function GpiQueryInitialSegmentAttrs;    external;
  9082. function GpiQueryKerningPairs;           external;
  9083. function GpiQueryLineEnd;                external;
  9084. function GpiQueryLineJoin;               external;
  9085. function GpiQueryLineType;               external;
  9086. function GpiQueryLineWidth;              external;
  9087. function GpiQueryLineWidthGeom;          external;
  9088. function GpiQueryLogColorTable;          external;
  9089. function GpiQueryLogicalFont;            external;
  9090. function GpiQueryMarker;                 external;
  9091. function GpiQueryMarkerBox;              external;
  9092. function GpiQueryMarkerSet;              external;
  9093. function GpiQueryMetaFileBits;           external;
  9094. function GpiQueryMetaFileLength;         external;
  9095. function GpiQueryMix;                    external;
  9096. function GpiQueryModelTransformMatrix;   external;
  9097. function GpiQueryNearestColor;           external;
  9098. function GpiQueryNumberSetIds;           external;
  9099. function GpiQueryPS;                     external;
  9100. function GpiQueryPageViewport;           external;
  9101. function GpiQueryPalette;                external;
  9102. function GpiQueryPaletteInfo;            external;
  9103. function GpiQueryPattern;                external;
  9104. function GpiQueryPatternRefPoint;        external;
  9105. function GpiQueryPatternSet;             external;
  9106. function GpiQueryPel;                    external;
  9107. function GpiQueryPickAperturePosition;   external;
  9108. function GpiQueryPickApertureSize;       external;
  9109. function GpiQueryRGBColor;               external;
  9110. function GpiQueryRealColors;             external;
  9111. function GpiQueryRegionBox;              external;
  9112. function GpiQueryRegionRects;            external;
  9113. function GpiQuerySegmentAttrs;           external;
  9114. function GpiQuerySegmentNames;           external;
  9115. function GpiQuerySegmentPriority;        external;
  9116. function GpiQuerySegmentTransformMatrix; external;
  9117. function GpiQuerySetIds;                 external;
  9118. function GpiQueryStopDraw;               external;
  9119. function GpiQueryTag;                    external;
  9120. function GpiQueryTextAlignment;          external;
  9121. function GpiQueryTextBox;                external;
  9122. function GpiQueryViewingLimits;          external;
  9123. function GpiQueryViewingTransformMatrix; external;
  9124. function GpiQueryWidthTable;             external;
  9125. function GpiRectInRegion;                external;
  9126. function GpiRectVisible;                 external;
  9127. function GpiRemoveDynamics;              external;
  9128. function GpiResetBoundaryData;           external;
  9129. function GpiResetPS;                     external;
  9130. function GpiRestorePS;                   external;
  9131. function GpiRotate;                      external;
  9132. function GpiSaveMetaFile;                external;
  9133. function GpiSavePS;                      external;
  9134. function GpiScale;                       external;
  9135. function GpiSelectPalette;               external;
  9136. function GpiSetArcParams;                external;
  9137. function GpiSetAttrMode;                 external;
  9138. function GpiSetAttrs;                    external;
  9139. function GpiSetBackColor;                external;
  9140. function GpiSetBackMix;                  external;
  9141. function GpiSetBitmap;                   external;
  9142. function GpiSetBitmapBits;               external;
  9143. function GpiSetBitmapDimension;          external;
  9144. function GpiSetBitmapId;                 external;
  9145. function GpiSetCharAngle;                external;
  9146. function GpiSetCharBox;                  external;
  9147. function GpiSetCharBreakExtra;           external;
  9148. function GpiSetCharDirection;            external;
  9149. function GpiSetCharExtra;                external;
  9150. function GpiSetCharMode;                 external;
  9151. function GpiSetCharSet;                  external;
  9152. function GpiSetCharShear;                external;
  9153. function GpiSetClipPath;                 external;
  9154. function GpiSetClipRegion;               external;
  9155. function GpiSetColor;                    external;
  9156. function GpiSetCp;                       external;
  9157. function GpiSetCurrentPosition;          external;
  9158. function GpiSetDefArcParams;             external;
  9159. function GpiSetDefAttrs;                 external;
  9160. function GpiSetDefTag;                   external;
  9161. function GpiSetDefViewingLimits;         external;
  9162. function GpiSetDefaultViewMatrix;        external;
  9163. function GpiSetDrawControl;              external;
  9164. function GpiSetDrawingMode;              external;
  9165. function GpiSetEditMode;                 external;
  9166. function GpiSetElementPointer;           external;
  9167. function GpiSetElementPointerAtLabel;    external;
  9168. function GpiSetGraphicsField;            external;
  9169. function GpiSetInitialSegmentAttrs;      external;
  9170. function GpiSetLineEnd;                  external;
  9171. function GpiSetLineJoin;                 external;
  9172. function GpiSetLineType;                 external;
  9173. function GpiSetLineWidth;                external;
  9174. function GpiSetLineWidthGeom;            external;
  9175. function GpiSetMarker;                   external;
  9176. function GpiSetMarkerBox;                external;
  9177. function GpiSetMarkerSet;                external;
  9178. function GpiSetMetaFileBits;             external;
  9179. function GpiSetMix;                      external;
  9180. function GpiSetModelTransformMatrix;     external;
  9181. function GpiSetPS;                       external;
  9182. function GpiSetPageViewport;             external;
  9183. function GpiSetPaletteEntries;           external;
  9184. function GpiSetPattern;                  external;
  9185. function GpiSetPatternRefPoint;          external;
  9186. function GpiSetPatternSet;               external;
  9187. function GpiSetPel;                      external;
  9188. function GpiSetPickAperturePosition;     external;
  9189. function GpiSetPickApertureSize;         external;
  9190. function GpiSetRegion;                   external;
  9191. function GpiSetSegmentAttrs;             external;
  9192. function GpiSetSegmentPriority;          external;
  9193. function GpiSetSegmentTransformMatrix;   external;
  9194. function GpiSetStopDraw;                 external;
  9195. function GpiSetTag;                      external;
  9196. function GpiSetTextAlignment;            external;
  9197. function GpiSetViewingLimits;            external;
  9198. function GpiSetViewingTransformMatrix;   external;
  9199. function GpiStrokePath;                  external;
  9200. function GpiTranslate;                   external;
  9201. function GpiUnloadFonts;                 external;
  9202. function GpiUnloadPublicFonts;           external;
  9203. function GpiWCBitBlt;                    external;
  9204. function PrfAddProgram;                  external;
  9205. function PrfChangeProgram;               external;
  9206. function PrfCloseProfile;                external;
  9207. function PrfCreateGroup;                 external;
  9208. function PrfDestroyGroup;                external;
  9209. function PrfOpenProfile;                 external;
  9210. function PrfQueryDefinition;             external;
  9211. function PrfQueryProfile;                external;
  9212. function PrfQueryProfileData;            external;
  9213. function PrfQueryProfileInt;             external;
  9214. function PrfQueryProfileSize;            external;
  9215. function PrfQueryProfileString;          external;
  9216. function PrfQueryProgramCategory;        external;
  9217. function PrfQueryProgramHandle;          external;
  9218. function PrfQueryProgramTitles;          external;
  9219. function PrfRemoveProgram;               external;
  9220. function PrfReset;                       external;
  9221. function PrfWriteProfileData;            external;
  9222. function PrfWriteProfileString;          external;
  9223. function VioAssociate;                   external;
  9224. function VioCreateLogFont;               external;
  9225. function VioCreatePS;                    external;
  9226. function VioDeleteSetId;                 external;
  9227. function VioDestroyPS;                   external;
  9228. function VioGetDeviceCellSize;           external;
  9229. function VioGetOrg;                      external;
  9230. function VioQueryFonts;                  external;
  9231. function VioQuerySetIds;                 external;
  9232. function VioSetDeviceCellSize;           external;
  9233. function VioSetOrg;                      external;
  9234. function VioShowPS;                      external;
  9235. function WinAddAtom;                     external;
  9236. function WinAddSwitchEntry;              external;
  9237. function WinAlarm;                       external;
  9238. function WinAssociateHelpInstance;       external;
  9239. function WinBeginEnumWindows;            external;
  9240. function WinBeginPaint;                  external;
  9241. function WinBroadcastMsg;                external;
  9242. function WinCalcFrameRect;               external;
  9243. function WinCallMsgFilter;               external;
  9244. function WinCancelShutdown;              external;
  9245. function WinChangeSwitchEntry;           external;
  9246. function WinCheckInput;                  external;
  9247. function WinCloseClipbrd;                external;
  9248. function WinCompareStrings;              external;
  9249. function WinCopyAccelTable;              external;
  9250. function WinCopyRect;                    external;
  9251. function WinCpTranslateChar;             external;
  9252. function WinCpTranslateString;           external;
  9253. function WinCreateAccelTable;            external;
  9254. function WinCreateAtomTable;             external;
  9255. function WinCreateCursor;                external;
  9256. function WinCreateDlg;                   external;
  9257. function WinCreateFrameControls;         external;
  9258. function WinCreateHelpInstance;          external;
  9259. function WinCreateHelpTable;             external;
  9260. function WinCreateMenu;                  external;
  9261. function WinCreateMsgQueue;              external;
  9262. function WinCreatePointer;               external;
  9263. function WinCreatePointerIndirect;       external;
  9264. function WinCreateStdWindow;             external;
  9265. function WinCreateSwitchEntry;           external;
  9266. function WinCreateWindow;                external;
  9267. function WinDdeInitiate;                 external;
  9268. function WinDdePostMsg;                  external;
  9269. function WinDdeRespond;                  external;
  9270. function WinDefAVioWindowProc;           external;
  9271. function WinDefDlgProc;                  external;
  9272. function WinDefFileDlgProc;              external;
  9273. function WinDefFontDlgProc;              external;
  9274. function WinDefWindowProc;               external;
  9275. function WinDeleteAtom;                  external;
  9276. function WinDeleteLibrary;               external;
  9277. function WinDeleteProcedure;             external;
  9278. function WinDestroyAccelTable;           external;
  9279. function WinDestroyAtomTable;            external;
  9280. function WinDestroyCursor;               external;
  9281. function WinDestroyHelpInstance;         external;
  9282. function WinDestroyMsgQueue;             external;
  9283. function WinDestroyPointer;              external;
  9284. function WinDestroyWindow;               external;
  9285. function WinDismissDlg;                  external;
  9286. function WinDispatchMsg;                 external;
  9287. function WinDlgBox;                      external;
  9288. function WinDrawBitmap;                  external;
  9289. function WinDrawBorder;                  external;
  9290. function WinDrawPointer;                 external;
  9291. function WinDrawText;                    external;
  9292. function WinEmptyClipbrd;                external;
  9293. function WinEnablePhysInput;             external;
  9294. function WinEnableWindow;                external;
  9295. function WinEnableWindowUpdate;          external;
  9296. function WinEndEnumWindows;              external;
  9297. function WinEndPaint;                    external;
  9298. function WinEnumClipbrdFmts;             external;
  9299. function WinEnumDlgItem;                 external;
  9300. function WinEqualRect;                   external;
  9301. function WinExcludeUpdateRegion;         external;
  9302. function WinFileDlg;                     external;
  9303. function WinFillRect;                    external;
  9304. function WinFindAtom;                    external;
  9305. function WinFlashWindow;                 external;
  9306. function WinFocusChange;                 external;
  9307. function WinFontDlg;                     external;
  9308. function WinFreeErrorInfo;               external;
  9309. function WinFreeFileDlgList;             external;
  9310. function WinGetClipPS;                   external;
  9311. function WinGetCurrentTime;              external;
  9312. function WinGetDlgMsg;                   external;
  9313. function WinGetErrorInfo;                external;
  9314. function WinGetKeyState;                 external;
  9315. function WinGetLastError;                external;
  9316. function WinGetMaxPosition;              external;
  9317. function WinGetMinPosition;              external;
  9318. function WinGetMsg;                      external;
  9319. function WinGetNextWindow;               external;
  9320. function WinGetPS;                       external;
  9321. function WinGetPhysKeyState;             external;
  9322. function WinGetScreenPS;                 external;
  9323. function WinGetSysBitmap;                external;
  9324. function WinInSendMsg;                   external;
  9325. function WinInflateRect;                 external;
  9326. function WinInitialize;                  external;
  9327. function WinIntersectRect;               external;
  9328. function WinInvalidateRect;              external;
  9329. function WinInvalidateRegion;            external;
  9330. function WinInvertRect;                  external;
  9331. function WinIsChild;                     external;
  9332. function WinIsPhysInputEnabled;          external;
  9333. function WinIsRectEmpty;                 external;
  9334. function WinIsThreadActive;              external;
  9335. function WinIsWindow;                    external;
  9336. function WinIsWindowEnabled;             external;
  9337. function WinIsWindowShowing;             external;
  9338. function WinIsWindowVisible;             external;
  9339. function WinLoadAccelTable;              external;
  9340. function WinLoadDlg;                     external;
  9341. function WinLoadHelpTable;               external;
  9342. function WinLoadLibrary;                 external;
  9343. function WinLoadMenu;                    external;
  9344. function WinLoadMessage;                 external;
  9345. function WinLoadPointer;                 external;
  9346. function WinLoadProcedure;               external;
  9347. function WinLoadString;                  external;
  9348. function WinLockPointerUpdate;           external;
  9349. function WinUnlockSystem;                external;
  9350. function WinLockUpSystem;                external;
  9351. function WinLockVisRegions;              external;
  9352. function WinLockWindowUpdate;            external;
  9353. function WinMakePoints;                  external;
  9354. function WinMakeRect;                    external;
  9355. function WinMapDlgPoints;                external;
  9356. function WinMapWindowPoints;             external;
  9357. function WinMessageBox;                  external;
  9358. function WinMessageBox2;                 external;
  9359. function WinMultWindowFromIDs;           external;
  9360. function WinNextChar;                    external;
  9361. function WinOffsetRect;                  external;
  9362. function WinOpenClipbrd;                 external;
  9363. function WinOpenWindowDC;                external;
  9364. function WinPeekMsg;                     external;
  9365. function WinPopupMenu;                   external;
  9366. function WinPostMsg;                     external;
  9367. function WinPostQueueMsg;                external;
  9368. function WinPrevChar;                    external;
  9369. function WinProcessDlg;                  external;
  9370. function WinPtInRect;                    external;
  9371. function WinQueryAccelTable;             external;
  9372. function WinQueryActiveWindow;           external;
  9373. function WinQueryAnchorBlock;            external;
  9374. function WinQueryAtomLength;             external;
  9375. function WinQueryAtomName;               external;
  9376. function WinQueryAtomUsage;              external;
  9377. function WinQueryCapture;                external;
  9378. function WinQueryClassInfo;              external;
  9379. function WinQueryClassName;              external;
  9380. function WinQueryClassThunkProc;         external;
  9381. function WinQueryClipbrdData;            external;
  9382. function WinQueryClipbrdFmtInfo;         external;
  9383. function WinQueryClipbrdOwner;           external;
  9384. function WinQueryClipbrdViewer;          external;
  9385. function WinQueryCp;                     external;
  9386. function WinQueryCpList;                 external;
  9387. function WinQueryCursorInfo;             external;
  9388. function WinQueryDesktopBkgnd;           external;
  9389. function WinQueryDesktopWindow;          external;
  9390. function WinQueryDlgItemShort;           external;
  9391. function WinQueryDlgItemText;            external;
  9392. function WinQueryDlgItemTextLength;      external;
  9393. function WinQueryFocus;                  external;
  9394. function WinQueryHelpInstance;           external;
  9395. function WinQueryMsgPos;                 external;
  9396. function WinQueryMsgTime;                external;
  9397. function WinQueryObjectWindow;           external;
  9398. function WinQueryPointer;                external;
  9399. function WinQueryPointerInfo;            external;
  9400. function WinQueryPointerPos;             external;
  9401. function WinQueryPresParam;              external;
  9402. function WinQueryQueueInfo;              external;
  9403. function WinQueryQueueStatus;            external;
  9404. function WinQuerySessionTitle;           external;
  9405. function WinQuerySwitchEntry;            external;
  9406. function WinQuerySwitchHandle;           external;
  9407. function WinQuerySwitchList;             external;
  9408. function WinQuerySysColor;               external;
  9409. function WinQuerySysModalWindow;         external;
  9410. function WinQuerySysPointer;             external;
  9411. function WinQuerySysPointerData;         external;
  9412. function WinQuerySysValue;               external;
  9413. function WinQuerySystemAtomTable;        external;
  9414. function WinQueryTaskSizePos;            external;
  9415. function WinQueryTaskTitle;              external;
  9416. function WinQueryUpdateRect;             external;
  9417. function WinQueryUpdateRegion;           external;
  9418. function WinQueryVersion;                external;
  9419. function WinQueryVisibleRegion;          external;
  9420. function WinQueryWindow;                 external;
  9421. function WinQueryWindowDC;               external;
  9422. function WinQueryWindowModel;            external;
  9423. function WinQueryWindowPos;              external;
  9424. function WinQueryWindowProcess;          external;
  9425. function WinQueryWindowPtr;              external;
  9426. function WinQueryWindowRect;             external;
  9427. function WinQueryWindowText;             external;
  9428. function WinQueryWindowTextLength;       external;
  9429. function WinQueryWindowThunkProc;        external;
  9430. function WinQueryWindowULong;            external;
  9431. function WinQueryWindowUShort;           external;
  9432. function WinRealizePalette;              external;
  9433. function WinRegisterClass;               external;
  9434. function WinRegisterUserDataType;        external;
  9435. function WinRegisterUserMsg;             external;
  9436. function WinReleaseHook;                 external;
  9437. function WinReleasePS;                   external;
  9438. function WinRemovePresParam;             external;
  9439. function WinRemoveSwitchEntry;           external;
  9440. function WinRequestMutexSem;             external;
  9441. function WinSaveWindowPos;               external;
  9442. function WinScrollWindow;                external;
  9443. function WinSendDlgItemMsg;              external;
  9444. function WinSendMsg;                     external;
  9445. function WinSetAccelTable;               external;
  9446. function WinSetActiveWindow;             external;
  9447. function WinSetCapture;                  external;
  9448. function WinSetClassMsgInterest;         external;
  9449. function WinSetClassThunkProc;           external;
  9450. function WinSetClipbrdData;              external;
  9451. function WinSetClipbrdOwner;             external;
  9452. function WinSetClipbrdViewer;            external;
  9453. function WinSetCp;                       external;
  9454. function WinSetDesktopBkgnd;             external;
  9455. function WinSetDlgItemShort;             external;
  9456. function WinSetDlgItemText;              external;
  9457. function WinSetErrorInfo;                external;
  9458. function WinSetFocus;                    external;
  9459. function WinSetHook;                     external;
  9460. function WinSetKeyboardStateTable;       external;
  9461. function WinSetMsgInterest;              external;
  9462. function WinSetMsgMode;                  external;
  9463. function WinSetMultWindowPos;            external;
  9464. function WinSetOwner;                    external;
  9465. function WinSetParent;                   external;
  9466. function WinSetPointer;                  external;
  9467. function WinSetPointerOwner;             external;
  9468. function WinSetPointerPos;               external;
  9469. function WinSetPresParam;                external;
  9470. function WinSetRect;                     external;
  9471. function WinSetRectEmpty;                external;
  9472. function WinSetSynchroMode;              external;
  9473. function WinSetSysColors;                external;
  9474. function WinSetSysModalWindow;           external;
  9475. function WinSetSysPointerData;           external;
  9476. function WinSetSysValue;                 external;
  9477. function WinSetVisibleRegionNotify;      external;
  9478. function WinSetWindowBits;               external;
  9479. function WinSetWindowPos;                external;
  9480. function WinSetWindowPtr;                external;
  9481. function WinSetWindowText;               external;
  9482. function WinSetWindowThunkProc;          external;
  9483. function WinSetWindowULong;              external;
  9484. function WinSetWindowUShort;             external;
  9485. function WinShowCursor;                  external;
  9486. function WinShowPointer;                 external;
  9487. function WinShowTrackRect;               external;
  9488. function WinShowWindow;                  external;
  9489. function WinStartApp;                    external;
  9490. function WinStartTimer;                  external;
  9491. function WinStopTimer;                   external;
  9492. function WinSubclassWindow;              external;
  9493. function WinSubstituteStrings;           external;
  9494. function WinSubtractRect;                external;
  9495. function WinSwitchToProgram;             external;
  9496. function WinTerminate;                   external;
  9497. function WinTerminateApp;                external;
  9498. function WinTrackRect;                   external;
  9499. function WinTranslateAccel;              external;
  9500. function WinUnionRect;                   external;
  9501. function WinUpdateWindow;                external;
  9502. function WinUpper;                       external;
  9503. function WinUpperChar;                   external;
  9504. function WinValidateRect;                external;
  9505. function WinValidateRegion;              external;
  9506. function WinWaitEventSem;                external;
  9507. function WinWaitMsg;                     external;
  9508. function WinWaitMuxWaitSem;              external;
  9509. function WinWindowFromDC;                external;
  9510. function WinWindowFromID;                external;
  9511. function WinWindowFromPoint;             external;
  9512.  
  9513. (*
  9514.   By default, Virtual Pascal outputs run-time error messages to
  9515.   Standard Output. Everything is fine unless your program is written
  9516.   for Presentation Manager. In this case you won't see run-time error
  9517.   message at all. Run-time error message display support for
  9518.   Presentation Manager IS NOT embedded into SYSTEM unit because in
  9519.   this case SYSTEM unit should use windowing API which may not be
  9520.   available. This unit is always used by the program written for PM,
  9521.   so exit procedure is installed to displays run-time error
  9522.   message in Presentation Manager window.
  9523. *)
  9524.  
  9525. type
  9526.   NumStr = String[10];
  9527.  
  9528. var
  9529.   SaveExitProc: Pointer;
  9530.  
  9531. { Converts Longint to String (hexadecimal) }
  9532.  
  9533. function Hex2Str(Value: Longint): NumStr;
  9534. var
  9535.   I: Longint;
  9536.   S: NumStr;
  9537. const
  9538.   HexDigits: array[0..15] of Char = '0123456789ABCDEF';
  9539. begin
  9540.   S[0] := Chr(8);
  9541.   for I := 0 to 7 do
  9542.   begin
  9543.     S[8-I] := HexDigits[Value and $0F];
  9544.     Value := Value shr 4;
  9545.   end;
  9546.   Hex2Str := S;
  9547. end;
  9548.  
  9549. { Converts Longint to String (decimal) }
  9550.  
  9551. function Dec2Str(Value: Longint): NumStr;
  9552. var
  9553.   S: NumStr;
  9554. begin
  9555.   Str(Value,S);
  9556.   Dec2Str := S;
  9557. end;
  9558.  
  9559. { Exit procedure that displays run-time error (if any) }
  9560.  
  9561. procedure PM_RunTimeError;
  9562. var
  9563.   S: String;
  9564. begin
  9565.   if (ErrorAddr <> nil) and (ExceptProc = nil) then
  9566.   begin
  9567.     WinCreateMsgQueue(WinInitialize(0), 0);
  9568.     S := 'Runtime error ' + Dec2Str(ExitCode) + ' at ' + Hex2Str(Longint(ErrorAddr));
  9569.     if ExceptionNo <> 0 then S := S + ' (Exception ' + Hex2Str(ExceptionNo) + ')';
  9570.     S := S + ' TID=' + Dec2Str(GetThreadId) + '.'#0;
  9571.     WinMessageBox(hwnd_Desktop,hwnd_Desktop,@S[1],'Virtual Pascal RTL',0,mb_Error+mb_Moveable);
  9572.   end;
  9573.   ExitProc := SaveExitProc;
  9574. end;
  9575.  
  9576. begin
  9577.   SaveExitProc := ExitProc;
  9578.   ExitProc := @PM_RunTimeError;
  9579. end.
  9580.  
  9581.