home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / bpos13.zip / pmwin.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-24  |  99KB  |  2,707 lines

  1. {**************************************************************************\
  2. *
  3. * Module Name: PMWIN.PAS
  4. *
  5. * OS/2 Presentation Manager Window Manager include file
  6. *
  7. * Copyright (c) International Business Machines Corporation 1981, 1988-1990
  8. *
  9. \**************************************************************************}
  10. {| Version:   1.00
  11.  | Original translation: Peter Sawatzki (ps)
  12.  | Contributing:
  13.  |   Peter Singer (PSi)
  14.  |   Peter Sawatzki (ps)
  15.  |
  16.  | change history:
  17.  | Date:    Ver: Author:
  18.  | 11/11/93 1.00 ps     original translation by ps
  19. }
  20.  
  21. {*************************************************************************}
  22. {**        General Window Management types, constants and macros        **}
  23. Unit PmWin;
  24. Interface
  25. Uses
  26.   Os2Def;
  27. Type
  28.   MPARAM  = Pointer;  {mp}
  29.   pMPARAM = ^MPARAM;  {pmp}
  30.   MRESULT = Pointer;  {mres}
  31.   pMRESULT = ^MRESULT; {pmres}
  32.  
  33. { Macros to make an MPARAM from standard types. }
  34.   MPFROMP = MPARAM;
  35.   MPFROMHWND = MPARAM;
  36.   MPFROMCHAR = MPARAM;
  37.   MPFROMSHORT = MPARAM;
  38.   MPFROMLONG  = MPARAM;
  39.   Function MPFROM2SHORT(s1, s2: SHORT): MPARAM;
  40.     Inline(PopDx/PopAx);
  41.   Function MPFROMSH2CH (s: SHORT; uch1, uch2: UCHAR): MPARAM;
  42.     Inline(PopDx/PopBx/ $88/$DA {Mov Dl,Bl} / PopAx);
  43.  
  44. { Macros to extract standard types from an MPARAM }
  45. Type
  46.   PVOIDFROMMP = Pointer;
  47.   HWNDFROMMP  = HWND;
  48.   LONGFROMMP  = LONG;
  49.   CHAR1FROMMP = Char;
  50.  
  51.   Function Char2FromMP(mp: MPARAM): UCHAR;
  52.     InLine(PopDx/ PopBx / $31/$C0 {Xor Ax,Ax} / $88/$F8 {Mov Al,Bh});
  53.   Function Char3FromMP(mp: MPARAM): UCHAR;
  54.     Inline(PopAx/ PopBx/ $30/$E4 {Xor Ah,Ah});
  55.   Function Char4FromMP(mp: MPARAM): UCHAR;
  56.     Inline(PopAx/PopBx/ $31/$C0 {XChg Al,Ah} / $40/$E4 {Xor Ah,Ah});
  57.   Function Short1FromMP(mp: MPARAM): Short;
  58.     Inline(PopAx/PopDx);
  59.   Function Short2FromMP(mp: MPARAM): Short;
  60.     Inline(PopDx/PopAx);
  61.  
  62. { Macros to make an MRESULT from standard types. }
  63. Type
  64.   MRFROMP = MRESULT;
  65.   MRFROMSHORT = MRESULT;
  66.   MRFROMLONG = MRESULT;
  67.   Function MRFROM2SHORT(s1, s2: SHORT): MRESULT;
  68.     Inline(PopDx/PopAx);
  69.  
  70. { Macros to extract standard types from an MRESULT }
  71. Type
  72.   PVOIDFROMMR = Pointer;
  73.   LONGFROMMR = ULONG;
  74.   Function Short1FromMR(mr: MRESULT): Short;
  75.     Inline(PopAx/PopDx);
  76.   Function Short2FromMR(mr: MRESULT): Short;
  77.     Inline(PopDx/PopAx);
  78.  
  79. Type
  80.   FnWP = Function (aWND: HWND; aUSHORT: USHORT; m1, m2: MPARAM): MRESULT;
  81.   pFnWP = ^FnWp;
  82.  
  83. Const
  84.  
  85.   HWND_DESKTOP             =  HWND(1);
  86.   HWND_OBJECT              =  HWND(2);
  87.   HWND_TOP                 =  HWND(3);
  88.   HWND_BOTTOM              =  HWND(4);
  89.   HWND_THREADCAPTURE       =  HWND(5);
  90.  
  91. { Standard Window Styles }
  92.  
  93.   WS_VISIBLE               = $80000000;
  94.   WS_DISABLED              = $40000000;
  95.   WS_CLIPCHILDREN          = $20000000;
  96.   WS_CLIPSIBLINGS          = $10000000;
  97.   WS_PARENTCLIP            = $08000000;
  98.   WS_SAVEBITS              = $04000000;
  99.   WS_SYNCPAINT             = $02000000;
  100.   WS_MINIMIZED             = $01000000;
  101.   WS_MAXIMIZED             = $00800000;
  102.  
  103. { Dialog manager styles }
  104.  
  105.   WS_GROUP                 = $00010000;
  106.   WS_TABSTOP               = $00020000;
  107.   WS_MULTISELECT           = $00040000;
  108.  
  109. { Class styles }
  110.  
  111.   CS_MOVENOTIFY            = $00000001;
  112.   CS_SIZEREDRAW            = $00000004;
  113.   CS_HITTEST               = $00000008;
  114.   CS_PUBLIC                = $00000010;
  115.   CS_FRAME                 = $00000020;
  116.   CS_CLIPCHILDREN          = $20000000;
  117.   CS_CLIPSIBLINGS          = $10000000;
  118.   CS_PARENTCLIP            = $08000000;
  119.   CS_SAVEBITS              = $04000000;
  120.   CS_SYNCPAINT             = $02000000;
  121.  
  122. {*************************************************************************}
  123. {***       Window Manager Subsection part 1                            ***}
  124.  
  125. Function WinRegisterClass(_hab: HAB; pszClassName: PSZ; pfnWndProc: PFNWP;
  126.                           flStyle: ULONG; cbWindowData: USHORT): BOOL;
  127. Function WinDefWindowProc(aWnd: HWND; msg: USHORT; mp1, mp2: MPARAM): MRESULT;
  128. Function WinDestroyWindow(aWnd: HWND): BOOL;
  129. Function WinShowWindow(aWnd: HWND; fShow: BOOL): BOOL;
  130. Function WinQueryWindowRect(aWnd: HWND; prclDest: PRECTL): BOOL;
  131. Function WinGetPS(aWnd: HWND): HPS;
  132. Function WinReleasePS(aPS: HPS): BOOL;
  133. Function WinEndPaint(aPS: HPS): BOOL;
  134. Function WinGetClipPS(aWnd: HWND; ClipWnd: HWND; fs: USHORT): HPS;
  135. Function WinIsWindowShowing(aWnd: HWND): BOOL;
  136. Function WinBeginPaint(aWnd: HWND; ahps: HPS; prclPaint: PRECTL): HPS;
  137. Function WinOpenWindowDC(aWnd: HWND): HDC;
  138. Function WinScrollWindow(aWnd: HWND; dx, dy: SHORT;
  139.                          prclScroll, prclClip: pRECTL; hrgnUpdate: HRGN; prclUpdate: pRECTL;
  140.                          rgfsw: USHORT): SHORT;
  141. Const
  142. { WinGetClipPS() flags }
  143.  
  144.   PSF_LOCKWINDOWUPDATE     = $0001;
  145.   PSF_CLIPUPWARDS          = $0002;
  146.   PSF_CLIPDOWNWARDS        = $0004;
  147.   PSF_CLIPSIBLINGS         = $0008;
  148.   PSF_CLIPCHILDREN         = $0010;
  149.   PSF_PARENTCLIP           = $0020;
  150.  
  151. { WinScrollWindow() flags }
  152.  
  153.   SW_SCROLLCHILDREN        = $0001;
  154.   SW_INVALIDATERGN         = $0002;
  155.  
  156. Function WinFillRect(aPS: HPS; prcl: PRECTL; lColor: LONG): BOOL;
  157.  
  158. { WinInitialize/WinTerminate Interface declarations }
  159. Type
  160.   QVERSDATA = Record
  161.     environment,
  162.     version: USHORT
  163.   End;
  164.   PQVERSDATA = ^QVERSDATA;
  165.  
  166. Const
  167.   QV_OS2                   = $0000;
  168.   QV_CMS                   = $0001;
  169.   QV_TSO                   = $0002;
  170.   QV_TSOBATCH              = $0003;
  171.   QV_OS400                 = $0004;
  172.  
  173. Function WinQueryVersion(aAB: hAB): ULONG;
  174. Function WinInitialize(aShort: USHORT): HAB;
  175. Function WinTerminate(aAB: hAB): BOOL;
  176. Function WinQueryAnchorBlock(aWnd: HWND): HAB;
  177. Function WinCreateWindow(hwndParent: HWND; pszClass, pszName: PSZ;
  178.                          flStyle: ULONG; x, y, cx, cy: SHORT; hwndOwner, hwndInsertBehind: HWND;
  179.                          id: USHORT; pCtlData, pPresParams: PVOID): HWND;
  180. Function WinEnableWindow(aWnd: HWND; fEnable: BOOL): BOOL;
  181. Function WinIsWindowEnabled(aWnd: HWND): BOOL;
  182. Function WinEnableWindowUpdate(aWnd: HWND; fEnable: BOOL): BOOL;
  183. Function WinIsWindowVisible(aWnd: HWND): BOOL;
  184. Function WinQueryWindowText(aWnd: HWND; cchBufferMax: SHORT; pchBuffer: pCH): SHORT;
  185. Function WinSetWindowText(aWnd: HWND; pszText: PSZ): BOOL;
  186. Function WinQueryWindowTextLength(aWnd: HWND): SHORT;
  187. Function WinWindowFromID(aWndParent: HWND; id: USHORT): HWND;
  188. Function WinIsWindow(aAB: hAB; aWnd: HWND): BOOL;
  189. Function WinQueryWindow(aWnd: HWND; cmd: SHORT; fLock: BOOL): HWND;
  190. Function WinMultWindowFromIDs(hwndParent: HWND; prghwnd: pHWND;
  191.                               idFirst, idLast: USHORT): SHORT;
  192.  
  193. Const
  194. {WinQueryWindow() codes}
  195.  
  196.   QW_NEXT       = 0;
  197.   QW_PREV       = 1;
  198.   QW_TOP        = 2;
  199.   QW_BOTTOM     = 3;
  200.   QW_OWNER      = 4;
  201.   QW_PARENT     = 5;
  202.   QW_NEXTTOP    = 6;
  203.   QW_PREVTOP    = 7;
  204.   QW_FRAMEOWNER = 8;
  205.  
  206. Function WinSetParent(aWnd, aWndNewParent: HWND; fRedraw: BOOL): BOOL;
  207. Function WinIsChild(aWnd, aWndParent: HWND): BOOL;
  208. Function WinSetOwner(aWnd: HWND; WndNewOwner: HWND): BOOL;
  209. Function WinQueryWindowProcess(aWnd: HWND; apPID: pPID; apTID: pTID): BOOL;
  210. Function WinQueryObjectWindow(hWndDesktop: HWND): HWND;
  211. Function WinQueryDesktopWindow(aAB: hAB; aDC: hDC): HWND;
  212.  
  213. {** Window positioning functions }
  214.  
  215. { WinSetMultWindowPos() structure }
  216. Type
  217.   SWP = Record
  218.     fs: USHORT;
  219.     cy, cx, y, x: SHORT;
  220.     hwndInsertBehind,
  221.     aWnd: HWND
  222.   End;
  223.   pSWP = ^SWP;
  224.  
  225. Function WinSetWindowPos(aWnd, hwndInsertBehind: HWND; x, y, cx, cy: SHORT;
  226.                          fs: USHORT): BOOL;
  227. Function WinQueryWindowPos(aWnd: HWND; aSWP: pSWP): BOOL;
  228. Function WinSetMultWindowPos(aAB: hAB; aSWP: pSWP; cswp: USHORT): BOOL;
  229.  
  230. Const
  231. { Values returned from WM_ADJUSTWINDOWPOS and passed to WM_WINDOWPOSCHANGED }
  232.  
  233.   AWP_MINIMIZED            = $00010000;
  234.   AWP_MAXIMIZED            = $00020000;
  235.   AWP_RESTORED             = $00040000;
  236.   AWP_ACTIVATE             = $00080000;
  237.   AWP_DEACTIVATE           = $00100000;
  238.  
  239. { WinSetWindowPos() flags }
  240.  
  241.   SWP_SIZE                 = $0001;
  242.   SWP_MOVE                 = $0002;
  243.   SWP_ZORDER               = $0004;
  244.   SWP_SHOW                 = $0008;
  245.   SWP_HIDE                 = $0010;
  246.   SWP_NOREDRAW             = $0020;
  247.   SWP_NOADJUST             = $0040;
  248.   SWP_ACTIVATE             = $0080;
  249.   SWP_DEACTIVATE           = $0100;
  250.   SWP_EXTSTATECHANGE       = $0200;
  251.   SWP_MINIMIZE             = $0400;
  252.   SWP_MAXIMIZE             = $0800;
  253.   SWP_RESTORE              = $1000;
  254.   SWP_FOCUSACTIVATE        = $2000;
  255.   SWP_FOCUSDEACTIVATE      = $4000;
  256.  
  257. { Window painting }
  258.  
  259. Function WinUpdateWindow(aWnd: HWND): BOOL;
  260. Function WinInvalidateRect(aWnd: HWND; pwrc: PRECTL; fIncludeChildren: BOOL): BOOL;
  261. Function WinInvalidateRegion(aWnd: HWND; aRgn: HRGN; fIncludeChildren: BOOL): BOOL;
  262.  
  263. { Drawing helpers }
  264.  
  265. Function WinInvertRect(aPS: HPS; prcl: PRECTL): BOOL;
  266. Function WinDrawBitmap(hpsDst: HPS; hbm: HBITMAP; pwrcSrc: pRECTL;
  267.                        pptlDst: pPOINTL; clrFore, clrBack: LONG; fs: USHORT): BOOL;
  268.  
  269. Const
  270. { WinDrawBitmap() flags }
  271.  
  272.   DBM_NORMAL               = $0000;
  273.   DBM_INVERT               = $0001;
  274.   DBM_HALFTONE             = $0002;
  275.   DBM_STRETCH              = $0004;
  276.   DBM_IMAGEATTRS           = $0008;
  277.  
  278. Function WinDrawText(aPS: HPS; cchText: SHORT; lpchText: PCH; prcl: PRECTL;
  279.                      clrFore, clrBack: LONG; rgfCmd: USHORT): SHORT;
  280. {* WinDrawText() codes:
  281.  * From DT_LEFT to DT_EXTERNALLEADING, the codes are designed to be OR'ed with
  282.  * SS_TEXT to create variations of the basic text static item.}
  283. Const
  284.   DT_LEFT                  = $0000;
  285.   DT_EXTERNALLEADING       = $0080;
  286.   DT_CENTER                = $0100;
  287.   DT_RIGHT                 = $0200;
  288.   DT_TOP                   = $0000;
  289.   DT_VCENTER               = $0400;
  290.   DT_BOTTOM                = $0800;
  291.   DT_HALFTONE              = $1000;
  292.   DT_MNEMONIC              = $2000;
  293.   DT_WORDBREAK             = $4000;
  294.   DT_ERASERECT             = $8000;
  295.   DT_QUERYEXTENT           = $0002;
  296.   DT_TEXTATTRS             = $0040;
  297.  
  298.  
  299. Function WinDrawBorder(aPS: HPS; prcl: PRECTL; cx, cy: SHORT;
  300.                        clrFore, clrBack: LONG; rgfCmd: USHORT): BOOL;
  301.  
  302. Const
  303. { WinDrawBorder() flags }
  304.  
  305.   DB_PATCOPY               = $0000;
  306.   DB_PATINVERT             = $0001;
  307.   DB_DESTINVERT            = $0002;
  308.   DB_AREAMIXMODE           = $0003;
  309.  
  310.   DB_ROP                   = $0007;
  311.   DB_INTERIOR              = $0008;
  312.   DB_AREAATTRS             = $0010;
  313.   DB_STANDARD              = $0100;
  314.   DB_DLGBORDER             = $0200;
  315.  
  316.  
  317.  
  318. {* Resource loading functions }
  319.  
  320. Function WinLoadString(_hab: HAB; hmod: HMODULE; id: USHORT; cchMax: SHORT;
  321.                        pchBuffer: PSZ): SHORT;
  322. Function WinLoadMessage(_hab: HAB; hmod: HMODULE; id: USHORT; cchMax: SHORT;
  323.                         pchBuffer: PSZ): SHORT;
  324.  
  325. {*************************************************************************}
  326. {***                 Window Manager Subsection part 2                  ***}
  327.  
  328. Function WinSetActiveWindow(hWndDesktop, aWnd: HWND): BOOL;
  329.  
  330. { WM_CREATE structure }
  331.  
  332. Type
  333.   CreateStruct = Record
  334.     pPresParams,
  335.     pCtlData: pVoid;
  336.     id: USHORT;
  337.     hwndInsertBehind,
  338.     hwndOwner: HWND;
  339.     cy,
  340.     cx,
  341.     y,
  342.     x: SHORT;
  343.     flStyle: ULONG;
  344.     pszText,
  345.     pszClass: pSZ;
  346.     hwndParent: HWND
  347.   End;
  348.   pCreateStruct = ^CreateStruct;
  349.  
  350. { WinQueryClassInfo() structure }
  351.   ClassInfo = Record
  352.     flClassStyle: ULONG;
  353.     pfnWindowProc: pFnWp;
  354.     cbWindowData: USHORT
  355.   End;
  356.   pClassInfo = ^ClassInfo;
  357.  
  358. Function WinSubclassWindow(aWnd: HWND; _pfnwp: PFNWP): PFNWP;
  359. Function WinQueryClassName(aWnd: HWND; cchMax: SHORT; _pch: PCH): SHORT;
  360. Function WinQueryClassInfo(_hab: HAB; pszClassName: PSZ; _pClassInfo: PCLASSINFO): BOOL;
  361. Function WinQueryActiveWindow(hWndDesktop: HWND; fLock: BOOL): HWND;
  362. Function WinIsThreadActive(aAB: hAB): BOOL;
  363. Function WinQuerySysModalWindow(hWndDesktop: HWND; fLock: BOOL): HWND;
  364. Function WinLockWindow(aWnd: HWND; fLock: BOOL): HWND;
  365. Function WinRegisterWindowDestroy(aWnd: HWND; fRegister: BOOL): BOOL;
  366. Function WinSetSysModalWindow(hWndDesktop, aWnd: HWND): BOOL;
  367. Function WinQueryWindowLockCount(aWnd: HWND): SHORT;
  368. Function WinQueryWindowUShort(aWnd: HWND; index: SHORT): USHORT;
  369. Function WinSetWindowUShort(aWnd: HWND; index: SHORT; us: USHORT): BOOL;
  370. Function WinQueryWindowULong(aWnd: HWND; index: SHORT): ULONG;
  371. Function WinSetWindowULong(aWnd: HWND; index: SHORT; ul: ULONG): BOOL;
  372. Function WinQueryWindowPtr(aWnd: HWND; index: SHORT): PVOID;
  373. Function WinSetWindowPtr(aWnd: HWND; index: SHORT; p: PVOID): BOOL;
  374. Function WinSetWindowBits(aWnd: HWND; index: SHORT; flData, flMask: ULONG): BOOL;
  375.  
  376. Const
  377. { Standard WinQueryWindowUShort/ULong() indices }
  378.   QWS_USER                 = 0;
  379.   QWS_ID                   = -1;
  380.   QWS_MIN                  = -1;
  381.  
  382.   QWL_USER                 = 0;
  383.   QWL_STYLE                = -2;
  384.   QWP_PFNWP                = -3;
  385.   QWL_HMQ                  = -4;
  386.   QWL_MIN                  = -4;
  387.  
  388. { WC_FRAME WinQueryWindowUShort/ULong() indices }
  389.  
  390.   QWL_HHEAP                = $0004;
  391.   QWLaWndFOCUSSAVE        = $0018;
  392.  
  393.   QWS_FLAGS                = $0008;
  394.   QWS_RESULT               = $000a;
  395.   QWS_XRESTORE             = $000c;
  396.   QWS_YRESTORE             = $000e;
  397.   QWS_CXRESTORE            = $0010;
  398.   QWS_CYRESTORE            = $0012;
  399.   QWS_XMINIMIZE            = $0014;
  400.   QWS_YMINIMIZE            = $0016;
  401.  
  402.  
  403. { Window enumeration }
  404.  
  405. Type
  406.   HENUM = LHANDLE;
  407.  
  408. Function WinBeginEnumWindows(aWnd: HWND): HENUM;
  409. Function WinGetNextWindow(_henum: HENUM): HWND;
  410. Function WinEndEnumWindows(_henum: HENUM): BOOL;
  411. Function WinWindowFromPoint(aWnd: hWnd; pptl: pPOINTL; fChildren, fLock: BOOL): BOOL;
  412. Function WinMapWindowPoints(hWndFrom, hWndTo: HWND; prgptl: pPOINTL; cwpt: SHORT): BOOL;
  413.  
  414. { More window painting functions }
  415.  
  416. Function WinValidateRect(aWnd: HWND; prcl: PRECTL; fIncludeChildren: BOOL): BOOL;
  417. Function WinValidateRegion(aWnd: HWND; _hrgn: HRGN; fIncludeChildren: BOOL): BOOL;
  418. Function WinWindowFromDC(aDC: hDC): HWND;
  419. Function WinQueryWindowDC(aWnd: HWND): HDC;
  420. Function WinGetScreenPS(hWndDesktop: HWND): HPS;
  421. Function WinLockWindowUpdate(hWndDesktop, aWndLockUpdate: HWND): BOOL;
  422. Function WinLockVisRegions(hWndDesktop: HWND; fLock: BOOL): BOOL;
  423. Function WinQueryUpdateRect(aWnd: HWND; prcl: PRECTL): BOOL;
  424. Function WinQueryUpdateRegion(aWnd: HWND; _hrgn: HRGN): SHORT;
  425. Function WinExcludeUpdateRegion(aPS: HPS; aWnd: HWND): SHORT;
  426.  
  427. Type
  428. { QMSG structure }
  429.  
  430.   QMsg = Record
  431.     aWnd: HWND;
  432.     msg: USHORT;
  433.     mp1, mp2: MPARAM;
  434.     time: ULONG;
  435.     ptl: POINTL
  436.   End;
  437.   pQMsg = ^QMsg;
  438.   HMQ = LHANDLE;
  439.  
  440. {
  441. ** This is the standard function definition for window procedures.
  442. ** Typically they are names like "XxxxxxxxWndProc", where the prefix
  443. ** "Xxxxxxxxx" is replaced by some name descriptive of the window procedure
  444. ** being declared.  Window procedures must be EXPORTED in the definitions
  445. ** file used by the linker.
  446. **
  447. ** MRESULT EXPENTRY MyclassWndProc(HWND hwnd,   ** window handle        **
  448. **                                 USHORT msg,  ** message number       **
  449. **                                 MPARAM mp1,  ** 1st (packed) parms   **
  450. **                                 MPARAM mp2); ** 2nd (packed) parms   **
  451. }
  452.  
  453. Const
  454. { Standard Window Messages }
  455.   WM_NULL                  = $0000;
  456.   WM_CREATE                = $0001;
  457.   WM_DESTROY               = $0002;
  458.   WM_OTHERWINDOWDESTROYED  = $0003;
  459.   WM_ENABLE                = $0004;
  460.   WM_SHOW                  = $0005;
  461.   WM_MOVE                  = $0006;
  462.   WM_SIZE                  = $0007;
  463.   WM_ADJUSTWINDOWPOS       = $0008;
  464.   WM_CALCVALIDRECTS        = $0009;
  465.   WM_SETWINDOWPARAMS       = $000a;
  466.   WM_QUERYWINDOWPARAMS     = $000b;
  467.   WM_HITTEST               = $000c;
  468.   WM_ACTIVATE              = $000d;
  469.   WM_SETFOCUS              = $000f;
  470.   WM_SETSELECTION          = $0010;
  471.  
  472. { language support Winproc }
  473.   WM_PPAINT                = $0011;
  474.   WM_PSETFOCUS             = $0012;
  475.   WM_PSYSCOLORCHANGE       = $0013;
  476.   WM_PSIZE                 = $0014;
  477.   WM_PACTIVATE             = $0015;
  478.   WM_PCONTROL              = $0016;
  479.   WM_COMMAND               = $0020;
  480.   WM_SYSCOMMAND            = $0021;
  481.   WM_HELP                  = $0022;
  482.   WM_PAINT                 = $0023;
  483.   WM_TIMER                 = $0024;
  484.   WM_SEM1                  = $0025;
  485.   WM_SEM2                  = $0026;
  486.   WM_SEM3                  = $0027;
  487.   WM_SEM4                  = $0028;
  488.   WM_CLOSE                 = $0029;
  489.   WM_QUIT                  = $002a;
  490.   WM_SYSCOLORCHANGE        = $002b;
  491.   WM_SYSVALUECHANGED       = $002d;
  492.   WM_APPTERMINATENOTIFY    = $002e;
  493.   WM_PRESPARAMCHANGED      = $002f;
  494.  
  495. { Control notification messages }
  496.  
  497.   WM_CONTROL               = $0030;
  498.   WM_VSCROLL               = $0031;
  499.   WM_HSCROLL               = $0032;
  500.   WM_INITMENU              = $0033;
  501.   WM_MENUSELECT            = $0034;
  502.   WM_MENUEND               = $0035;
  503.   WM_DRAWITEM              = $0036;
  504.   WM_MEASUREITEM           = $0037;
  505.   WM_CONTROLPOINTER        = $0038;
  506.   WM_CONTROLHEAP           = $0039;
  507.   WM_QUERYDLGCODE          = $003a;
  508.   WM_INITDLG               = $003b;
  509.   WM_SUBSTITUTESTRING      = $003c;
  510.   WM_MATCHMNEMONIC         = $003d;
  511.   WM_SAVEAPPLICATION       = $003e;
  512.  
  513. { Reserve a range of messages for help manager.  This range includes  }
  514. { public messages, defined below, and private ones, which need to be  }
  515. { reserved here to prevent clashing with application messages         }
  516.  
  517.   WM_HELPBASE              = $0F00;{ Start of msgs for help manager   }
  518.   WM_HELPTOP               = $0FFF;{ End of msgs for help manager     }
  519.  
  520.   WM_USER                  = $1000;
  521.  
  522. { WM_COMMAND msg source codes }
  523.  
  524.   CMDSRC_PUSHBUTTON        = 1;
  525.   CMDSRC_MENU              = 2;
  526.   CMDSRC_ACCELERATOR       = 3;
  527.   CMDSRC_OTHER             = 0;
  528.  
  529. Type
  530. { The following structure and macro are used to access the
  531.   WM_COMMAND, WM_HELP, and WM_SYSCOMMAND message parameters: }
  532.   CmdMsg = Record
  533.     source,          { mp2 }
  534.     fMouse,
  535.     cmd,             { mp1 }
  536.     unused: USHORT
  537.   End;
  538. { -CANT-
  539.   COMMANDMSG(pmsg) \
  540.         ((struct _COMMANDMSG FAR *)((PBYTE)pmsg - sizeof(MPARAM) * 2))
  541. }
  542.  
  543. {
  544.  * The following structure is used by the WinQueryQueueInfo() routine
  545.  }
  546.  MQInfo = Record
  547.    cb:   {$IfDef Use13} USHORT {$Else} ULONG {$EndIf};
  548.    _pid: PID;
  549.    _tid: TID;
  550.    cmsgs: {$IfDef Use13} USHORT {$Else} ULONG {$EndIf};
  551.    pReserved: pVoid
  552.  End;
  553.   pMQInfo = ^MQInfo;
  554.  
  555. Function WinSendMsg(aWnd: HWND; msg: USHORT; mp1, mp2: MPARAM): MRESULT;
  556. Function WinCreateMsgQueue(aAB: hAB; cmsg: SHORT): HMQ;
  557. Function WinDestroyMsgQueue(_hmq: HMQ): BOOL;
  558. Function WinQueryQueueInfo(_hmq: HMQ; pmqi: PMQINFO; cbCopy: USHORT): BOOL;
  559. Function WinCancelShutdown(_hmq: HMQ; fCancelAlways: BOOL): BOOL;
  560. Function WinGetMsg(_hab: HAB; _pqmsg: PQMSG; hwndFilter: HWND;
  561.                    msgFilterFirst, msgFilterLast: USHORT): BOOL;
  562. Function WinPeekMsg(_hab: HAB; _pqmsg: PQMSG; hwndFilter: HWND;
  563.                     msgFilterFirst, msgFilterLast, fs: USHORT): BOOL;
  564. Function WinDispatchMsg(aAB: hAB; _pqmsg: PQMSG): MRESULT;
  565. Function WinPostMsg(aWnd: HWND; msg: USHORT; mp1, mp2: MPARAM): BOOL;
  566. Function WinRegisterUserMsg(_hab: HAB; msgid: USHORT;
  567.                             datatype1, dir1, datatype2, dir2, datatyper: SHORT): BOOL;
  568. Function WinRegisterUserDatatype(_hab: HAB; datatype, count: SHORT; types: PSHORT): BOOL;
  569. Function WinSetMsgMode(_hab: HAB; classname: PSZ; control: SHORT): BOOL;
  570. Function WinSetSynchroMode(aAB: hAB; mode: SHORT): BOOL;
  571.  
  572. Const
  573. { WinPeekMsg() constants }
  574.  
  575.   PM_REMOVE                = $0001;
  576.   PM_NOREMOVE              = $0000;
  577.  
  578. { WinRegisterUserDatatype datatypes defined in separate file }
  579.  
  580. { WinRegisterUserMsg direction codes }
  581.  
  582. Const
  583.   RUM_IN                   = 1;
  584.   RUM_OUT                  = 2;
  585.   RUM_INOUT                = 3;
  586.  
  587. { WinSetMsgMode constants }
  588.  
  589.   SMD_DELAYED              = $0001;
  590.   SMD_IMMEDIATE            = $0002;
  591.  
  592. { WinSetSynchroMode constants }
  593.  
  594.   SSM_SYNCHRONOUS          = $0001;
  595.   SSM_ASYNCHRONOUS         = $0002;
  596.   SSM_MIXED                = $0003;
  597.  
  598. { WM_CALCVALIDRECTS return flags }
  599.  
  600.   CVR_ALIGNLEFT            = $0001;
  601.   CVR_ALIGNBOTTOM          = $0002;
  602.   CVR_ALIGNRIGHT           = $0004;
  603.   CVR_ALIGNTOP             = $0008;
  604.   CVR_REDRAW               = $0010;
  605.  
  606.  
  607. { WM_HITTEST return codes }
  608.  
  609.   HT_NORMAL               =  0;
  610.   HT_TRANSPARENT          = -1;
  611.   HT_DISCARD              = -2;
  612.   HT_ERROR                = -3;
  613.  
  614.  
  615. Type
  616. { WM_SET/QUERYWINDOWPARAMS structures and flags }
  617.  
  618.   WndParams = Record
  619.     fsStatus,
  620.     cchText: USHORT;
  621.     pszText: pSZ;
  622.     cbPresParams: USHORT;
  623.     pPresParams: pVoid;
  624.     cbCtlData: USHORT;
  625.     pCtlData: pVoid
  626.   End;
  627.   pWndParams = ^WndParams;
  628.  
  629. Const
  630. { Flags used by WM_SET/QUERYWINDOWPARAMS }
  631.  
  632.   WPM_TEXT                 = $0001;
  633.   WPM_CTLDATA              = $0002;
  634.   WPM_PRESPARAMS           = $0004;
  635.   WPM_CCHTEXT              = $0008;
  636.   WPM_CBCTLDATA            = $0010;
  637.   WPM_CBPRESPARAMS         = $0020;
  638.  
  639. Function WinInSendMsg(aAB: hAB): BOOL;
  640. Function WinBroadcastMsg(aWnd: HWND; msg: USHORT; mp1, mp2: MPARAM; rgf: USHORT): BOOL;
  641.  
  642. Const
  643. { WinBroadcastMsg codes }
  644.  
  645.   BMSG_POST                = $0000;
  646.   BMSG_SEND                = $0001;
  647.   BMSG_POSTQUEUE           = $0002;
  648.   BMSG_DESCENDANTS         = $0004;
  649.   BMSG_FRAMEONLY           = $0008;
  650.  
  651.  
  652.  
  653. Function WinWaitMsg(aAB: hAB; msgFirst, msgLast: USHORT): BOOL;
  654. Function WinQueryQueueStatus(hWndDesktop: HWND): ULONG;
  655.  
  656. Const
  657. { WinQueryQueueStatus() constants }
  658.   QS_KEY                   = $0001;
  659.   QS_MOUSEBUTTON           = $0002;
  660.   QS_MOUSEMOVE             = $0004;
  661.   QS_MOUSE                 = $0006;  { QS_MOUSEMOVE|QS_MOUSEBUTTON }
  662.   QS_TIMER                 = $0008;
  663.   QS_PAINT                 = $0010;
  664.   QS_POSTMSG               = $0020;
  665.   QS_SEM1                  = $0040;
  666.   QS_SEM2                  = $0080;
  667.   QS_SEM3                  = $0100;
  668.   QS_SEM4                  = $0200;
  669.   QS_SENDMSG               = $0400;
  670.  
  671.  
  672. Function WinQueryMsgPos(aAB: hAB; pptl: PPOINTL): BOOL;
  673. Function WinQueryMsgTime(aAB: hAB): ULONG;
  674.  
  675. Function WinMsgSemWait(_hsem: HSEM; dtTimeout: LONG): USHORT;
  676. Function WinMsgMuxSemWait(pisemCleared: PUSHORT; pmxsl: PVOID; dtTimeout: LONG): USHORT;
  677. Function WinPostQueueMsg(_hmq: HMQ; msg: USHORT; mp1, mp2: MPARAM): BOOL;
  678.  
  679.  
  680. Const
  681. { WinSetMsgInterest()/WinSetClassMsgInterest() constants }
  682.   SMIM_ALL                 = $0EFF;
  683.   SMI_NOINTEREST           = $0001;
  684.   SMI_INTEREST             = $0002;
  685.   SMI_RESET                = $0004;
  686.   SMI_AUTODISPATCH         = $0008;
  687.  
  688. Function WinSetMsgInterest(aWnd: HWND; msg_class: USHORT; control: SHORT): BOOL;
  689. Function WinSetClassMsgInterest(_hab: HAB; pszClassName: PSZ;
  690.                                 msg_class: USHORT; control: SHORT): BOOL;
  691.  
  692. {** Keyboard and mouse }
  693.  
  694. {** Keyboard and mouse input COMMON subsection }
  695. Function WinSetFocus(hWndDesktop, aWndSetFocus: HWND): BOOL;
  696. Function WinFocusChange(hwndDesktop, hwndSetFocus: HWND; fsFocusChange: USHORT): BOOL;
  697.  
  698. Const
  699.   FC_NOSETFOCUS            = $0001;
  700.   FC_NOBRINGTOTOP          = FC_NOSETFOCUS;
  701.   FC_NOLOSEFOCUS           = $0002;
  702.   FC_NOBRINGTOPFIRSTWINDOW = FC_NOLOSEFOCUS;
  703.   FC_NOSETACTIVEFOCUS      = $0003;
  704.   FC_NOSETACTIVE           = $0004;
  705.   FC_NOLOSEACTIVE          = $0008;
  706.   FC_NOSETSELECTION        = $0010;
  707.   FC_NOLOSESELECTION       = $0020;
  708.  
  709.   QFC_NEXTINCHAIN          = $0001;
  710.   QFC_ACTIVE               = $0002;
  711.   QFC_FRAME                = $0003;
  712.   QFC_SELECTACTIVE         = $0004;
  713.  
  714. Function WinSetCapture(hWndDesktop, aWnd: HWND): BOOL;
  715. Function WinQueryCapture(hWndDesktop: HWND; fLock: BOOL): HWND;
  716.  
  717. Const
  718. { Mouse input messages }
  719.  
  720.   WM_MOUSEFIRST            = $0070;
  721.   WM_MOUSELAST             = $0079;
  722.   WM_BUTTONCLICKFIRST      = $0071;
  723.   WM_BUTTONCLICKLAST       = $0079;
  724.   WM_MOUSEMOVE             = $0070;
  725.  
  726.   WM_BUTTON1DOWN           = $0071;
  727.  
  728.   WM_BUTTON1UP             = $0072;
  729.   WM_BUTTON1DBLCLK         = $0073;
  730.   WM_BUTTON2DOWN           = $0074;
  731.   WM_BUTTON2UP             = $0075;
  732.   WM_BUTTON2DBLCLK         = $0076;
  733.   WM_BUTTON3DOWN           = $0077;
  734.   WM_BUTTON3UP             = $0078;
  735.   WM_BUTTON3DBLCLK         = $0079;
  736.  
  737. Function WinQueryFocus(hWndDesktop: HWND; fLock: BOOL): HWND;
  738.  
  739.  
  740. Const
  741. { Key/Character input messages }
  742.  
  743.   WM_CHAR                  = $007a;
  744.   WM_VIOCHAR               = $007b;
  745.  
  746. { WM_CHAR fs field bits }
  747.  
  748.   KC_CHAR                  = $0001;
  749.   KC_VIRTUALKEY            = $0002;
  750.   KC_SCANCODE              = $0004;
  751.  
  752.   KC_SHIFT                 = $0008;
  753.   KC_CTRL                  = $0010;
  754.   KC_ALT                   = $0020;
  755.   KC_KEYUP                 = $0040;
  756.   KC_PREVDOWN              = $0080;
  757.   KC_LONEKEY               = $0100;
  758.   KC_DEADKEY               = $0200;
  759.   KC_COMPOSITE             = $0400;
  760.   KC_INVALIDCOMP           = $0800;
  761.   KC_TOGGLE                = $1000;
  762.   KC_INVALIDCHAR           = $2000;
  763.   KC_DBCSRSRVD1            = $4000;
  764.   KC_DBCSRSRVD2            = $8000;
  765.  
  766. Type
  767. {
  768.  * The following structure and macro are used to access the
  769.  * WM_MOUSEMOVE, and WM_BUTTON message parameters
  770.  }
  771.  MSeMsg = Record
  772.    codeHitTest,    {mp2}
  773.    unused: USHORT;
  774.    x,              {mp1}
  775.    y: USHORT
  776.  End;
  777. { -CANT-
  778.   MOUSEMSG(pmsg) \
  779.         ((struct _MOUSEMSG FAR *)((PBYTE)pmsg - sizeof(MPARAM) * 2))
  780. }
  781.  
  782. {
  783.  * The following structure and macro are used to access the
  784.  * WM_CHAR message parameters.
  785.  }
  786. CHRMSG = Record
  787.   chr,        {mp2}
  788.   vkey,
  789.   fs: USHORT; {mp1}
  790.   cRepeat,
  791.   scancode: UCHAR
  792. End;
  793.  
  794. { -CANT-
  795.   CHARMSG(pmsg) \
  796.         ((struct _CHARMSG FAR *)((PBYTE)pmsg - sizeof(MPARAM) * 2))
  797. }
  798.  
  799. Const
  800. {** Virtual key values }
  801.  
  802.   VK_BUTTON1               = $01;
  803.   VK_BUTTON2               = $02;
  804.   VK_BUTTON3               = $03;
  805.   VK_BREAK                 = $04;
  806.   VK_BACKSPACE             = $05;
  807.   VK_TAB                   = $06;
  808.   VK_BACKTAB               = $07;
  809.   VK_NEWLINE               = $08;
  810.   VK_SHIFT                 = $09;
  811.   VK_CTRL                  = $0A;
  812.   VK_ALT                   = $0B;
  813.   VK_ALTGRAF               = $0C;
  814.   VK_PAUSE                 = $0D;
  815.   VK_CAPSLOCK              = $0E;
  816.   VK_ESC                   = $0F;
  817.   VK_SPACE                 = $10;
  818.   VK_PAGEUP                = $11;
  819.   VK_PAGEDOWN              = $12;
  820.   VK_END                   = $13;
  821.   VK_HOME                  = $14;
  822.   VK_LEFT                  = $15;
  823.   VK_UP                    = $16;
  824.   VK_RIGHT                 = $17;
  825.   VK_DOWN                  = $18;
  826.   VK_PRINTSCRN             = $19;
  827.   VK_INSERT                = $1A;
  828.   VK_DELETE                = $1B;
  829.   VK_SCRLLOCK              = $1C;
  830.   VK_NUMLOCK               = $1D;
  831.   VK_ENTER                 = $1E;
  832.   VK_SYSRQ                 = $1F;
  833.   VK_F1                    = $20;
  834.   VK_F2                    = $21;
  835.   VK_F3                    = $22;
  836.   VK_F4                    = $23;
  837.   VK_F5                    = $24;
  838.   VK_F6                    = $25;
  839.   VK_F7                    = $26;
  840.   VK_F8                    = $27;
  841.   VK_F9                    = $28;
  842.   VK_F10                   = $29;
  843.   VK_F11                   = $2A;
  844.   VK_F12                   = $2B;
  845.   VK_F13                   = $2C;
  846.   VK_F14                   = $2D;
  847.   VK_F15                   = $2E;
  848.   VK_F16                   = $2F;
  849.   VK_F17                   = $30;
  850.   VK_F18                   = $31;
  851.   VK_F19                   = $32;
  852.   VK_F20                   = $33;
  853.   VK_F21                   = $34;
  854.   VK_F22                   = $35;
  855.   VK_F23                   = $36;
  856.   VK_F24                   = $37;
  857.  
  858.  
  859.   VK_MENU                  = VK_F10;
  860.   VK_DBCSFIRST             = $0080;
  861.   VK_DBCSLAST              = $00ff;
  862.  
  863.   VK_USERFIRST             = $0100;
  864.   VK_USERLAST              = $01ff;
  865.  
  866. Function WinGetKeyState(hWndDesktop: HWND; vkey: SHORT): SHORT;
  867. Function WinGetPhysKeyState(hWndDesktop: HWND; sc: SHORT): SHORT;
  868. Function WinEnablePhysInput(hWndDesktop: HWND; fEnable: BOOL): BOOL;
  869. Function WinIsPhysInputEnabled(hWndDesktop: HWND): BOOL;
  870. Function WinSetKeyboardStateTable(hwndDesktop: HWND; pKeyStateTable: PBYTE;
  871.                                   fSet: BOOL): BOOL;
  872.  
  873. Const
  874. { Journal Notification messages  }
  875.   WM_JOURNALNOTIFY         = $007c;
  876.  
  877. {** Define the valid commands (lParm1) for journal notify message }
  878.   JRN_QUEUESTATUS          = $00000001;
  879.   JRN_PHYSKEYSTATE         = $00000002;
  880.  
  881. {*** Dialog Manager }
  882.  
  883. {*** Dialog Manager COMMON subsection }
  884.  
  885. {
  886. ** This is the standard function definition for dialog procedures.
  887. ** Typically they are names like "XxxxxxxxDlgProc", where the prefix
  888. ** "Xxxxxxxxx" is replaced by some name descriptive of the dialog procedure
  889. ** being declared.  Dialog procedures must be EXPORTED in the definitions
  890. ** file used by the linker.  The dialog procedure declaration is identical
  891. ** to that for window procedures.
  892. **
  893. ** MRESULT EXPENTRY MydialogDlgProc(HWND hwnd,   ** window handle        **
  894. **                                  USHORT msg,  ** message number       **
  895. **                                  MPARAM mp1,  ** 1st (packed) parms   **
  896. **                                  MPARAM mp2); ** 2nd (packed) parms   **
  897. }
  898.  
  899. Function WinGetDlgMsg(hWndDlg: HWND; _pqmsg: PQMSG): BOOL;
  900. Function WinLoadDlg(hwndParent, hwndOwner: HWND; pfnDlgProc: PFNWP;
  901.                     hmod: HMODULE; idDlg: USHORT; pCreateParams: PVOID): HWND;
  902. Function WinDlgBox(hwndParent, hwndOwner: HWND; pfnDlgProc: PFNWP;
  903.                    hmod: HMODULE; idDlg: USHORT; pCreateParams: PVOID): USHORT;
  904. Function WinDismissDlg(hWndDlg: HWND; usResult: USHORT): BOOL;
  905. Function WinQueryDlgItemShort(hwndDlg: HWND; idItem: USHORT; pResult: PSHORT;
  906.                               fSigned: BOOL): BOOL;
  907. Function WinSetDlgItemShort(hwndDlg: HWND; idItem, usValue: USHORT;
  908.                             fSigned: BOOL): BOOL;
  909. Function WinSetDlgItemText(hWndDlg: HWND; Item: USHORT; pszText: PSZ): BOOL;
  910. Function WinQueryDlgItemText(hwndDlg: HWND; idItem: USHORT;
  911.                              cchBufferMax: SHORT; pchBuffer: PSZ): BOOL;
  912. Function WinQueryDlgItemTextLength(hWndDlg: HWND; idItem: USHORT): SHORT;
  913. Function WinDefDlgProc(hwndDlg: HWND; msg: USHORT; mp1, mp2: MPARAM): MRESULT;
  914.  
  915. { Special item IDs }
  916.  
  917. Const
  918.   DID_OK    = 1;
  919.   DID_CANCEL= 2;
  920.   DID_ERROR = $ffff;
  921.  
  922. Function WinAlarm(hWndDesktop: HWND; rgfType: USHORT): BOOL;
  923.  
  924. { WinAlarm Codes }
  925. Const
  926.   WA_WARNING               = 0;
  927.   WA_NOTE                  = 1;
  928.   WA_ERROR                 = 2;
  929.   WA_CWINALARMS            = 3;
  930.  
  931. Function WinMessageBox(hwndParent, hwndOwner: HWND; pszText, pszCaption: PSZ;
  932.                        idWindow, flStyle: USHORT): USHORT;
  933.  
  934. { Message box types }
  935. Const
  936.   MB_OK                    = $0000;
  937.   MB_OKCANCEL              = $0001;
  938.   MB_RETRYCANCEL           = $0002;
  939.   MB_ABORTRETRYIGNORE      = $0003;
  940.   MB_YESNO                 = $0004;
  941.   MB_YESNOCANCEL           = $0005;
  942.   MB_CANCEL                = $0006;
  943.   MB_ENTER                 = $0007;
  944.   MB_ENTERCANCEL           = $0008;
  945.  
  946.   MB_NOICON                = $0000;
  947.   MB_CUANOTIFICATION       = $0000;
  948.   MB_ICONQUESTION          = $0010;
  949.   MB_ICONEXCLAMATION       = $0020;
  950.   MB_CUAWARNING            = $0020;
  951.   MB_ICONASTERISK          = $0030;
  952.   MB_ICONHAND              = $0040;
  953.   MB_CUACRITICAL           = $0040;
  954.   MB_QUERY                 = MB_ICONQUESTION;
  955.   MB_WARNING               = MB_CUAWARNING;
  956.   MB_INFORMATION           = MB_ICONASTERISK;
  957.   MB_CRITICAL              = MB_CUACRITICAL;
  958.   MB_ERROR                 = MB_CRITICAL;
  959.  
  960.   MB_DEFBUTTON1            = $0000;
  961.   MB_DEFBUTTON2            = $0100;
  962.   MB_DEFBUTTON3            = $0200;
  963.  
  964.   MB_APPLMODAL             = $0000;
  965.   MB_SYSTEMMODAL           = $1000;
  966.   MB_HELP                  = $2000;
  967.   MB_MOVEABLE              = $4000;
  968.  
  969.  
  970. { Message box return codes }
  971.  
  972.   MBID_OK                  = 1;
  973.   MBID_CANCEL              = 2;
  974.   MBID_ABORT               = 3;
  975.   MBID_RETRY               = 4;
  976.   MBID_IGNORE              = 5;
  977.   MBID_YES                 = 6;
  978.   MBID_NO                  = 7;
  979.   MBID_HELP                = 8;
  980.   MBID_ENTER               = 9;
  981.   MBID_ERROR               = $ffff;
  982.  
  983. { Dialog codes: returned by WM_QUERYDLGCODE msg     }
  984.  
  985.   DLGC_ENTRYFIELD  = $0001; { Entry field item understands EM_SETSEL) }
  986.   DLGC_BUTTON      = $0002; { Button item                             }
  987.   DLGC_RADIOBUTTON = $0004; { Radio button                            }
  988.   DLGC_STATIC      = $0008; { Static item                             }
  989.   DLGC_DEFAULT     = $0010; { Default push button                     }
  990.   DLGC_PUSHBUTTON  = $0020; { Normal (Non-default) push button        }
  991.   DLGC_CHECKBOX    = $0040; { Check box button control                }
  992.   DLGC_SCROLLBAR   = $0080; { Scroll bar                              }
  993.   DLGC_MENU        = $0100; { Menu                                    }
  994.   DLGC_TABONCLICK  = $0200;
  995.   DLGC_MLE         = $0400; { Multiple Line Entry                     }
  996.  
  997.  
  998. Function WinProcessDlg(hWndDlg: HWND): USHORT;
  999. Function WinStartDlg(hWndDlg: HWND): USHORT;
  1000. Function WinSendDlgItemMsg(hwndDlg: HWND; idItem, msg: USHORT; mp1, mp2: MPARAM): MRESULT;
  1001. Function WinMapDlgPoints(hwndDlg: HWND; prgwptl: PPOINTL; cwpt: USHORT;
  1002.                          fCalcWindowCoords: BOOL): BOOL;
  1003. Function WinEnumDlgItem(hwndDlg, aWnd: HWND; code: USHORT; fLock: BOOL): HWND;
  1004. Function WinSubstituteStrings(aWnd: HWND; pszSrc: PSZ; cchDstMax: SHORT;
  1005.                               pszDst: PSZ): SHORT;
  1006. Const
  1007. { WinEnumDlgItem() constants
  1008.  *
  1009.  * In OS/2 1.2, WinEnumDlgItem() can enumerate a window such that the
  1010.  * selection cursor may be moved  according to CUA (Common User Access)
  1011.  * rules.
  1012.  }
  1013.  
  1014.   EDI_FIRSTTABITEM         = 0;
  1015.   EDI_LASTTABITEM          = 1;
  1016.   EDI_NEXTTABITEM          = 2;
  1017.   EDI_PREVTABITEM          = 3;
  1018.   EDI_FIRSTGROUPITEM       = 4;
  1019.   EDI_LASTGROUPITEM        = 5;
  1020.   EDI_NEXTGROUPITEM        = 6;
  1021.   EDI_PREVGROUPITEM        = 7;
  1022.  
  1023. {** Dialog template definitions }
  1024.  
  1025. Type
  1026. { Variable-sized dialog template items: }
  1027.  
  1028.   DlgTItem = Record
  1029.     fsItemStatus,
  1030.     cChildren,
  1031.     cchClassName,
  1032.     offClassName,
  1033.     cchText,
  1034.     offText: USHORT;
  1035.     flStyle: ULONG;
  1036.     x,
  1037.     y,
  1038.     cx,
  1039.     cy: SHORT;
  1040.     id,
  1041.     offPresParams,
  1042.     offCtlData: USHORT
  1043.   End;
  1044.   pDlgTItem = ^DlgTItem;
  1045.  
  1046. { Dialog Template structure }
  1047.   DlgTemplate = Record
  1048.     cbTemplate,
  1049.     dlgtype,
  1050.     codepage,
  1051.     offadlgti,
  1052.     fsTemplateStatus,
  1053.     iItemFocus,
  1054.     coffPresParams: USHORT;
  1055.     dlgti: Array[0..0] Of DlgTItem
  1056.   End;
  1057.   pDlgTemplate = ^DlgTemplate;
  1058.  
  1059. Function WinCreateDlg(hwndParent, hwndOwner: HWND; pfnDlgProc: PFNWP;
  1060.                       pdlgt: PDLGTEMPLATE; pCreateParams: PVOID): HWND;
  1061.  
  1062. {** Static Control Manager }
  1063.  
  1064. Const
  1065. { Static control styles:
  1066.  *
  1067.  * NOTE: the top 9 bits of the LOWORD of the window flStyle are used for
  1068.  * DT_* flags.  The lower 7 bits are for SS_* styles.  This gives us up
  1069.  * to 128 distinct static control types (we currently use 11 of them).
  1070.  }
  1071.   SS_TEXT                  = $0001;
  1072.   SS_GROUPBOX              = $0002;
  1073.   SS_ICON                  = $0003;
  1074.   SS_BITMAP                = $0004;
  1075.   SS_FGNDRECT              = $0005;
  1076.   SS_HALFTONERECT          = $0006;
  1077.   SS_BKGNDRECT             = $0007;
  1078.   SS_FGNDFRAME             = $0008;
  1079.   SS_HALFTONEFRAME         = $0009;
  1080.   SS_BKGNDFRAME            = $000a;
  1081.   SS_SYSICON               = $000b;
  1082.  
  1083. { Static control class name }
  1084.  
  1085.   WC_STATIC            = pChar($ffff0005);
  1086.  
  1087. { Static control messages }
  1088.  
  1089.   SM_SETHANDLE             = $0100;
  1090.   SM_QUERYHANDLE           = $0101;
  1091.  
  1092. {*** Button Controls Subsection }
  1093.  
  1094. { Button control styles }
  1095.  
  1096.   BS_PUSHBUTTON            = 0;
  1097.   BS_CHECKBOX              = 1;
  1098.   BS_AUTOCHECKBOX          = 2;
  1099.   BS_RADIOBUTTON           = 3;
  1100.   BS_AUTORADIOBUTTON       = 4;
  1101.   BS_3STATE                = 5;
  1102.   BS_AUTO3STATE            = 6;
  1103.   BS_USERBUTTON            = 7;
  1104.  
  1105.   BS_HELP                  = $0100;
  1106.   BS_SYSCOMMAND            = $0200;
  1107.   BS_DEFAULT               = $0400;
  1108.   BS_NOPOINTERFOCUS        = $0800;
  1109.   BS_NOBORDER              = $1000;
  1110.   BS_NOCURSORSELECT        = $2000;
  1111.  
  1112.  
  1113. { Button class name }
  1114.  
  1115.   WC_BUTTON       = pChar($ffff0003);
  1116.  
  1117.  
  1118. Type
  1119.   BTNCDATA = Record
  1120.     cb,
  1121.     fsCheckState,
  1122.     fsHiliteState: USHORT
  1123.   End;
  1124.   pBTNCDATA = ^BTNCDATA;
  1125.  
  1126. { User button structure (passed in WM_CONTROL msg) }
  1127.  
  1128.   USERBUTTON = Record
  1129.     aWnd: HWND;
  1130.     _hps: HPS;
  1131.     fsState,
  1132.     fsStateOld: USHORT
  1133.   End;
  1134.   pUSERBUTTON = ^USERBUTTON;
  1135.  
  1136. Const
  1137. { Button control messages }
  1138.  
  1139.   BM_CLICK                 = $0120;
  1140.   BM_QUERYCHECKINDEX       = $0121;
  1141.   BM_QUERYHILITE           = $0122;
  1142.   BM_SETHILITE             = $0123;
  1143.   BM_QUERYCHECK            = $0124;
  1144.   BM_SETCHECK              = $0125;
  1145.   BM_SETDEFAULT            = $0126;
  1146.  
  1147. { Button notification codes }
  1148.  
  1149.   BN_CLICKED               = 1;
  1150.   BN_DBLCLICKED            = 2;
  1151.   BN_PAINT                 = 3;
  1152.  
  1153. { BN_PAINT button draw state codes (must be in high byte) }
  1154.  
  1155.   BDS_HILITED              = $0100;
  1156.   BDS_DISABLED             = $0200;
  1157.   BDS_DEFAULT              = $0400;
  1158.  
  1159. {*** Entryfield controls Subsection }
  1160.  
  1161. { Entry field  styles }
  1162.  
  1163.   ES_LEFT                  = $00000000;
  1164.   ES_CENTER                = $00000001;
  1165.   ES_RIGHT                 = $00000002;
  1166.   ES_AUTOSCROLL            = $00000004;
  1167.   ES_MARGIN                = $00000008;
  1168.   ES_AUTOTAB               = $00000010;
  1169.   ES_READONLY              = $00000020;
  1170.   ES_COMMAND               = $00000040;
  1171.   ES_UNREADABLE            = $00000080;
  1172.   ES_PICTUREMASK           = $00000100;
  1173.   ES_ANY                   = $00000000;
  1174.   ES_SBCS                  = $00001000;
  1175.   ES_DBCS                  = $00002000;
  1176.   ES_MIXED                 = $00003000;  { ES_SBCS | ES_DBCS }
  1177.  
  1178.   WC_COMBOBOX          = pChar($ffff0002);
  1179.  
  1180. { combo box styles }
  1181.   CBS_SIMPLE               = $0001;
  1182.   CBS_DROPDOWN             = $0002;
  1183.   CBS_DROPDOWNLIST         = $0004;
  1184.  
  1185. { IDs of combobox entry field and listbox. }
  1186.   CBID_LIST                = $029A;
  1187.   CBID_EDIT                = $029B;
  1188.  
  1189.   CBM_SHOWLIST             = $0170;
  1190.   CBM_HILITE               = $0171;
  1191.   CBM_ISLISTSHOWING        = $0172;
  1192.  
  1193.   CBN_EFCHANGE             = 1;
  1194.   CBN_EFSCROLL             = 2;
  1195.   CBN_MEMERROR             = 3;
  1196.   CBN_LBSELECT             = 4;
  1197.   CBN_LBSCROLL             = 5;
  1198.   CBN_SHOWLIST             = 6;
  1199.   CBN_ENTER                = 7;
  1200.  
  1201.   WC_ENTRYFIELD        = pChar($ffff0006);
  1202.  
  1203. Type
  1204.   ENTRYFDATA = Record
  1205.     cb,
  1206.     cchEditLimit,
  1207.     ichMinSel,
  1208.     ichMaxSel: USHORT
  1209.   End;
  1210.   pENTRYFDATA = ^ENTRYFDATA;
  1211.  
  1212. Const
  1213. { Entry Field  messages }
  1214.  
  1215.   EM_QUERYCHANGED          = $0140;
  1216.   EM_QUERYSEL              = $0141;
  1217.   EM_SETSEL                = $0142;
  1218.   EM_SETTEXTLIMIT          = $0143;
  1219.   EM_CUT                   = $0144;
  1220.   EM_COPY                  = $0145;
  1221.   EM_CLEAR                 = $0146;
  1222.   EM_PASTE                 = $0147;
  1223.   EM_QUERYFIRSTCHAR        = $0148;
  1224.   EM_SETFIRSTCHAR          = $0149;
  1225.   EM_QUERYREADONLY         = $014a;
  1226.   EM_SETREADONLY           = $014b;
  1227.   EM_SETINSERTMODE         = $014c;
  1228.  
  1229. { Entry Field notification messages }
  1230.  
  1231.   EN_SETFOCUS              = $0001;
  1232.   EN_KILLFOCUS             = $0002;
  1233.   EN_CHANGE                = $0004;
  1234.   EN_SCROLL                = $0008;
  1235.   EN_MEMERROR              = $0010;
  1236.   EN_OVERFLOW              = $0020;
  1237.   EN_INSERTMODETOGGLE      = $0040;
  1238.  
  1239. {  Multiple Line Entrys }
  1240.   WC_MLE     = pChar($ffff000a);
  1241.  
  1242. {*** Listboxes }
  1243. Const
  1244. { List box styles }
  1245.  
  1246.   LS_MULTIPLESEL           = $00000001;
  1247.   LS_OWNERDRAW             = $00000002;
  1248.   LS_NOADJUSTPOS           = $00000004;
  1249.   LS_HORZSCROLL            = $00000008;
  1250.  
  1251.  
  1252. { Listbox class name }
  1253.  
  1254.   WC_LISTBOX           = pChar($ffff0007);
  1255.  
  1256. { List box notification messages }
  1257.  
  1258.   LN_SELECT                = 1;
  1259.   LN_SETFOCUS              = 2;
  1260.   LN_KILLFOCUS             = 3;
  1261.   LN_SCROLL                = 4;
  1262.   LN_ENTER                 = 5;
  1263.  
  1264. { List box messages }
  1265.  
  1266.   LM_QUERYITEMCOUNT        = $0160;
  1267.   LM_INSERTITEM            = $0161;
  1268.   LM_SETTOPINDEX           = $0162;
  1269.   LM_DELETEITEM            = $0163;
  1270.   LM_SELECTITEM            = $0164;
  1271.   LM_QUERYSELECTION        = $0165;
  1272.   LM_SETITEMTEXT           = $0166;
  1273.   LM_QUERYITEMTEXTLENGTH   = $0167;
  1274.   LM_QUERYITEMTEXT         = $0168;
  1275.  
  1276.   LM_SETITEMHANDLE         = $0169;
  1277.   LM_QUERYITEMHANDLE       = $016a;
  1278.   LM_SEARCHSTRING          = $016b;
  1279.   LM_SETITEMHEIGHT         = $016c;
  1280.   LM_QUERYTOPINDEX         = $016d;
  1281.   LM_DELETEALL             = $016e;
  1282.  
  1283. { List box constants }
  1284.  
  1285.   LIT_ERROR                = -3;
  1286.   LIT_MEMERROR             = -2;
  1287.   LIT_NONE                 = -1;
  1288.   LIT_FIRST                = -1;
  1289.  
  1290. { For LM_INSERTITEM msg }
  1291.  
  1292.   LIT_END                  = -1;
  1293.   LIT_SORTASCENDING        = -2;
  1294.   LIT_SORTDESCENDING       = -3;
  1295.  
  1296. { For LM_SEARCHSTRING msg }
  1297.  
  1298.   LSS_SUBSTRING            = $0001;
  1299.   LSS_PREFIX               = $0002;
  1300.   LSS_CASESENSITIVE        = $0004;
  1301.  
  1302.  
  1303. {*** Menu Manager Subsection }
  1304.  
  1305. { Menu control styles }
  1306.  
  1307.   MS_ACTIONBAR             = $00000001;
  1308.   MS_TITLEBUTTON           = $00000002;
  1309.   MS_VERTICALFLIP          = $00000004;
  1310.  
  1311. Function WinLoadMenu(hWndFrame: HWND; hmod: HMODULE; idMenu: USHORT): HWND;
  1312.  
  1313. Const
  1314. { Menu class name }
  1315.   WC_MENU              = pChar($ffff0004);
  1316.  
  1317. { Menu control messages }
  1318.   MM_INSERTITEM            = $0180;
  1319.   MM_DELETEITEM            = $0181;
  1320.   MM_QUERYITEM             = $0182;
  1321.   MM_SETITEM               = $0183;
  1322.   MM_QUERYITEMCOUNT        = $0184;
  1323.   MM_STARTMENUMODE         = $0185;
  1324.   MM_ENDMENUMODE           = $0186;
  1325.   MM_DISMISSMENU           = $0187;
  1326.   MM_REMOVEITEM            = $0188;
  1327.   MM_SELECTITEM            = $0189;
  1328.   MM_QUERYSELITEMID        = $018a;
  1329.   MM_QUERYITEMTEXT         = $018b;
  1330.   MM_QUERYITEMTEXTLENGTH   = $018c;
  1331.   MM_SETITEMHANDLE         = $018d;
  1332.   MM_SETITEMTEXT           = $018e;
  1333.   MM_ITEMPOSITIONFROMID    = $018f;
  1334.   MM_ITEMIDFROMPOSITION    = $0190;
  1335.   MM_QUERYITEMATTR         = $0191;
  1336.   MM_SETITEMATTR           = $0192;
  1337.   MM_ISITEMVALID           = $0193;
  1338.  
  1339. Function WinCreateMenu(hWndParent: HWND; lpmt: PVOID): HWND;
  1340.  
  1341. { Owner Item Structure (Also used for listboxes) }
  1342.  
  1343. Type
  1344.   OWNERITEM = Record
  1345.     aWnd: HWND;
  1346.     _hps: HPS;
  1347.     fsState,
  1348.     fsAttribute,
  1349.     fsStateOld,
  1350.     fsAttributeOld: USHORT;
  1351.     rclItem: RECTL;
  1352.     idItem: SHORT; { This field contains idItem for menus, iItem for lb. }
  1353.     hItem: ULONG
  1354.   End;
  1355.   pOWNERITEM = ^OWNERITEM;
  1356.  
  1357. { Menu item }
  1358.  
  1359.   MENUITEM = Record
  1360.     iPosition: SHORT;
  1361.     afStyle,
  1362.     afAttribute,
  1363.     id: USHORT;
  1364.     hwndSubMenu: HWND;
  1365.     hItem: ULONG
  1366.   End;
  1367.   pMENUITEM = ^MENUITEM;
  1368.  
  1369. Const
  1370.   MIT_END                  = -1;
  1371.   MIT_NONE                 = -1;
  1372.   MIT_MEMERROR             = -1;
  1373.   MIT_ERROR                = -1;
  1374.   MID_NONE                 = MIT_NONE;
  1375.   MID_ERROR                = -1;
  1376.  
  1377. { Menu item styles & attributes }
  1378.  
  1379.   MIS_TEXT                 = $0001;
  1380.   MIS_BITMAP               = $0002;
  1381.   MIS_SEPARATOR            = $0004;
  1382.   MIS_OWNERDRAW            = $0008;
  1383.   MIS_SUBMENU              = $0010;
  1384.   MIS_MULTMENU             = $0020;     { multiple choice submenu     }
  1385.   MIS_SYSCOMMAND           = $0040;
  1386.   MIS_HELP                 = $0080;
  1387.   MIS_STATIC               = $0100;
  1388.   MIS_BUTTONSEPARATOR      = $0200;
  1389.   MIS_BREAK                = $0400;
  1390.   MIS_BREAKSEPARATOR       = $0800;
  1391.   MIS_GROUP                = $1000;     { multiple choice group start }
  1392. { In multiple choice submenus a style of 'single' denotes the item is a
  1393. ** radiobutton.  Absence of this style defaults the item to a checkbox.       }
  1394.   MIS_SINGLE               = $2000;
  1395.  
  1396.   MIA_NODISMISS            = $0020;
  1397.   MIA_FRAMED               = $1000;
  1398.   MIA_CHECKED              = $2000;
  1399.   MIA_DISABLED             = $4000;
  1400.   MIA_HILITED              = $8000;
  1401.  
  1402. {** Scroll Bar controls Subsection }
  1403.  
  1404. { Scroll Bar styles }
  1405.  
  1406.   SBS_HORZ                 = 0;
  1407.   SBS_VERT                 = 1;
  1408.   SBS_THUMBSIZE            = 2;
  1409.   SBS_AUTOTRACK            = 4;
  1410.  
  1411. { Scroll bar class name }
  1412.  
  1413.  
  1414.   WC_SCROLLBAR         = pChar($ffff0008);
  1415.  
  1416. { Scroll Bar messages }
  1417.  
  1418.   SBM_SETSCROLLBAR         = $01a0;
  1419.   SBM_SETPOS               = $01a1;
  1420.   SBM_QUERYPOS             = $01a2;
  1421.   SBM_QUERYRANGE           = $01a3;
  1422.   SBM_SETTHUMBSIZE         = $01a6;
  1423.  
  1424. { Scroll Bar Commands }
  1425.  
  1426.   SB_LINEUP                = 1;
  1427.   SB_LINEDOWN              = 2;
  1428.   SB_LINELEFT              = 1;
  1429.   SB_LINERIGHT             = 2;
  1430.   SB_PAGEUP                = 3;
  1431.   SB_PAGEDOWN              = 4;
  1432.   SB_PAGELEFT              = 3;
  1433.   SB_PAGERIGHT             = 4;
  1434.   SB_SLIDERTRACK           = 5;
  1435.   SB_SLIDERPOSITION        = 6;
  1436.   SB_ENDSCROLL             = 7;
  1437.  
  1438.  
  1439. Type
  1440.   SBCDATA = Record
  1441.     cb,
  1442.     sHilite: USHORT;      { reserved, should be set to zero }
  1443.     posFirst,
  1444.     posLast,
  1445.     posThumb,
  1446.     cVisible,
  1447.     cTotal: SHORT
  1448.   End;
  1449.   pSBCDATA = ^SBCDATA;
  1450.  
  1451. {** Frame Manager Common subsection }
  1452.   FRAMECDATA = Record
  1453.     cb: USHORT;
  1454.     flCreateFlags: ULONG;
  1455.     hmodResources: USHORT;
  1456.     idResources: USHORT
  1457.   End;
  1458.   pFRAMECDATA = ^FRAMECDATA;
  1459.  
  1460. Const
  1461. { Frame window styles }
  1462.  
  1463.   FCF_TITLEBAR             = $00000001;
  1464.   FCF_SYSMENU              = $00000002;
  1465.   FCF_MENU                 = $00000004;
  1466.   FCF_SIZEBORDER           = $00000008;
  1467.   FCF_MINBUTTON            = $00000010;
  1468.   FCF_MAXBUTTON            = $00000020;
  1469.   FCF_MINMAX               = $00000030;{ minmax means BOTH buttons }
  1470.   FCF_VERTSCROLL           = $00000040;
  1471.   FCF_HORZSCROLL           = $00000080;
  1472.   FCF_DLGBORDER            = $00000100;
  1473.   FCF_BORDER               = $00000200;
  1474.   FCF_SHELLPOSITION        = $00000400;
  1475.   FCF_TASKLIST             = $00000800;
  1476.   FCF_NOBYTEALIGN          = $00001000;
  1477.   FCF_NOMOVEWITHOWNER      = $00002000;
  1478.   FCF_ICON                 = $00004000;
  1479.   FCF_ACCELTABLE           = $00008000;
  1480.   FCF_SYSMODAL             = $00010000;
  1481.   FCF_SCREENALIGN          = $00020000;
  1482.   FCF_MOUSEALIGN           = $00040000;
  1483. { New values to enable multiple palettes.  Note that if none of the four   }
  1484. { styles specified below are used then we default to the 'system' palette  }
  1485.   FCF_PALETTE_NORMAL       = $00080000;{ normal palette            }
  1486.   FCF_PALETTE_HELP         = $00100000;{ help palette              }
  1487.   FCF_PALETTE_POPUPODD     = $00200000;{ odd level popup palette   }
  1488.   FCF_PALETTE_POPUPEVEN    = $00400000;{ even level popup palette  }
  1489. { FCF_ $00800000L is reserved }
  1490.   FCF_DBE_APPSTAT          = $80000000;
  1491.  
  1492. { FCF_TITLEBAR | FCF_SYSMENU | FCF_MENU | FCF_SIZEBORDER | FCF_MINMAX |
  1493.    FCF_ICON | FCF_ACCELTABLE | FCF_SHELLPOSITION | FCF_TASKLIST | FCF_PALETTE_NORMAL }
  1494.   FCF_STANDARD             = $0008CC3F;
  1495.  
  1496.  
  1497.   FS_ICON                  = $00000001;
  1498.   FS_ACCELTABLE            = $00000002;
  1499.   FS_SHELLPOSITION         = $00000004;
  1500.   FS_TASKLIST              = $00000008;
  1501.   FS_NOBYTEALIGN           = $00000010;
  1502.   FS_NOMOVEWITHOWNER       = $00000020;
  1503.   FS_SYSMODAL              = $00000040;
  1504.   FS_DLGBORDER             = $00000080;
  1505.   FS_BORDER                = $00000100;
  1506.   FS_SCREENALIGN           = $00000200;
  1507.   FS_MOUSEALIGN            = $00000400;
  1508.   FS_SIZEBORDER            = $00000800;
  1509.   FS_DBE_APPSTAT           = $00008000;
  1510.  
  1511. { FS_ICON | FS_ACCELTABLE | FS_SHELLPOSITION | FS_TASKLIST }
  1512.   FS_STANDARD              = $0000000F;
  1513.  
  1514.  
  1515. { Frame Window Flags accessed via WinSet/QueryWindowUShort(QWS_FLAGS) }
  1516.  
  1517.   FF_FLASHWINDOW           = $0001;
  1518.   FF_ACTIVE                = $0002;
  1519.   FF_FLASHHILITE           = $0004;
  1520.   FF_OWNERHIDDEN           = $0008;
  1521.   FF_DLGDISMISSED          = $0010;
  1522.   FF_OWNERDISABLED         = $0020;
  1523.   FF_SELECTED              = $0040;
  1524.   FF_NOACTIVATESWP         = $0080;
  1525.  
  1526. Function WinCreateStdWindow(hwndParent: HWND; flStyle: ULONG;
  1527.                             pflCreateFlags: PULONG; pszClientClass, pszTitle: PSZ; styleClient: ULONG;
  1528.                             hmod: HMODULE; idResources: USHORT; phwndClient: PHWND): HWND;
  1529.  
  1530. Function WinFlashWindow(hWndFrame: HWND; fFlash: BOOL): BOOL;
  1531.  
  1532. Const
  1533. { Frame window related messages }
  1534.  
  1535.   WM_FLASHWINDOW           = $0040;
  1536.   WM_FORMATFRAME           = $0041;
  1537.   WM_UPDATEFRAME           = $0042;
  1538.   WM_FOCUSCHANGE           = $0043;
  1539.  
  1540.   WM_SETBORDERSIZE         = $0044;
  1541.   WM_TRACKFRAME            = $0045;
  1542.   WM_MINMAXFRAME           = $0046;
  1543.   WM_SETICON               = $0047;
  1544.   WM_QUERYICON             = $0048;
  1545.   WM_SETACCELTABLE         = $0049;
  1546.   WM_QUERYACCELTABLE       = $004a;
  1547.   WM_TRANSLATEACCEL        = $004b;
  1548.   WM_QUERYTRACKINFO        = $004c;
  1549.   WM_QUERYBORDERSIZE       = $004d;
  1550.   WM_NEXTMENU              = $004e;
  1551.   WM_ERASEBACKGROUND       = $004f;
  1552.   WM_QUERYFRAMEINFO        = $0050;
  1553. { Note $0051/5 are reserved }
  1554.   WM_QUERYFOCUSCHAIN       = $0051;
  1555.   WM_CALCFRAMERECT         = $0053;
  1556.   WM_WINDOWPOSCHANGED      = $0055;
  1557.   WM_QUERYFRAMECTLCOUNT    = $0059;
  1558. { Note $005A is reserved }
  1559.   WM_QUERYHELPINFO         = $005B;
  1560.   WM_SETHELPINFO           = $005C;
  1561.   WM_ERROR                 = $005D;
  1562.  
  1563.  
  1564. { WM_QUERYFRAMEINFO constants }
  1565.  
  1566.   FI_FRAME                 = $00000001;
  1567.   FI_OWNERHIDE             = $00000002;
  1568.   FI_ACTIVATEOK            = $00000004;
  1569.   FI_NOMOVEWITHOWNER       = $00000008;
  1570.  
  1571. { Frame class name }
  1572.   WC_FRAME             = pChar($ffff0001);
  1573.  
  1574. Function WinCreateFrameControls(hwndFrame: HWND; pfcdata: PFRAMECDATA; pszTitle: PSZ): BOOL;
  1575. Function WinCalcFrameRect(hWndFrame: HWND; prcl: PRECTL; fClient: BOOL): BOOL;
  1576. Function WinGetMinPosition(aWnd: HWND; aSWP: pSWP; pptl: PPOINTL): BOOL;
  1577. Function WinGetMaxPosition(aWnd: HWND; aSWP: pSWP): BOOL;
  1578.  
  1579. Const
  1580. { Frame control IDs    }
  1581.  
  1582.   FID_SYSMENU              = $8002;
  1583.   FID_TITLEBAR             = $8003;
  1584.   FID_MINMAX               = $8004;
  1585.   FID_MENU                 = $8005;
  1586.   FID_VERTSCROLL           = $8006;
  1587.   FID_HORZSCROLL           = $8007;
  1588.   FID_CLIENT               = $8008;
  1589. { Note $8009 is reserved }
  1590.   FID_DBE_APPSTAT          = $8010;
  1591.   FID_DBE_KBDSTAT          = $8011;
  1592.   FID_DBE_PECIC            = $8012;
  1593.   FID_DBE_KKPOPUP          = $8013;
  1594.  
  1595. { Standard WM_SYSCOMMAND command values }
  1596.  
  1597.   SC_SIZE                  = $8000;
  1598.   SC_MOVE                  = $8001;
  1599.   SC_MINIMIZE              = $8002;
  1600.   SC_MAXIMIZE              = $8003;
  1601.   SC_CLOSE                 = $8004;
  1602.   SC_NEXT                  = $8005;
  1603.   SC_APPMENU               = $8006;
  1604.   SC_SYSMENU               = $8007;
  1605.   SC_RESTORE               = $8008;
  1606.   SC_NEXTFRAME             = $8009;
  1607.   SC_NEXTWINDOW            = $8010;
  1608.   SC_TASKMANAGER           = $8011;
  1609.   SC_HELPKEYS              = $8012;
  1610.   SC_HELPINDEX             = $8013;
  1611.   SC_HELPEXTENDED          = $8014;
  1612.   SC_SWITCHPANELIDS        = $8015;
  1613.   SC_DBE_FIRST             = $8018;
  1614.   SC_DBE_LAST              = $801F;
  1615.  
  1616. {** Frame controls }
  1617.  
  1618. { Title bar controls }
  1619.  
  1620. { Title bar control class name }
  1621.  
  1622.   WC_TITLEBAR          = pChar($ffff0009);
  1623.  
  1624. { Title bar control messages }
  1625.  
  1626.   TBM_SETHILITE            = $01e3;
  1627.   TBM_QUERYHILITE          = $01e4;
  1628.   TBM_TRACKMOVE            = $01e5;
  1629.  
  1630. {** Rectangle routines }
  1631.  
  1632. Function WinCopyRect(aAB: hAB; prclDst: PRECTL; prclSrc: PRECTL): BOOL;
  1633. Function WinSetRect(_hab: HAB; prcl: PRECTL; xLeft, yBottom, xRight, yTop: SHORT): BOOL;
  1634. Function WinIsRectEmpty(aAB: hAB; prcl: PRECTL): BOOL;
  1635. Function WinEqualRect(aAB: hAB; prcl1, prcl2: PRECTL): BOOL;
  1636. Function WinSetRectEmpty(aAB: hAB; prcl: PRECTL): BOOL;
  1637. Function WinOffsetRect(aAB: hAB; prcl: PRECTL; cx, cy: SHORT): BOOL;
  1638. Function WinInflateRect(aAB: hAB; prcl: PRECTL; cx, cy: SHORT): BOOL;
  1639. Function WinPtInRect(aAB: hAB; prcl: PRECTL; pptl: PPOINTL): BOOL;
  1640. Function WinIntersectRect(_hab: HAB; prclDst, prclSrc1, prclSrc2: PRECTL): BOOL;
  1641. Function WinUnionRect(_hab: HAB; prclDst, prclSrc1, prclSrc2: PRECTL): BOOL;
  1642. Function WinSubtractRect(_hab: HAB; prclDst, prclSrc1, prclSrc2: PRECTL): BOOL;
  1643. Function WinMakeRect(aAB: hAB; pwrc: PWRECT): BOOL;
  1644. Function WinMakePoints(aAB: hAB; pwpt: PWPOINT; cwpt: USHORT): BOOL;
  1645.  
  1646. {** System values }
  1647.  
  1648. Function WinQuerySysValue(hWndDesktop: HWND; iSysValue: SHORT): LONG;
  1649. Function WinSetSysValue(hWndDesktop: HWND; iSysValue: SHORT; lValue: LONG): BOOL;
  1650.  
  1651. Const
  1652.   SV_SWAPBUTTON            = 0;
  1653.   SV_DBLCLKTIME            = 1;
  1654.   SV_CXDBLCLK              = 2;
  1655.   SV_CYDBLCLK              = 3;
  1656.   SV_CXSIZEBORDER          = 4;
  1657.   SV_CYSIZEBORDER          = 5;
  1658.   SV_ALARM                 = 6;
  1659.   SV_RESERVEDFIRST1        = 7;
  1660.   SV_RESERVEDLAST1         = 8;
  1661.   SV_CURSORRATE            =  9;
  1662.   SV_FIRSTSCROLLRATE       = 10;
  1663.   SV_SCROLLRATE            = 11;
  1664.   SV_NUMBEREDLISTS         = 12;
  1665.   SV_WARNINGFREQ           = 13;
  1666.   SV_NOTEFREQ              = 14;
  1667.   SV_ERRORFREQ             = 15;
  1668.   SV_WARNINGDURATION       = 16;
  1669.   SV_NOTEDURATION          = 17;
  1670.   SV_ERRORDURATION         = 18;
  1671.   SV_RESERVEDFIRST         = 19;
  1672.   SV_RESERVEDLAST          = 19;
  1673.   SV_CXSCREEN              = 20;
  1674.   SV_CYSCREEN              = 21;
  1675.   SV_CXVSCROLL             = 22;
  1676.   SV_CYHSCROLL             = 23;
  1677.   SV_CYVSCROLLARROW        = 24;
  1678.   SV_CXHSCROLLARROW        = 25;
  1679.   SV_CXBORDER              = 26;
  1680.   SV_CYBORDER              = 27;
  1681.   SV_CXDLGFRAME            = 28;
  1682.   SV_CYDLGFRAME            = 29;
  1683.   SV_CYTITLEBAR            = 30;
  1684.   SV_CYVSLIDER             = 31;
  1685.   SV_CXHSLIDER             = 32;
  1686.   SV_CXMINMAXBUTTON        = 33;
  1687.   SV_CYMINMAXBUTTON        = 34;
  1688.   SV_CYMENU                = 35;
  1689.   SV_CXFULLSCREEN          = 36;
  1690.   SV_CYFULLSCREEN          = 37;
  1691.   SV_CXICON                = 38;
  1692.   SV_CYICON                = 39;
  1693.   SV_CXPOINTER             = 40;
  1694.   SV_CYPOINTER             = 41;
  1695.   SV_DEBUG                 = 42;
  1696.   SV_CMOUSEBUTTONS         = 43;
  1697.   SV_POINTERLEVEL          = 44;
  1698.   SV_CURSORLEVEL           = 45;
  1699.   SV_TRACKRECTLEVEL        = 46;
  1700.   SV_CTIMERS               = 47;
  1701.   SV_MOUSEPRESENT          = 48;
  1702.   SV_CXBYTEALIGN           = 49;
  1703.   SV_CYBYTEALIGN           = 50;
  1704.  
  1705. { The following value enables any greater value to be set by WinSetSysVlaue. }
  1706. { Values of 51-55 are spare for extra non-settable system values             }
  1707. { This is to enable the setting of SV_EXTRAKEYBEEP by applications.          }
  1708.  
  1709.   SV_NOTRESERVED           = 56;
  1710.   SV_EXTRAKEYBEEP          = 57;
  1711.  
  1712. { The following system value controls whether PM controls the keyboard      }
  1713. { lights for light key keystrokes (else applications will)                  }
  1714.   SV_SETLIGHTS             = 58;
  1715.   SV_INSERTMODE            = 59;
  1716.  
  1717.  
  1718.   SV_MENUROLLDOWNDELAY     = 64;
  1719.   SV_MENUROLLUPDELAY       = 65;
  1720.   SV_ALTMNEMONIC           = 66;
  1721.   SV_TASKLISTMOUSEACCESS   = 67;
  1722. { The following is the total number of system values }
  1723.   SV_CSYSVALUES            = 68;
  1724.  
  1725.   SV_CPOINTERBUTTONS       = 69;
  1726.   SV_CXALIGN               = 70;
  1727.   SV_CYALIGN               = 71;
  1728.   SV_MNEMONICSENABLED      = 72;
  1729.  
  1730. Type
  1731. { Presentation parameter structures. }
  1732.   PARAM = Record
  1733.     id,
  1734.     cb: ULONG;
  1735.     ab: Array[0..0] Of BYTE
  1736.   End;
  1737.   pPARAM = ^PARAM;
  1738.   npPARAM = ^PARAM; {-CANT-}
  1739.  
  1740.   PRESPARAMS = Record
  1741.     cb: ULONG;
  1742.     aparam: Array[0..0] Of PARAM
  1743.   End;
  1744.   pPRESPARAMS = ^PRESPARAMS;
  1745.   npPRESPARAMS = ^PRESPARAMS; {-CANT-}
  1746.  
  1747. {
  1748.  * Presentation parameter APIs
  1749.  }
  1750. Function WinSetPresParam(aWnd: HWND; id, cbParam: ULONG; pbParam: PVOID): BOOL;
  1751. Function WinQueryPresParam(aWnd: HWND; id1, id2: ULONG; pulId: PULONG;
  1752.                            cbBuf: ULONG; pbBuf: PVOID; fs: USHORT): ULONG;
  1753. Function WinRemovePresParam(aWnd: HWND; id: ULONG): BOOL;
  1754.  
  1755. { Presentation parameter types. }
  1756.  
  1757. Const
  1758.   PP_FOREGROUNDCOLOR                =  1;
  1759.   PP_FOREGROUNDCOLORINDEX           =  2;
  1760.   PP_BACKGROUNDCOLOR                =  3;
  1761.   PP_BACKGROUNDCOLORINDEX           =  4;
  1762.   PP_HILITEFOREGROUNDCOLOR          =  5;
  1763.   PP_HILITEFOREGROUNDCOLORINDEX     =  6;
  1764.   PP_HILITEBACKGROUNDCOLOR          =  7;
  1765.   PP_HILITEBACKGROUNDCOLORINDEX     =  8;
  1766.   PP_DISABLEDFOREGROUNDCOLOR        =  9;
  1767.   PP_DISABLEDFOREGROUNDCOLORINDEX   = 10;
  1768.   PP_DISABLEDBACKGROUNDCOLOR        = 11;
  1769.   PP_DISABLEDBACKGROUNDCOLORINDEX   = 12;
  1770.   PP_BORDERCOLOR                    = 13;
  1771.   PP_BORDERCOLORINDEX               = 14;
  1772.   PP_FONTNAMESIZE                   = 15;
  1773.   PP_FONTHANDLE                     = 16;
  1774.  
  1775. {
  1776.  * Flags for WinQueryPresParams()
  1777.  }
  1778.   QPF_NOINHERIT          = $0001; { Don't inherit                      }
  1779.   QPF_ID1COLORINDEX      = $0002; { Convert id1 color index into RGB   }
  1780.   QPF_ID2COLORINDEX      = $0004; { Convert id2 color index into RGB   }
  1781.   QPF_PURERGBCOLOR       = $0008; { Return pure RGB colors             }
  1782.   QPF_VALIDFLAGS         = $000F; { Valid WinQueryPresParams() flags.  }
  1783.  
  1784. {** System color functions }
  1785.  
  1786. Function WinQuerySysColor(hWndDesktop: HWND; clr, lReserved: LONG): LONG;
  1787. Function WinSetSysColors(hwndDesktop: HWND; flOptions, flFormat: ULONG;
  1788.                          clrFirst: LONG; cclr: ULONG; pclr: PLONG): BOOL;
  1789. Const
  1790.   SYSCLR_BUTTONLIGHT             = -41;
  1791.   SYSCLR_BUTTONMIDDLE            = -40;
  1792.   SYSCLR_BUTTONDARK              = -39;
  1793.   SYSCLR_BUTTONDEFAULT           = -38;
  1794.   SYSCLR_TITLEBOTTOM             = -37;
  1795.   SYSCLR_SHADOW                  = -36;
  1796.   SYSCLR_ICONTEXT                = -35;
  1797.   SYSCLR_DIALOGBACKGROUND        = -34;
  1798.   SYSCLR_HILITEFOREGROUND        = -33;
  1799.   SYSCLR_HILITEBACKGROUND        = -32;
  1800.   SYSCLR_INACTIVETITLETEXTBGND   = -31;
  1801.   SYSCLR_ACTIVETITLETEXTBGND     = -30;
  1802.   SYSCLR_INACTIVETITLETEXT       = -29;
  1803.   SYSCLR_ACTIVETITLETEXT         = -28;
  1804.   SYSCLR_OUTPUTTEXT              = -27;
  1805.   SYSCLR_WINDOWSTATICTEXT        = -26;
  1806.   SYSCLR_SCROLLBAR               = -25;
  1807.   SYSCLR_BACKGROUND              = -24;
  1808.   SYSCLR_ACTIVETITLE             = -23;
  1809.   SYSCLR_INACTIVETITLE           = -22;
  1810.   SYSCLR_MENU                    = -21;
  1811.   SYSCLR_WINDOW                  = -20;
  1812.   SYSCLR_WINDOWFRAME             = -19;
  1813.   SYSCLR_MENUTEXT                = -18;
  1814.   SYSCLR_WINDOWTEXT              = -17;
  1815.   SYSCLR_TITLETEXT               = -16;
  1816.   SYSCLR_ACTIVEBORDER            = -15;
  1817.   SYSCLR_INACTIVEBORDER          = -14;
  1818.   SYSCLR_APPWORKSPACE            = -13;
  1819.   SYSCLR_HELPBACKGROUND          = -12;
  1820.   SYSCLR_HELPTEXT                = -11;
  1821.   SYSCLR_HELPHILITE              = -10;
  1822.   SYSCLR_CSYSCOLORS              =  32;
  1823.  
  1824. {*** Timer manager }
  1825.  
  1826. Function WinStartTimer(_hab: HAB; aWnd: HWND; idTimer, dtTimeout: USHORT): USHORT;
  1827. Function WinStopTimer(aAB: hAB; aWnd: HWND; idTimer: USHORT): BOOL;
  1828. Function WinGetCurrentTime(aAB: hAB): ULONG;
  1829.  
  1830. Const
  1831.   TID_CURSOR        = $ffff;  { Reserved cursor timer ID              }
  1832.   TID_SCROLL        = $fffe;  { Reserved scrolling timer ID           }
  1833.   TID_FLASHWINDOW   = $fffd;  { Reserved for window flashing timer ID }
  1834.   TID_USERMAX       = $7fff;  { Maximum user timer ID                 }
  1835.  
  1836. {*** Accelerator functions }
  1837.  
  1838. { ACCEL fs bits
  1839.  *
  1840.  * NOTE: the first six AF_ code bits have the same value
  1841.  * as their KC_ counterparts
  1842.  }
  1843.   AF_CHAR                  = $0001;
  1844.   AF_VIRTUALKEY            = $0002;
  1845.   AF_SCANCODE              = $0004;
  1846.   AF_SHIFT                 = $0008;
  1847.   AF_CONTROL               = $0010;
  1848.   AF_ALT                   = $0020;
  1849.   AF_LONEKEY               = $0040;
  1850.   AF_SYSCOMMAND            = $0100;
  1851.   AF_HELP                  = $0200;
  1852.  
  1853. Type
  1854.   HACCEL = LHANDLE; { haccel }
  1855.   ACCEL = Record
  1856.     fs,
  1857.     key,
  1858.     cmd: USHORT
  1859.   End;
  1860.   pACCEL = ^ACCEL;
  1861.  
  1862.   ACCELTABLE = Record
  1863.     cAccel,
  1864.     codepage: USHORT;
  1865.     aaccel: Array[0..0] Of ACCEL
  1866.   End;
  1867.   pACCELTABLE = ^ACCELTABLE;
  1868.  
  1869. Function WinLoadAccelTable(aAB: hAB; hmod: HMODULE; idAccelTable: USHORT): HACCEL;
  1870. Function WinCreateAccelTable(aAB: hAB; _pAccelTable: PACCELTABLE): HACCEL;
  1871. Function WinDestroyAccelTable(_haccel: HACCEL): BOOL;
  1872. Function WinCopyAccelTable(_haccel: HACCEL; _pAccelTable: PACCELTABLE;
  1873.                            cbCopyMax: USHORT): USHORT;
  1874. Function WinTranslateAccel(_hab: HAB; aWnd: HWND; _haccel: HACCEL;
  1875.                            _pqmsg: PQMSG): BOOL;
  1876. Function WinSetAccelTable(aAB: hAB; _haccel: HACCEL; hWndFrame: HWND): BOOL;
  1877. Function WinQueryAccelTable(aAB: hAB; hWndFrame: HWND): HACCEL;
  1878.  
  1879. {*** Extended Attribute Flags (Association Table) }
  1880.  
  1881. Const
  1882.   EAF_DEFAULTOWNER         = $0001;
  1883.   EAF_UNCHANGEABLE         = $0002;
  1884.   EAF_REUSEICON            = $0004;
  1885.  
  1886. {** WinTrackRect() information }
  1887.  
  1888. { WinTrackRect() tracking information structure }
  1889.  
  1890. Type
  1891.   TRACKINFO = Record
  1892.     cxBorder,
  1893.     cyBorder,
  1894.     cxGrid,
  1895.     cyGrid,
  1896.     cxKeyboard,
  1897.     cyKeyboard: SHORT;
  1898.     rclTrack,
  1899.     rclBoundary: RECTL;
  1900.     ptlMinTrackSize,
  1901.     ptlMaxTrackSize: POINTL;
  1902.     fs: USHORT
  1903.   End;
  1904.   pTRACKINFO = ^TRACKINFO;
  1905.  
  1906. Function WinTrackRect(aWnd: HWND; aPS: HPS; pti: PTRACKINFO): BOOL;
  1907. Function WinShowTrackRect(aWnd: HWND; fShow: BOOL): BOOL;
  1908.  
  1909. Const
  1910. { WinTrackRect() flags }
  1911.   TF_LEFT                  = $0001;
  1912.   TF_TOP                   = $0002;
  1913.   TF_RIGHT                 = $0004;
  1914.   TF_BOTTOM                = $0008;
  1915. { TF_MOVE = TF_LEFT | TF_TOP | TF_RIGHT | TF_BOTTOM }
  1916.   TF_MOVE                  = $000F;
  1917.  
  1918.   TF_SETPOINTERPOS         = $0010;
  1919.   TF_GRID                  = $0020;
  1920.   TF_STANDARD              = $0040;
  1921.   TF_ALLINBOUNDARY         = $0080;
  1922.   TF_VALIDATETRACKRECT     = $0100;
  1923.   TF_PARTINBOUNDARY        = $0200;
  1924.  
  1925. {*** Clipboard Manager }
  1926.  
  1927. { Clipboard messages }
  1928.  
  1929.   WM_RENDERFMT             = $0060;
  1930.   WM_RENDERALLFMTS         = $0061;
  1931.   WM_DESTROYCLIPBOARD      = $0062;
  1932.   WM_PAINTCLIPBOARD        = $0063;
  1933.   WM_SIZECLIPBOARD         = $0064;
  1934.   WM_HSCROLLCLIPBOARD      = $0065;
  1935.   WM_VSCROLLCLIPBOARD      = $0066;
  1936.   WM_DRAWCLIPBOARD         = $0067;
  1937.  
  1938. { Standard Clipboard formats }
  1939.  
  1940.   CF_TEXT                  = 1;
  1941.   CF_BITMAP                = 2;
  1942.   CF_DSPTEXT               = 3;
  1943.   CF_DSPBITMAP             = 4;
  1944.   CF_METAFILE              = 5;
  1945.   CF_DSPMETAFILE           = 6;
  1946.  
  1947. Function WinSetClipbrdOwner(aAB: hAB; aWnd: HWND): BOOL;
  1948. Function WinSetClipbrdData(aAB: hAB; ulData: ULONG; fmt, rgfFmtInfo: USHORT): BOOL;
  1949. Function WinQueryClipbrdData(aAB: hAB; fmt: USHORT): ULONG;
  1950. Function WinQueryClipbrdFmtInfo(_hab: HAB; fmt: USHORT; prgfFmtInfo: PUSHORT): BOOL;
  1951. Function WinSetClipbrdViewer(aAB: hAB; WndNewClipViewer: HWND): BOOL;
  1952.  
  1953. Const
  1954. { WinSetClipbrdData() flags }
  1955.  
  1956.   CFI_OWNERFREE            = $0001;
  1957.   CFI_OWNERDISPLAY         = $0002;
  1958.   CFI_SELECTOR             = $0100;
  1959.   CFI_HANDLE               = $0200;
  1960.  
  1961. Function WinEnumClipbrdFmts(aAB: hAB; fmt: USHORT): USHORT;
  1962. Function WinEmptyClipbrd(aAB: hAB): BOOL;
  1963. Function WinOpenClipbrd(aAB: hAB): BOOL;
  1964. Function WinCloseClipbrd(aAB: hAB): BOOL;
  1965. Function WinQueryClipbrdOwner(aAB: hAB; fLock: BOOL): HWND;
  1966. Function WinQueryClipbrdViewer(aAB: hAB; fLock: BOOL): HWND;
  1967.  
  1968. {*** Cursor manager common subsection }
  1969.  
  1970. Function WinDestroyCursor(aWnd: HWND): BOOL;
  1971. Function WinShowCursor(aWnd: HWND; fShow: BOOL): BOOL;
  1972. Function WinCreateCursor(aWnd: HWND; x, y, cx, cy: SHORT; fs: USHORT;
  1973.                          prclClip: PRECTL): BOOL;
  1974.  
  1975. Const
  1976. { WinCreateCursor() flags }
  1977.  
  1978.   CURSOR_SOLID             = $0000;
  1979.   CURSOR_HALFTONE          = $0001;
  1980.   CURSOR_FRAME             = $0002;
  1981.   CURSOR_FLASH             = $0004;
  1982.   CURSOR_SETPOS            = $8000;
  1983.  
  1984. Type
  1985.   CURSORINFO = Record
  1986.     aWnd: HWND;
  1987.     x,
  1988.     y,
  1989.     cx,
  1990.     cy: SHORT;
  1991.     fs: USHORT;
  1992.     rclClip: RECTL
  1993.   End;
  1994.   pCURSORINFO = ^CURSORINFO;
  1995.  
  1996. Function WinQueryCursorInfo(hWndDesktop: HWND; _pCursorInfo: PCURSORINFO): BOOL;
  1997.  
  1998. Type
  1999.   HPOINTER = LHANDLE;
  2000.  
  2001. {*** Pointer manager }
  2002.  
  2003. Function WinSetPointer(hWndDesktop: HWND; hptrNew: HPOINTER): BOOL;
  2004. Function WinShowPointer(hWndDesktop: HWND; fShow: BOOL): BOOL;
  2005. Function WinQuerySysPointer(hWndDesktop: HWND; iptr: SHORT; fLoad: BOOL): HPOINTER;
  2006.  
  2007.  
  2008. { System pointers (NOTE: these are 1-based) }
  2009. Const
  2010.   SPTR_ARROW               =  1;
  2011.   SPTR_TEXT                =  2;
  2012.   SPTR_WAIT                =  3;
  2013.   SPTR_SIZE                =  4;
  2014.   SPTR_MOVE                =  5;
  2015.   SPTR_SIZENWSE            =  6;
  2016.   SPTR_SIZENESW            =  7;
  2017.   SPTR_SIZEWE              =  8;
  2018.   SPTR_SIZENS              =  9;
  2019.   SPTR_APPICON             = 10;
  2020.   SPTR_ICONINFORMATION     = 11;
  2021.   SPTR_ICONQUESTION        = 12;
  2022.   SPTR_ICONERROR           = 13;
  2023.   SPTR_ICONWARNING         = 14;
  2024.   SPTR_ILLEGAL             = 18;
  2025.   SPTR_FILE                = 19;
  2026.   SPTR_FOLDER              = 20;
  2027.   SPTR_MULTFILE            = 21;
  2028.   SPTR_PROGRAM             = 22;
  2029.   SPTR_PENFIRST            = 23;
  2030.   SPTR_PENLAST             = 39;
  2031.   SPTR_CPTR                = 39; {total # of system pointers}
  2032.  
  2033. { backward compatibility }
  2034.   SPTR_HANDICON       = SPTR_ICONERROR;
  2035.   SPTR_QUESICON       = SPTR_ICONQUESTION;
  2036.   SPTR_BANGICON       = SPTR_ICONWARNING;
  2037.   SPTR_NOTEICON       = SPTR_ICONINFORMATION;
  2038.  
  2039. Function WinLoadPointer(hWndDesktop: HWND; hmod: HMODULE; idres: USHORT): HPOINTER;
  2040. Function WinDestroyPointer(hptr: HPOINTER): BOOL;
  2041. Function WinCreatePointer(hwndDesktop: HWND; hbmPointer: HBITMAP;
  2042.                           fPointer: BOOL; xHotspot, yHotspot: SHORT): HPOINTER;
  2043.  
  2044. Function WinQueryPointer(hWndDesktop: HWND): HPOINTER;
  2045. Function WinSetPointerPos(hWndDesktop: HWND; x, y: SHORT): BOOL;
  2046. Function WinQueryPointerPos(hWndDesktop: HWND; pptl: PPOINTL): BOOL;
  2047.  
  2048. Type
  2049.   POINTERINFO = Record
  2050.     fPointer: {$IfDef Use13} SHORT {$Else} ULONG {$EndIf};
  2051.     xHotspot,
  2052.     yHotspot: {$IfDef Use13} SHORT {$Else} LONG {$EndIf};
  2053.     hbmPointer,
  2054.     hbmColor: HBITMAP;
  2055.   {$IfNDef Use13}
  2056.     hbmMiniPointer,
  2057.     hbmMiniColor: HBITMAP
  2058.   {$EndIf}
  2059.   End;
  2060.   pPOINTERINFO = ^POINTERINFO;
  2061.  
  2062. Function WinCreatePointerIndirect(hWndDesktop: HWND; pptri: PPOINTERINFO): HPOINTER;
  2063. Function WinQueryPointerInfo(hptr: HPOINTER; _pPointerInfo: PPOINTERINFO): BOOL;
  2064. Function WinDrawPointer(aPS: HPS; x, y: SHORT; hptr: HPOINTER; fs: USHORT): BOOL;
  2065.  
  2066. Const
  2067. { WinDrawPointer() constants }
  2068.   DP_NORMAL                = $0000;
  2069.   DP_HALFTONED             = $0001;
  2070.   DP_INVERTED              = $0002;
  2071.  
  2072. Function WinGetSysBitmap(hWndDesktop: HWND; ibm: USHORT): HBITMAP;
  2073.  
  2074. Const
  2075. { System bitmaps (NOTE: these are 1-based) }
  2076.   SBMP_OLD_SYSMENU         =  1;
  2077.   SBMP_OLD_SBUPARROW       =  2;
  2078.   SBMP_OLD_SBDNARROW       =  3;
  2079.   SBMP_OLD_SBRGARROW       =  4;
  2080.   SBMP_OLD_SBLFARROW       =  5;
  2081.   SBMP_MENUCHECK           =  6;
  2082.   SBMP_CHECKBOXES          =  7;
  2083.   SBMP_BTNCORNERS          =  8;
  2084.   SBMP_OLD_MINBUTTON       =  9;
  2085.   SBMP_OLD_MAXBUTTON       = 10;
  2086.   SBMP_OLD_RESTOREBUTTON   = 11;
  2087.   SBMP_OLD_CHILDSYSMENU    = 12;
  2088.   SBMP_DRIVE               = 15;
  2089.   SBMP_FILE                = 16;
  2090.   SBMP_FOLDER              = 17;
  2091.   SBMP_TREEPLUS            = 18;
  2092.   SBMP_TREEMINUS           = 19;
  2093.   SBMP_PROGRAM             = 22;
  2094.   SBMP_MENUATTACHED        = 23;
  2095.   SBMP_SIZEBOX             = 24;
  2096.   SBMP_SYSMENU             = 25;
  2097.   SBMP_MINBUTTON           = 26;
  2098.   SBMP_MAXBUTTON           = 27;
  2099.   SBMP_RESTOREBUTTON       = 28;
  2100.   SBMP_CHILDSYSMENU        = 29;
  2101.   SBMP_SYSMENUDEP          = 30;
  2102.   SBMP_MINBUTTONDEP        = 31;
  2103.   SBMP_MAXBUTTONDEP        = 32;
  2104.   SBMP_RESTOREBUTTONDEP    = 33;
  2105.   SBMP_CHILDSYSMENUDEP     = 34;
  2106.   SBMP_SBUPARROW           = 35;
  2107.   SBMP_SBDNARROW           = 36;
  2108.   SBMP_SBLFARROW           = 37;
  2109.   SBMP_SBRGARROW           = 38;
  2110.   SBMP_SBUPARROWDEP        = 39;
  2111.   SBMP_SBDNARROWDEP        = 40;
  2112.   SBMP_SBLFARROWDEP        = 41;
  2113.   SBMP_SBRGARROWDEP        = 42;
  2114.   SBMP_SBUPARROWDIS        = 43;
  2115.   SBMP_SBDNARROWDIS        = 44;
  2116.   SBMP_SBLFARROWDIS        = 45;
  2117.   SBMP_SBRGARROWDIS        = 46;
  2118.   SBMP_COMBODOWN           = 47;
  2119.  
  2120. {*** Hook manager }
  2121.  
  2122. Function WinSetHook(_hab: HAB; _hmq: HMQ; iHook: SHORT; pfnHook: PFN;
  2123.                     hmod: HMODULE): BOOL;
  2124. Function WinReleaseHook(_hab: HAB; _hmq: HMQ; iHook: SHORT; pfnHook: PFN;
  2125.                         hmod: HMODULE): BOOL;
  2126. Function WinCallMsgFilter(aAB: hAB; _pqmsg: PQMSG; msgf: USHORT): BOOL;
  2127.  
  2128.  
  2129. Const
  2130. { Hook codes }
  2131.  
  2132.   HK_SENDMSG               = 0;
  2133.     { VOID EXPENTRY SendMsgHook(HAB hab,               ** installer's hab      **
  2134.                                  PSMHSTRUCT psmh,       ** p send msg struct    **
  2135.                                  BOOL fInterTask);      ** between threads      }
  2136.   HK_INPUT                 = 1;
  2137.     { BOOL EXPENTRY InputHook(HAB hab,                 ** installer's hab      **
  2138.                                PQMSG pQmsg,             ** p qmsg               **
  2139.                                USHORT fs);              ** remove/noremove      }
  2140.   HK_MSGFILTER             = 2;
  2141.     { BOOL EXPENTRY MsgFilterHook(HAB hab,             ** installer's hab      **
  2142.                                    PQMSG pQmsg,         ** p qmsg               **
  2143.                                    USHORT msgf);        ** filter flag          }
  2144.   HK_JOURNALRECORD         = 3;
  2145.     { VOID EXPENTRY JournalRecordHook(HAB hab,         ** installer's hab      **
  2146.                                        PQMSG pQmsg);    ** p qmsg               }
  2147.   HK_JOURNALPLAYBACK       = 4;
  2148.     { ULONG EXPENTRY JournalPlaybackHook(HAB hab,      **installer's hab       **
  2149.                                           BOOL fSkip,   ** skip messages        **
  2150.                                           PQMSG pQmsg); ** p qmsg               }
  2151.   HK_HELP                  = 5;
  2152.     { BOOL EXPENTRY HelpHook(HAB hab,                  ** installer's hab      **
  2153.                               USHORT usMode,            ** mode                 **
  2154.                               USHORT idTopic,           ** main topic           **
  2155.                               USHORT idSubTopic,        ** sub topic            **
  2156.                               PRECTL prcPosition);      ** associated position  }
  2157.  
  2158.   HK_LOADER                = 6;
  2159.     { BOOL EXPENTRY LoaderHook(HAB hab,                ** installer's hab      **
  2160.                                 SHORT idContext,        ** who called hook      **
  2161.                                 PSZ pszLibname,         ** lib name string      **
  2162.                                 PHLIB hlib,             ** p to lib handle      **
  2163.                                 PSZ pszProcname,        ** procedure name       **
  2164.                                 PFNWP wndProc);         ** window procedure     }
  2165.   HK_REGISTERUSERMSG       = 7;
  2166.     { BOOL EXPENTRY RegisterUserHook(HAB hab,          ** installer's hab      **
  2167.                                     ULONG cUshort,      ** entries in arRMP     **
  2168.                                     PUSHORT arRMP,      ** RMP array            **
  2169.                                     PBOOL fRegistered); ** msg parms already reg}
  2170.   HK_MSGCONTROL            = 8;
  2171.     { BOOL EXPENTRY MsgControlHook(HAB hab,            ** installer's hab      **
  2172.                                     SHORT idContext,    ** who called hook      **
  2173.                                     HWND hwnd,          ** SEI window handle    **
  2174.                                     PSZ pszClassname,   ** window class name    **
  2175.                                     USHORT usMsgclass,  ** interested msg class **
  2176.                                     SHORT idControl,    ** SMI_*                **
  2177.                                     PBOOL fSuccess);    ** mode already set     }
  2178.   HK_PLIST_ENTRY           = 9;
  2179.     { BOOL EXPENTRY ProgramListEntryHook(HAB hab,      ** installer's hab      **
  2180.                        PPRFHOOKPARMS pProfileHookParams,** data                 **
  2181.                        PBOOL fNoExecute);               ** cease hook processing}
  2182.   HK_PLIST_EXIT            = 10;
  2183.     { BOOL EXPENTRY ProgramListExitHook(HAB hab,       ** installer's hab      **
  2184.                 PPRFHOOKPARMS pProfileHookParams);      ** data                 }
  2185.   HK_FINDWORD              = 11;
  2186.     { BOOL EXPENTRY FindWordHook(usCodepage,           ** code page to use     **
  2187.                                   PSZ pszText,          ** text to break        **
  2188.                                   ULONG cb,             ** maximum text size    **
  2189.                                   ULONG ich,            ** break 'near' here    **
  2190.                                   PULONG pichStart,     ** where break began    **
  2191.                                   PULONG pichEnd,       ** where break ended    **
  2192.                                   PULONG pichNext);     ** where next word begin}
  2193.   HK_CODEPAGECHANGED       = 12;
  2194.     { VOID EXPENTRY CodePageChangedHook(HMQ hmq,       ** msg q handle         **
  2195.                                   USHORT usOldCodepage, ** old code page        **
  2196.                                   USHORT usNewCodepage);** new code page        }
  2197.  
  2198.   HMQ_CURRENT        = HMQ(1);
  2199.  
  2200. { WH_MSGFILTER context codes }
  2201.  
  2202.   MSGF_DIALOGBOX          = 1;
  2203.   MSGF_MESSAGEBOX         = 2;
  2204.   MSGF_TRACK              = 8;
  2205.  
  2206. { HK_HELP Help modes }
  2207.  
  2208.   HLPM_FRAME             = -1;
  2209.   HLPM_WINDOW            = -2;
  2210.   HLPM_MENU              = -3;
  2211.  
  2212. Type
  2213. { HK_SENDMSG structure }
  2214.  
  2215.   SMHSTRUCT = Record
  2216.     mp2,
  2217.     mp1: MPARAM;
  2218.     msg: USHORT;
  2219.     aWnd: HWND
  2220.   End;
  2221.   pSMHSTRUCT = ^SMHSTRUCT;
  2222.  
  2223. Const
  2224. {HK_LOADER context codes }
  2225.  
  2226.   LHK_DELETEPROC           = 1;
  2227.   LHK_DELETELIB            = 2;
  2228.   LHK_LOADPROC             = 3;
  2229.   LHK_LOADLIB              = 4;
  2230.  
  2231. {HK_MSGCONTROL context codes }
  2232.  
  2233.   MCHK_MSGINTEREST         = 1;
  2234.   MCHK_CLASSMSGINTEREST    = 2;
  2235.   MCHK_SYNCHRONISATION     = 3;
  2236.   MCHK_MSGMODE             = 4;
  2237.  
  2238. {HK_REGISTERUSERMSG conext codes }
  2239.  
  2240.   RUMHK_DATATYPE           = 1;
  2241.   RUMHK_MSG                = 2;
  2242.  
  2243. { Include Shell API }
  2244. Function WinQueryCp(_hmq: HMQ): USHORT;
  2245. Function WinSetCp(_hmq: HMQ; idCodePage: USHORT): BOOL;
  2246. Function WinQueryCpList(aAB: hAB; ccpMax: USHORT; prgcp: PUSHORT): USHORT;
  2247. Function WinCpTranslateString(_hab: HAB; cpSrc: USHORT; pszSrc: PSZ;
  2248.                               cpDst, cchDestMax: USHORT; pchDest: PSZ): BOOL;
  2249. Function WinCpTranslateChar(_hab: HAB; cpSrc: USHORT; chSrc: UCHAR;
  2250.                             cpDst: USHORT): UCHAR;
  2251. Function WinUpper(aAB: hAB; idcp, idcc: USHORT; _psz: PSZ): USHORT;
  2252. Function WinUpperChar(aAB: hAB; idcp, idcc: USHORT; c: USHORT): USHORT;
  2253. Function WinNextChar(aAB: hAB; idcp, idcc: USHORT; _psz: PSZ): PSZ;
  2254. Function WinPrevChar(_hab: HAB; idcp, idcc: USHORT; pszStart, _psz: PSZ): PSZ;
  2255. Function WinCompareStrings(_hab: HAB; idcp, idcc: USHORT; psz1, psz2: PSZ;
  2256.                            reserved: USHORT): USHORT;
  2257. Const
  2258.   WCS_ERROR                = 0;
  2259.   WCS_EQ                   = 1;
  2260.   WCS_LT                   = 2;
  2261.   WCS_GT                   = 3;
  2262.  
  2263. { Heap Manager Interface declarations }
  2264.  
  2265. Type HHEAP = LHANDLE;
  2266.  
  2267. Function WinCreateHeap(
  2268.                        selHeapBase, cbHeap, cbGrow, chMinDed, cbMaxDed, fOptions: USHORT): HHEAP;
  2269. Function WinDestroyHeap(_hHeap: HHEAP): HHEAP;
  2270. Function WinAvailMem(_hHeap: HHEAP; fCompact: BOOL; cbMinFree: USHORT): USHORT;
  2271. Function WinAllocMem(_hHeap: HHEAP; cb: USHORT): NPBYTE;
  2272. Function WinReallocMem(_hHeap: HHEAP; npMem: NPBYTE; cbOld, cbNew: USHORT): NPBYTE;
  2273. Function WinFreeMem(_hHeap: HHEAP; npMem: NPBYTE; cbMem: USHORT): NPBYTE;
  2274. Function WinLockHeap(_hHeap: HHEAP): PVOID;
  2275.  
  2276. Const
  2277.   HM_MOVEABLE              = $0001;     { Parameters to WinCreateHeap }
  2278.   HM_VALIDSIZE             = $0002;
  2279.  
  2280. {** Atom Manager Interface declarations }
  2281.  
  2282. Type
  2283.   HATOMTBL = LHANDLE;
  2284.   ATOM = USHORT;
  2285.  
  2286. Function WinQuerySystemAtomTable: HATOMTBL;
  2287. Function WinCreateAtomTable(cbInitial, cBuckets: USHORT): HATOMTBL;
  2288. Function WinDestroyAtomTable(_hAtomTbl: HATOMTBL): HATOMTBL;
  2289. Function WinAddAtom(_hAtomTbl: HATOMTBL; pszAtomName: PSZ): ATOM;
  2290. Function WinFindAtom(_hAtomTbl: HATOMTBL; pszAtomName: PSZ): ATOM;
  2291. Function WinDeleteAtom(_hAtomTbl: HATOMTBL; _atom: ATOM): ATOM;
  2292. Function WinQueryAtomUsage(_hAtomTbl: HATOMTBL; _atom: ATOM): USHORT;
  2293. Function WinQueryAtomLength(_hAtomTbl: HATOMTBL; _atom: ATOM): USHORT;
  2294. Function WinQueryAtomName(_hAtomTbl: HATOMTBL; _atom: ATOM; pchBuffer: PSZ;
  2295.                           cchBufferMax: USHORT): USHORT;
  2296.  
  2297. Function MakeIntAtom(a: Word): pChar;
  2298.   Inline(PopAx/ $BA/$FFFF {Mov Dx,$FFFF});
  2299.  
  2300. {** Catch/Throw Interface declarations }
  2301. Type
  2302.   CATCHBUF = Record
  2303.     reserved: Array[0..3] Of ULONG
  2304.   End;
  2305.   pCATCHBUF = ^CATCHBUF;
  2306.  
  2307. Function WinCatch(_pcatchbuf: PCATCHBUF): SHORT;
  2308. Procedure WinThrow(_pcatchbuf: PCATCHBUF; nThrowBack: SHORT);
  2309.  
  2310. Const
  2311. { Error codes for debugging support
  2312.   $1001 - $1021, $1034, $1036 - $1060 are reserved}
  2313.  
  2314.   WINDBGaWnd_NOT_DESTROYED          = $1022;
  2315.   WINDBG_HPTR_NOT_DESTROYED         = $1023;
  2316.   WINDBG_HACCEL_NOT_DESTROYED       = $1024;
  2317.   WINDBG_HENUM_NOT_DESTROYED        = $1025;
  2318.   WINDBG_VISRGN_SEM_BUSY            = $1026;
  2319.   WINDBG_USER_SEM_BUSY              = $1027;
  2320.   WINDBG_DC_CACHE_BUSY              = $1028;
  2321.   WINDBG_HOOK_STILL_INSTALLED       = $1029;
  2322.   WINDBG_WINDOW_STILL_LOCKED        = $102a;
  2323.   WINDBG_UPDATEPS_ASSERTION_FAIL    = $102b;
  2324.   WINDBG_SENDMSG_WITHIN_USER_SEM    = $102c;
  2325.   WINDBG_USER_SEM_NOT_ENTERED       = $102d;
  2326.   WINDBG_PROC_NOT_EXPORTED          = $102e;
  2327.   WINDBG_BAD_SENDMSGaWnd           = $102f;
  2328.   WINDBG_ABNORMAL_EXIT              = $1030;
  2329.   WINDBG_INTERNAL_REVISION          = $1031;
  2330.   WINDBG_INITSYSTEM_FAILED          = $1032;
  2331.   WINDBG_HATOMTBL_NOT_DESTROYED     = $1033;
  2332.   WINDBG_WINDOW_UNLOCK_WAIT         = $1035;
  2333.  
  2334. { Get/Set Error Information Interface declarations }
  2335.  
  2336. Type
  2337.   ERRINFO = Record
  2338.     cbFixedErrInfo: USHORT;
  2339.     idError: ERRORID;
  2340.     cDetailLevel,
  2341.     offaoffszMsg,
  2342.     offBinaryData: USHORT
  2343.   End;
  2344.   pERRINFO = ^ERRINFO;
  2345.  
  2346. Function WinGetLastError(aAB: hAB): ERRORID;
  2347. Function WinGetErrorInfo(aAB: hAB): PERRINFO;
  2348. Function WinFreeErrorInfo(_perrinfo: PERRINFO): BOOL;
  2349.  
  2350. { include SetErrorInfo }
  2351. {.....$I pmsei.h}
  2352.  
  2353. { Dynamic Data Exchange (DDE) Structure Declaration }
  2354.  
  2355. Type
  2356.   DDEINIT = Record
  2357.     cb: USHORT;
  2358.     pszAppName,
  2359.     pszTopic: pSZ
  2360.   End;
  2361.   pDDEINIT = ^DDEINIT;
  2362.  
  2363.   DDESTRUCT = Record
  2364.     cbData: ULONG;
  2365.     fsStatus,
  2366.     fsFormat,
  2367.     offszItemName,
  2368.     offabData: USHORT
  2369.   End;
  2370.   pDDESTRUCT = ^DDESTRUCT;
  2371.  
  2372. Const
  2373. { DDE constants for wStatus field }
  2374.   DDE_FACK                 = $0001;
  2375.   DDE_FBUSY                = $0002;
  2376.   DDE_FNODATA              = $0004;
  2377.   DDE_FACKREQ              = $0008;
  2378.   DDE_FRESPONSE            = $0010;
  2379.   DDE_NOTPROCESSED         = $0020;
  2380.   DDE_FRESERVED            = $00C0;
  2381.   DDE_FAPPSTATUS           = $FF00;
  2382.  
  2383. { DDE public formats }
  2384.  
  2385.   DDEFMT_TEXT              = $0001;
  2386.  
  2387. { Dynamic Data Exchange (DDE) Routines }
  2388.  
  2389. Function WinDdeInitiate(hwndClient: HWND; pszAppName, pszTopicName: PSZ): BOOL;
  2390. Function WinDdeRespond(hwndClient, hwndServer: HWND;
  2391.                        pszAppName, pszTopicName: PSZ): MRESULT;
  2392. Function WinDdePostMsg(hwndTo, hwndFrom: HWND; wm: USHORT; pddeSt: PDDESTRUCT;
  2393.                        fRetry: BOOL): BOOL;
  2394.  
  2395. Const
  2396. { Dynamic Data Exchange (DDE) Messages }
  2397.  
  2398.   WM_DDE_FIRST             = $00A0;
  2399.   WM_DDE_INITIATE          = $00A0;
  2400.   WM_DDE_REQUEST           = $00A1;
  2401.   WM_DDE_ACK               = $00A2;
  2402.   WM_DDE_DATA              = $00A3;
  2403.   WM_DDE_ADVISE            = $00A4;
  2404.   WM_DDE_UNADVISE          = $00A5;
  2405.   WM_DDE_POKE              = $00A6;
  2406.   WM_DDE_EXECUTE           = $00A7;
  2407.   WM_DDE_TERMINATE         = $00A8;
  2408.   WM_DDE_INITIATEACK       = $00A9;
  2409.   WM_DDE_LAST              = $00AF;
  2410.  
  2411. { DDE helper macros }
  2412.  
  2413.   Function DDES_pszItemName(pddes: pDDESTRUCT): pSZ;
  2414.     Inline(PopDx/PopAx/
  2415.            $8E/$C2     {Mov Es,Dx} /$89/$C7 {Mov Di,Ax}/
  2416.            $83/$C7/8   {Add Di,4+2+2}/
  2417.            $26/$03/$05 {Add Ax,Es:[Di]});
  2418.  
  2419.   Function DDES_PABDATA (pddes: pDDESTRUCT): pBYTE;
  2420.     Inline(PopDx/PopAx/
  2421.            $8E/$C2     {Mov Es,Dx} /$89/$C7 {Mov Di,Ax}/
  2422.            $83/$C7/10  {Add Di,4+2+2+2}/
  2423.            $26/$03/$05 {Add Ax,Es:[Di]});
  2424.  
  2425.   Function SelTopDDES (Sel: Word): pDDESTRUCT;
  2426.     Inline(PopDx/ $31/$C0 {Xor Ax,Ax});
  2427.   Function pDDEStoSel(pddes: pDDESTRUCT): Word;
  2428.     Inline(PopDx/PopAx);
  2429.   Function pDDEItoSel(pddes: pDDEINIT): Word;
  2430.     Inline(PopDx/PopAx);
  2431.  
  2432. Const
  2433.   WM_QUERYCONVERTPOS       = $00b0;
  2434.  
  2435. { Return values for WM_QUERYCONVERTPOS }
  2436.   QCP_CONVERT              = $0001;
  2437.   QCP_NOCONVERT            = $0000;
  2438.  
  2439. {Load/Delete Library/Procedure }
  2440.  
  2441. Type
  2442.   HLIB =  HMODULE;
  2443.   pHLIB = pHMODULE;
  2444.  
  2445. Function WinDeleteProcedure(aAB: hAB; wndproc: PFNWP): BOOL;
  2446. Function WinDeleteLibrary(aAB: hAB; libhandle: HLIB): BOOL;
  2447. Function WinLoadProcedure(aAB: hAB; libhandle: HLIB; procname: PSZ): PFNWP;
  2448. Function WinLoadLibrary(aAB: hAB; libname: PSZ): HLIB;
  2449.  
  2450. Const
  2451.   STR_DLLNAME              = 'keyremap';
  2452.   WM_DBCSFIRST             = $00b0;
  2453.   WM_DBCSLAST              = $00cf;
  2454.   WC_APPSTAT               = pChar($ffff0010);
  2455.   WC_KBDSTAT               = pChar($ffff0011);
  2456.   WC_PECIC                 = pChar($ffff0012);
  2457.   WC_DBE_KKPOPUP           = pChar($ffff0013);
  2458.  
  2459. Implementation
  2460.  
  2461. Function WinRegisterClass;               External 'PMWIN' Index   3;
  2462. Function WinDefWindowProc;               External 'PMWIN' Index 178;
  2463. Function WinDestroyWindow;               External 'PMWIN' Index   7;
  2464. Function WinShowWindow;                  External 'PMWIN' Index  13;
  2465. Function WinQueryWindowRect;             External 'PMWIN' Index  26;
  2466. Function WinGetPS;                       External 'PMWIN' Index  43;
  2467. Function WinReleasePS;                   External 'PMWIN' Index  44;
  2468. Function WinEndPaint;                    External 'PMWIN' Index  46;
  2469. Function WinGetClipPS;                   External 'PMWIN' Index 279;
  2470. Function WinIsWindowShowing;             External 'PMWIN' Index 614;
  2471. Function WinBeginPaint;                  External 'PMWIN' Index  45;
  2472. Function WinOpenWindowDC;                External 'PMWIN' Index  41;
  2473. Function WinScrollWindow;                External 'PMWIN' Index 153;
  2474. Function WinFillRect;                    External 'PMWIN' Index 173;
  2475. Function WinQueryVersion;                External 'PMWIN' Index 250;
  2476. Function WinInitialize;                  External 'PMWIN' Index 246;
  2477. Function WinTerminate;                   External 'PMWIN' Index 247;
  2478. Function WinQueryAnchorBlock;            External 'PMWIN' Index 609;
  2479. Function WinCreateWindow;                External 'PMWIN' Index   6;
  2480. Function WinEnableWindow;                External 'PMWIN' Index  11;
  2481. Function WinIsWindowEnabled;             External 'PMWIN' Index  12;
  2482. Function WinEnableWindowUpdate;          External 'PMWIN' Index  14;
  2483. Function WinIsWindowVisible;             External 'PMWIN' Index  15;
  2484. Function WinQueryWindowText;             External 'PMWIN' Index  17;
  2485. Function WinSetWindowText;               External 'PMWIN' Index  16;
  2486. Function WinQueryWindowTextLength;       External 'PMWIN' Index  18;
  2487. Function WinWindowFromID;                External 'PMWIN' Index  19;
  2488. Function WinIsWindow;                    External 'PMWIN' Index  21;
  2489. Function WinQueryWindow;                 External 'PMWIN' Index  25;
  2490. Function WinMultWindowFromIDs;           External 'PMWIN' Index  20;
  2491. Function WinSetParent;                   External 'PMWIN' Index  23;
  2492. Function WinIsChild;                     External 'PMWIN' Index  22;
  2493. Function WinSetOwner;                    External 'PMWIN' Index  24;
  2494. Function WinQueryWindowProcess;          External 'PMWIN' Index  27;
  2495. Function WinQueryObjectWindow;           External 'PMWIN' Index   2;
  2496. Function WinQueryDesktopWindow;          External 'PMWIN' Index   1;
  2497. Function WinSetWindowPos;                External 'PMWIN' Index   8;
  2498. Function WinQueryWindowPos;              External 'PMWIN' Index  10;
  2499. Function WinSetMultWindowPos;            External 'PMWIN' Index   9;
  2500. Function WinUpdateWindow;                External 'PMWIN' Index  53;
  2501. Function WinInvalidateRect;              External 'PMWIN' Index  47;
  2502. Function WinInvalidateRegion;            External 'PMWIN' Index  48;
  2503. Function WinInvertRect;                  External 'PMWIN' Index 172;
  2504. Function WinDrawBitmap;                  External 'PMWIN' Index 268;
  2505. Function WinDrawText;                    External 'PMWIN' Index 267;
  2506. Function WinDrawBorder;                  External 'PMWIN' Index 266;
  2507. Function WinLoadString;                  External 'PMWIN' Index 157;
  2508. Function WinLoadMessage;                 External 'PMWIN' Index 158;
  2509. Function WinSetActiveWindow;             External 'PMWIN' Index  79;
  2510. Function WinSubclassWindow;              External 'PMWIN' Index  37;
  2511. Function WinQueryClassName;              External 'PMWIN' Index   4;
  2512. Function WinQueryClassInfo;              External 'PMWIN' Index   5;
  2513. Function WinQueryActiveWindow;           External 'PMWIN' Index  80;
  2514. Function WinIsThreadActive;              External 'PMWIN' Index  83;
  2515. Function WinQuerySysModalWindow;         External 'PMWIN' Index  82;
  2516. Function WinLockWindow;                  External 'PMWIN' Index  38;
  2517. Function WinRegisterWindowDestroy;       External 'PMWIN' Index  40;
  2518. Function WinSetSysModalWindow;           External 'PMWIN' Index  81;
  2519. Function WinQueryWindowLockCount;        External 'PMWIN' Index  39;
  2520. Function WinQueryWindowUShort;           External 'PMWIN' Index  29;
  2521. Function WinSetWindowUShort;             External 'PMWIN' Index  28;
  2522. Function WinQueryWindowULong;            External 'PMWIN' Index  31;
  2523. Function WinSetWindowULong;              External 'PMWIN' Index  30;
  2524. Function WinQueryWindowPtr;              External 'PMWIN' Index 269;
  2525. Function WinSetWindowPtr;                External 'PMWIN' Index 270;
  2526. Function WinSetWindowBits;               External 'PMWIN' Index 278;
  2527. Function WinBeginEnumWindows;            External 'PMWIN' Index  32;
  2528. Function WinGetNextWindow;               External 'PMWIN' Index  33;
  2529. Function WinEndEnumWindows;              External 'PMWIN' Index  34;
  2530. Function WinWindowFromPoint;             External 'PMWIN' Index  35;
  2531. Function WinMapWindowPoints;             External 'PMWIN' Index  36;
  2532. Function WinValidateRect;                External 'PMWIN' Index  49;
  2533. Function WinValidateRegion;              External 'PMWIN' Index  50;
  2534. Function WinWindowFromDC;                External 'PMWIN' Index  57;
  2535. Function WinQueryWindowDC;               External 'PMWIN' Index 265;
  2536. Function WinGetScreenPS;                 External 'PMWIN' Index  42;
  2537. Function WinLockWindowUpdate;            External 'PMWIN' Index  55;
  2538. Function WinLockVisRegions;              External 'PMWIN' Index  56;
  2539. Function WinQueryUpdateRect;             External 'PMWIN' Index  51;
  2540. Function WinQueryUpdateRegion;           External 'PMWIN' Index  52;
  2541. Function WinExcludeUpdateRegion;         External 'PMWIN' Index  54;
  2542. Function WinSendMsg;                     External 'PMWIN' Index  61;
  2543. Function WinCreateMsgQueue;              External 'PMWIN' Index  58;
  2544. Function WinDestroyMsgQueue;             External 'PMWIN' Index  59;
  2545. Function WinQueryQueueInfo;              External 'PMWIN' Index 287;
  2546. Function WinCancelShutdown;              External 'PMWIN' Index 277;
  2547. Function WinGetMsg;                      External 'PMWIN' Index  65;
  2548. Function WinPeekMsg;                     External 'PMWIN' Index  66;
  2549. Function WinDispatchMsg;                 External 'PMWIN' Index  68;
  2550. Function WinPostMsg;                     External 'PMWIN' Index  69;
  2551. Function WinRegisterUserMsg;             External 'PMWIN' Index 608;
  2552. Function WinRegisterUserDatatype;        External 'PMWIN' Index 612;
  2553. Function WinSetMsgMode;                  External 'PMWIN' Index 605;
  2554. Function WinSetSynchroMode;              External 'PMWIN' Index 606;
  2555. Function WinInSendMsg;                   External 'PMWIN' Index  64;
  2556. Function WinBroadcastMsg;                External 'PMWIN' Index  63;
  2557. Function WinWaitMsg;                     External 'PMWIN' Index  67;
  2558. Function WinQueryQueueStatus;            External 'PMWIN' Index  60;
  2559. Function WinQueryMsgPos;                 External 'PMWIN' Index  71;
  2560. Function WinQueryMsgTime;                External 'PMWIN' Index  72;
  2561. Function WinMsgSemWait;                  External 'PMWIN' Index 274;
  2562. Function WinMsgMuxSemWait;               External 'PMWIN' Index 275;
  2563. Function WinPostQueueMsg;                External 'PMWIN' Index  70;
  2564. Function WinSetMsgInterest;              External 'PMWIN' Index  74;
  2565. Function WinSetClassMsgInterest;         External 'PMWIN' Index 292;
  2566. Function WinSetFocus;                    External 'PMWIN' Index  77;
  2567. Function WinFocusChange;                 External 'PMWIN' Index 286;
  2568. Function WinSetCapture;                  External 'PMWIN' Index  75;
  2569. Function WinQueryCapture;                External 'PMWIN' Index  76;
  2570. Function WinQueryFocus;                  External 'PMWIN' Index  78;
  2571. Function WinGetKeyState;                 External 'PMWIN' Index 211;
  2572. Function WinGetPhysKeyState;             External 'PMWIN' Index 212;
  2573. Function WinEnablePhysInput;             External 'PMWIN' Index 214;
  2574. Function WinIsPhysInputEnabled;          External 'PMWIN' Index 264;
  2575. Function WinSetKeyboardStateTable;       External 'PMWIN' Index 213;
  2576. Function WinGetDlgMsg;                   External 'PMWIN' Index 607;
  2577. Function WinLoadDlg;                     External 'PMWIN' Index 122;
  2578. Function WinDlgBox;                      External 'PMWIN' Index 125;
  2579. Function WinDismissDlg;                  External 'PMWIN' Index 126;
  2580. Function WinQueryDlgItemShort;           External 'PMWIN' Index 129;
  2581. Function WinSetDlgItemShort;             External 'PMWIN' Index 128;
  2582. Function WinSetDlgItemText;              External 'PMWIN' Index 134;
  2583. Function WinQueryDlgItemText;            External 'PMWIN' Index 135;
  2584. Function WinQueryDlgItemTextLength;      External 'PMWIN' Index 294;
  2585. Function WinDefDlgProc;                  External 'PMWIN' Index 179;
  2586. Function WinAlarm;                       External 'PMWIN' Index 138;
  2587. Function WinMessageBox;                  External 'PMWIN' Index 139;
  2588. Function WinProcessDlg;                  External 'PMWIN' Index 124;
  2589. {Function WinStartDlg;                    External 'PMWIN' Index    ;}
  2590. Function WinStartDlg; Begin End; {UNRESOLVED}
  2591. Function WinSendDlgItemMsg;              External 'PMWIN' Index 127;
  2592. Function WinMapDlgPoints;                External 'PMWIN' Index 130;
  2593. Function WinEnumDlgItem;                 External 'PMWIN' Index 133;
  2594. Function WinSubstituteStrings;           External 'PMWIN' Index 132;
  2595. Function WinCreateDlg;                   External 'PMWIN' Index 123;
  2596. Function WinLoadMenu;                    External 'PMWIN' Index 136;
  2597. Function WinCreateMenu;                  External 'PMWIN' Index 137;
  2598. Function WinCreateStdWindow;             External 'PMWIN' Index 140;
  2599. Function WinFlashWindow;                 External 'PMWIN' Index 144;
  2600. Function WinCreateFrameControls;         External 'PMWIN' Index 141;
  2601. Function WinCalcFrameRect;               External 'PMWIN' Index 143;
  2602. Function WinGetMinPosition;              External 'PMWIN' Index 146;
  2603. Function WinGetMaxPosition;              External 'PMWIN' Index 147;
  2604. Function WinCopyRect;                    External 'PMWIN' Index 161;
  2605. Function WinSetRect;                     External 'PMWIN' Index 160;
  2606. Function WinIsRectEmpty;                 External 'PMWIN' Index 162;
  2607. Function WinEqualRect;                   External 'PMWIN' Index 163;
  2608. Function WinSetRectEmpty;                External 'PMWIN' Index 159;
  2609. Function WinOffsetRect;                  External 'PMWIN' Index 165;
  2610. Function WinInflateRect;                 External 'PMWIN' Index 166;
  2611. Function WinPtInRect;                    External 'PMWIN' Index 164;
  2612. Function WinIntersectRect;               External 'PMWIN' Index 167;
  2613. Function WinUnionRect;                   External 'PMWIN' Index 168;
  2614. Function WinSubtractRect;                External 'PMWIN' Index 169;
  2615. Function WinMakeRect;                    External 'PMWIN' Index 170;
  2616. Function WinMakePoints;                  External 'PMWIN' Index 171;
  2617. Function WinQuerySysValue;               External 'PMWIN' Index 149;
  2618. Function WinSetSysValue;                 External 'PMWIN' Index 150;
  2619. Function WinSetPresParam;                External 'PMWIN' Index 301;
  2620. Function WinQueryPresParam;              External 'PMWIN' Index 302;
  2621. Function WinRemovePresParam;             External 'PMWIN' Index 303;
  2622. Function WinQuerySysColor;               External 'PMWIN' Index 152;
  2623. Function WinSetSysColors;                External 'PMWIN' Index 151;
  2624. Function WinStartTimer;                  External 'PMWIN' Index  84;
  2625. Function WinStopTimer;                   External 'PMWIN' Index  85;
  2626. Function WinGetCurrentTime;              External 'PMWIN' Index  86;
  2627. Function WinLoadAccelTable;              External 'PMWIN' Index 102;
  2628. Function WinCreateAccelTable;            External 'PMWIN' Index 103;
  2629. Function WinDestroyAccelTable;           External 'PMWIN' Index 104;
  2630. Function WinCopyAccelTable;              External 'PMWIN' Index 108;
  2631. Function WinTranslateAccel;              External 'PMWIN' Index 105;
  2632. Function WinSetAccelTable;               External 'PMWIN' Index 106;
  2633. Function WinQueryAccelTable;             External 'PMWIN' Index 107;
  2634. Function WinTrackRect;                   External 'PMWIN' Index 154;
  2635. Function WinShowTrackRect;               External 'PMWIN' Index 155;
  2636. Function WinSetClipbrdOwner;             External 'PMWIN' Index 114;
  2637. Function WinSetClipbrdData;              External 'PMWIN' Index 116;
  2638. Function WinQueryClipbrdData;            External 'PMWIN' Index 117;
  2639. Function WinQueryClipbrdFmtInfo;         External 'PMWIN' Index 119;
  2640. Function WinSetClipbrdViewer;            External 'PMWIN' Index 120;
  2641. Function WinEnumClipbrdFmts;             External 'PMWIN' Index 118;
  2642. Function WinEmptyClipbrd;                External 'PMWIN' Index 113;
  2643. Function WinOpenClipbrd;                 External 'PMWIN' Index 111;
  2644. Function WinCloseClipbrd;                External 'PMWIN' Index 112;
  2645. Function WinQueryClipbrdOwner;           External 'PMWIN' Index 115;
  2646. Function WinQueryClipbrdViewer;          External 'PMWIN' Index 121;
  2647. Function WinDestroyCursor;               External 'PMWIN' Index  99;
  2648. Function WinShowCursor;                  External 'PMWIN' Index 100;
  2649. Function WinCreateCursor;                External 'PMWIN' Index  98;
  2650. Function WinQueryCursorInfo;             External 'PMWIN' Index 101;
  2651. Function WinSetPointer;                  External 'PMWIN' Index  92;
  2652. Function WinShowPointer;                 External 'PMWIN' Index  94;
  2653. Function WinQuerySysPointer;             External 'PMWIN' Index  91;
  2654. Function WinLoadPointer;                 External 'PMWIN' Index  87;
  2655. Function WinDestroyPointer;              External 'PMWIN' Index  89;
  2656. Function WinCreatePointer;               External 'PMWIN' Index  88;
  2657. Function WinQueryPointer;                External 'PMWIN' Index  93;
  2658. Function WinSetPointerPos;               External 'PMWIN' Index  95;
  2659. Function WinQueryPointerPos;             External 'PMWIN' Index  96;
  2660. Function WinCreatePointerIndirect;       External 'PMWIN' Index 616;
  2661. Function WinQueryPointerInfo;            External 'PMWIN' Index 617;
  2662. Function WinDrawPointer;                 External 'PMWIN' Index 177;
  2663. Function WinGetSysBitmap;                External 'PMWIN' Index  97;
  2664. Function WinSetHook;                     External 'PMWIN' Index 109;
  2665. Function WinReleaseHook;                 External 'PMWIN' Index 110;
  2666. Function WinCallMsgFilter;               External 'PMWIN' Index  73;
  2667. Function WinQueryCp;                     External 'PMWIN' Index 216;
  2668. Function WinSetCp;                       External 'PMWIN' Index 215;
  2669. Function WinQueryCpList;                 External 'PMWIN' Index 217;
  2670. Function WinCpTranslateString;           External 'PMWIN' Index 218;
  2671. Function WinCpTranslateChar;             External 'PMWIN' Index 219;
  2672. Function WinUpper;                       External 'PMWIN' Index 221;
  2673. Function WinUpperChar;                   External 'PMWIN' Index 222;
  2674. Function WinNextChar;                    External 'PMWIN' Index 223;
  2675. Function WinPrevChar;                    External 'PMWIN' Index 224;
  2676. Function WinCompareStrings;              External 'PMWIN' Index 220;
  2677. Function WinCreateHeap;                  External 'PMWIN' Index 225;
  2678. Function WinDestroyHeap;                 External 'PMWIN' Index 226;
  2679. Function WinAvailMem;                    External 'PMWIN' Index 227;
  2680. Function WinAllocMem;                    External 'PMWIN' Index 228;
  2681. Function WinReallocMem;                  External 'PMWIN' Index 229;
  2682. Function WinFreeMem;                     External 'PMWIN' Index 230;
  2683. Function WinLockHeap;                    External 'PMWIN' Index 231;
  2684. Function WinQuerySystemAtomTable;        External 'PMWIN' Index 241;
  2685. Function WinCreateAtomTable;             External 'PMWIN' Index 233;
  2686. Function WinDestroyAtomTable;            External 'PMWIN' Index 234;
  2687. Function WinAddAtom;                     External 'PMWIN' Index 235;
  2688. Function WinFindAtom;                    External 'PMWIN' Index 236;
  2689. Function WinDeleteAtom;                  External 'PMWIN' Index 237;
  2690. Function WinQueryAtomUsage;              External 'PMWIN' Index 238;
  2691. Function WinQueryAtomLength;             External 'PMWIN' Index 239;
  2692. Function WinQueryAtomName;               External 'PMWIN' Index 240;
  2693. Function WinCatch;                       External 'PMWIN' Index 248;
  2694. Procedure WinThrow;                      External 'PMWIN' Index 249;
  2695. Function WinGetLastError;                External 'PMWIN' Index 243;
  2696. Function WinGetErrorInfo;                External 'PMWIN' Index 244;
  2697. Function WinFreeErrorInfo;               External 'PMWIN' Index 245;
  2698. Function WinDdeInitiate;                 External 'PMWIN' Index 297;
  2699. Function WinDdeRespond;                  External 'PMWIN' Index 298;
  2700. Function WinDdePostMsg;                  External 'PMWIN' Index 299;
  2701. Function WinDeleteProcedure;             External 'PMWIN' Index 604;
  2702. Function WinDeleteLibrary;               External 'PMWIN' Index 602;
  2703. Function WinLoadProcedure;               External 'PMWIN' Index 603;
  2704. Function WinLoadLibrary;                 External 'PMWIN' Index 615;
  2705.  
  2706. End.
  2707.