home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Graphics / Graphics.zip / os2apipm.zip / OS2API / OS2-PMHK.ADS < prev    next >
Text File  |  1996-08-10  |  10KB  |  220 lines

  1.  
  2. -- ╔═══════════════════════════════════════════════════════════════════╗
  3. -- ║       D E S I G N   E N G I N E R I N G              ║D║S║        ║
  4. -- ║            S O F T W A R E                           ╚═╩═╝        ║
  5. -- ║                                                                   ║
  6. -- ║        Package     Os2.PM                                         ║
  7. -- ║                                                                   ║
  8. -- ║        Author :  Leonid Dulman     1995                           ║
  9. -- ║                                                                   ║
  10. -- ║             GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS            ║
  11. -- ║                                                                   ║
  12. -- ║               PM        Hook manager                              ║
  13. -- ║                                                                   ║
  14. -- ╚═══════════════════════════════════════════════════════════════════╝
  15.  
  16.  
  17. with Interfaces.C;         use Interfaces.C;
  18. with Interfaces.C.Strings; use Interfaces.C.Strings;
  19.  
  20. package Os2.PMhk is
  21. pragma Preelaborate (PMhk);
  22. --
  23. --  Hook manager
  24.  
  25. function WinSetHook(ha     :HAB     ;
  26.                     hm     :HMQ     ;
  27.                     iHook  :LONG    ;
  28.                     pfnHook:PFN     ;
  29.                     hmod   :HMODULE )return BOOL32;
  30. pragma Import(c,WinSetHook, Link_name=>"_WinSetHook");
  31.  
  32. function WinReleaseHook(ha     :HAB     ;
  33.                         hm     :HMQ     ;
  34.                         iHook  :LONG    ;
  35.                         pfnHook:PFN     ;
  36.                         hmod   :HMODULE )return BOOL32;
  37. pragma Import(c,WinReleaseHook, Link_name=>"_WinReleaseHook");
  38.  
  39. function WinCallMsgFilter(ha   :HAB   ;
  40.                           pqms :PQMSG ;
  41.                           msgf :ULONG )return BOOL32;
  42. pragma Import(c,WinCallMsgFilter, Link_name=>"_WinCallMsgFilter");
  43.  
  44. --          Hook codes
  45. --
  46. --   Whether the hook receives a ( U)SHORT or ( U)LONG parameter depends
  47. --   on the memory model that the hook executes in. 32-bit hook will
  48. --   receive long parameters
  49.  
  50. --        procedure  SendMsgHook(:HAB ha ;       --installer's hab
  51. --                                 PSMHSTRUCT psmh;   --p send msg struct
  52. --                               :BOOL32 fInterTask);      *--between threads
  53. --
  54. --        #define HK_INPUT                   1
  55. --        function InputHook(:HAB ha ;                 *--installer's hab
  56. --                            PQMSG pQmsg;             *--p qmsg
  57. --                            :ULONG/USHORT fs)return BOOL32;        *--remove/noremove
  58. --
  59. --        HK_MSGFILTER :constant Long:=    2 ;
  60. --        function MsgFilterHook(:HAB ha ;             *--installer's hab
  61. --                                 PQMSG pQmsg;         *--p qmsg
  62. --                                 :ULONG/USHORT msgf)return BOOL32;  *--filter flag
  63. --
  64. --         HK_JOURNALRECORD           3
  65. --        procedure JournalRecordHook(:HAB ha ;         *--installer's hab
  66. --                               PQMSG pQmsg) ;    *--p qmsg
  67. --
  68. --         HK_JOURNALPLAYBACK         4
  69. --        function JournalPlaybackHook(:HAB ha ;      **installer's hab
  70. --                               :BOOL32 fSkip;   *--skip messages
  71. --                                PQMSG pQmsg)return Ulong; *--p qmsg
  72. --
  73. --         HK_HELP                    5
  74. --        function HelpHook(:HAB ha ;                  *--installer's hab
  75. --                          :ULONG/USHORT usMode;      *--mode
  76. --                          :ULONG/USHORT idTopic;     *--main topic
  77. --                          :ULONG/USHORT idSubTopic;  *--sub topic
  78. --                         :PRECTL prcPosition)return BOOL32;      *--associated position
  79. --
  80. --         HK_LOADER                  6
  81. --        function LoaderHook(:HAB ha ;                *--installer's hab
  82. --                        :LONG/USHORT idContext;  *--who called hook
  83. --                         PSZ pszLibname;         *--lib name string
  84. --                         PHLIB hlib;             *--p to lib handle
  85. --                         PSZ pszProcname;        *--procedure name
  86. --                        :PFNWP wndProc)return BOOL32;         *--window procedure
  87. --
  88. --         HK_REGISTERUSERMSG         7
  89. --       function RegisterUserHook(:HAB ha ;          *--installer's hab
  90. --                           :ULONG cUshort;    *--entries in arRMP
  91. --                            PULONG/PUSHORT arRMP; *--RMP array
  92. --                           PBOOL fRegistered)return BOOL32; *--msg parms already reg
  93. --
  94. --         HK_MSGCONTROL              8
  95. --       function MsgControlHook(:HAB ha ;            *--installer's hab
  96. --                           :LONG/SHORT idContext;*--who called hook
  97. --                           :HWND hwn ;          *--SEI window handle
  98. --                           PSZ pszClassname;   *--window class name
  99. --                          :ULONG/USHORT usMsgclass;*--interested msg class *--
  100. --                          :LONG/SHORT idControl;*--SMI_--
  101. --                           PBOOL fSuccess)return BOOL32;    *--mode already set
  102. --
  103. --         HK_PLIST_ENTRY             9
  104. --        function ProgramListEntryHook(:HAB ha ;      *--installer's hab
  105. --                              PPRFHOOKPARMS pProfileHookParams;*--data
  106. --                              PBOOL fNoExecute)return BOOL32;  *--cease hook processing
  107. --
  108. --         HK_PLIST_EXIT              10
  109. --        function ProgramListExitHook(:HAB ha ;       *--installer's hab
  110. --                           PPRFHOOKPARMS pProfileHookParams)return BOOL32;*--data
  111. --
  112. --         HK_FINDWORD                11
  113. --        function FindWordHook( usCodepage;           *--code page to use
  114. --                           PSZ pszText;          *--text to break
  115. --                          :ULONG cb;             *--maximum text size
  116. --                         :ULONG ich;            *--break 'near' here
  117. --                          PULONG pichStart;     *--where break began
  118. --                          PULONG pichEnd;       *--where break ended
  119. --                          PULONG pichNext)return BOOL32;     *--where next word begin
  120. --
  121. --         HK_CODEPAGECHANGED         12
  122. --        procedure CodePageChangedHook( HMQ hmq;       *--msg q handle
  123. --                       :ULONG/USHORT usOldCodepage; *--old code page
  124. --                       :ULONG/USHORT usNewCodepage) ;--new code page
  125. --
  126. --         HK_WINDOWDC                15
  127. --        function WindowDCHook(:HAB  ha ;             *--installer's hab
  128. --                        HDC  hdc;             *--current hdc
  129. --                        :HWND hwn ;            *--current hwn
  130. --                        BOOL)return BOOL32;                *--association flag
  131. --
  132. --         HK_DESTROYWINDOW           16
  133. --        function DestroyWindowHook (:HAB  ha ;       *--installer's hab
  134. --                             :HWND hwn ;      *--destroyed win hwn
  135. --                             :ULONG Reserved)return BOOL32;*--association flag
  136. --
  137. --         HK_CHECKMSGFILTER          20
  138. --        function CheckMsgFilteHook (:HAB  ha ;       *--installer's hab
  139. --                                PQMSG pQmsg;    *--p qmsg
  140. --                               :ULONG/USHORT usFirst;  *--first msg
  141. --                               :ULONG/USHORT usLast;   *--last msg
  142. --                               :ULONG/USHORT fOptions)return BOOL32;*--flags
  143. --
  144. --         HK_MSGINPUT                21
  145. --        function MsgInputHook (:HAB  ha ;          *--installer's hab
  146. --                       PQMSG pQmsg;       *--p qmsg
  147. --                      :BOOL32 fSkip;        *--skip msg
  148. --                      PBOOL pfNoRecord)return BOOL32; *--journal record event
  149. --
  150. --         HK_LOCKUP                  23
  151. --        function LockupHook (:HAB  ha ;              *--installer's hab
  152. --                       :HWND hwn LockupFrame)return BOOL32; *--hwnd
  153. --
  154. --         HK_FLUSHBUF                24
  155. --        function FlushBufHook (:HAB  hab)return BOOL32;           *--installer's hab
  156.  
  157. --        Current message queue constant
  158. --         HMQ_CURRENT          ( ( HMQ)1)
  159. --
  160. --        WH_MSGFILTER context codes
  161. --         MSGF_DIALOGBOX             1
  162. --         MSGF_MESSAGEBOX            2
  163. --         MSGF_TRACK                 8
  164. --         MSGF_DDEPOSTMSG            3
  165. --
  166. --        HK_HELP Help modes
  167. --         HLPM_FRAME              ( -1)
  168. --         HLPM_WINDOW             ( -2)
  169. --         HLPM_MENU               ( -3)
  170. --
  171. --        HK_SENDMSG structure
  172. --         PM_MODEL_1X      0
  173. --         PM_MODEL_2X      1
  174.  
  175. type SMHSTRUCT   is record     -- smhs
  176.    mp2       :MPARAM ;
  177.    mp1       :MPARAM ;
  178.    msg       :ULONG  ;
  179.    hwn       :HWND   ;
  180.    model     :ULONG  ;
  181. end record; -- SMHSTRUCT;
  182. type PSMHSTRUCT  is access all SMHSTRUCT;
  183.  
  184. --        --HK_LOADER context codes
  185. --
  186. --         LHK_DELETEPROC             1
  187. --         LHK_DELETELIB              2
  188. --         LHK_LOADPROC               3
  189. --         LHK_LOADLIB                4
  190. --
  191. --        --HK_MSGCONTROL context codes
  192. --
  193. --         MCHK_MSGINTEREST           1
  194. --         MCHK_CLASSMSGINTEREST      2
  195. --         MCHK_SYNCHRONISATION       3
  196. --         MCHK_MSGMODE               4
  197. --
  198. --        --HK_REGISTERUSERMSG conext codes
  199. --
  200. --         RUMHK_DATATYPE             1
  201. --         RUMHK_MSG                  2
  202.  
  203. function WinSetClassThunkProc(pszClassname:PSZ ;
  204.                               pfnThunkProc:PFN )return BOOL32;
  205. pragma Import(c,WinSetClassThunkProc, Link_name=>"_WinSetClassThunkProc");
  206.  
  207. function WinQueryClassThunkProc(pszClassname:PSZ )return PFN  ;
  208. pragma Import(c,WinQueryClassThunkProc, Link_name=>"_WinQueryClassThunkProc");
  209.  
  210. function WinSetWindowThunkProc(hwn         :HWND ;
  211.                                pfnThunkProc:PFN  )return BOOL32;
  212. pragma Import(c,WinSetWindowThunkProc, Link_name=>"_WinSetWindowThunkProc");
  213.  
  214. function WinQueryWindowThunkProc( hwn:HWND )return PFN  ;
  215. pragma Import(c,WinQueryWindowThunkProc, Link_name=>"_WinQueryWindowThunkProc");
  216.  
  217. function WinQueryWindowModel( hwn :HWND)return LONG  ;
  218. pragma Import(c,WinQueryWindowModel, Link_name=>"_WinQueryWindowModel");
  219. end os2.pmhk;
  220.