home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / MFKASM.ZIP / TSR_HOOK.ASM < prev    next >
Assembly Source File  |  1992-07-21  |  3KB  |  88 lines

  1. ;---------------------------------------------------------------------------;
  2. ; M.F.Kaplon  Begun:Tue  07-14-1992   RevisedFri  07-17-1992
  3. ; Title : tsr_hook.asm
  4. ;
  5. ; This is the dll to be used with tsr.asm.
  6. ; Its purpose is to test the WM_CHAR message stream from the system
  7. ; and when the HOT Key is struck to take appropriate action
  8. ;---------------------------------------------------------------------------;
  9. ;
  10. .386             ;preceeding .MODEL makes USE32 default
  11. .MODEL           FLAT,SYSCALL,OS_OS2
  12.  
  13. INCL_WINERRORS      equ  1
  14. INCL_WIN            equ  1
  15. INCL_WINSWITCHLIST  equ  1
  16. INCLUDE         c:\toolkt20\asm\os2inc\os2def.inc ;structure defns includes POINTL
  17. INCLUDE         c:\toolkt20\asm\os2inc\pmwin.inc  ;structure defns POINTL defn required
  18. ;INCLUDE         c:\toolkt20\asm\os2inc\pmgpi.inc  ;graphics
  19. INCLUDE         c:\toolkt20\asm\os2inc\pmerr.inc  ;errors
  20. INCLUDE         c:\toolkt20\asm\os2inc\pmshl.inc
  21. INCLUDELIB      c:\toolkt20\os2lib\os2386.lib     ;Library
  22.  
  23. ;INCLUDE         d:\os2_asm\equs386.inc       ;equates : MFK
  24. INCLUDE         d:\os2_asm\386_dos.mac       ;macros using DOS calls : MFK
  25. ;INCLUDE         d:\os2_asm\386_win.mac       ;macros using WIN/GR calls :MFK
  26.  
  27. .STACK    2048
  28.  
  29. .DATA
  30. ;------------- handles --------
  31. hk_hab            DWORD   ?    ;Anchor block Handle
  32.  
  33. ;------------ structures
  34. hk_qmsg           DWORD   ?    ;Address of Queue message structure
  35.  
  36.  
  37. .CODE
  38.  
  39. ; use PUBLIC rather than EXPORTS if want to pass parameters
  40. ;
  41. ;The Journal-Record hook function has the form
  42. ;  VOID APIENTRY JournalRecordHook(HAB hab, PQMSG pQmsg)
  43.  
  44. ;The  Input-Hook function has the form
  45. ;  VOID APIENTRY InputHook(HAB hab, PQMSG pQmsg, ULONG fs)
  46. ;  fs can contain flags from WinPeekMsg
  47. ;  this functions returns TRUE  if message not to be passed on
  48. ;                 returns FALSE if message  is to be passed on
  49.  
  50. Inputhook  proc ;EXPORTS ; PUBLIC Using  HK_Journal Input
  51.     ;----------- Get Passed Parameters from Stack ------------
  52.     push   ebp           ;return address is 4 bytes and this push is 4 bytes
  53.     mov    ebp,esp       ;so first parameter is 8 bytes from top
  54.     mov    eax,[ebp+8]
  55.     mov    hk_hab,eax      ;anchor block handle
  56.     mov    eax,[ebp+12]
  57.     mov    hk_qmsg,eax     ;address of message structure
  58.     mov    esi,hk_qmsg
  59.     mov    ebx,[esi+4]       ;message
  60.     .IF    ebx == WM_CHAR
  61.          mov    ebx,[esi+8]     ;mp1 will check for char codes
  62.          mov    cx,KC_ALT       ;Alt Key was down when
  63.          add    cx,KC_CHAR      ;this key pressed
  64.          and    bx,cx
  65.         .IF    bx               ;Alt Key down and Char Key hit
  66.             mov    ebx,[esi+12]  ;mp2 low order  16 bits has char
  67.            .IF    bx == '1'
  68.                $DosBeep 1000,2000
  69.            .ENDIF
  70.         .ENDIF
  71.     .ENDIF
  72.     mov    esp,ebp       ;restore  stack pointer
  73.     pop    ebp           ;back to  way it was at entrance
  74.     mov    eax,FALSE     ;Return Value = pass on to chain
  75.     ret
  76. Inputhook endp
  77.  
  78.  
  79. JournalRecordHook  proc
  80.     ret
  81. JournalRecordHook  endp
  82.  
  83. END
  84.  
  85.  
  86.  
  87.  
  88.