home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / wp / ewdins.zip / AUTOINS.PAS < prev   
Pascal/Delphi Source File  |  1993-06-03  |  2KB  |  77 lines

  1. {************************************************}
  2. {                         }
  3. { E! for Windows                 }
  4. { (c) - Patrick Philippot - 1992-1993         }
  5. {                         }
  6. { AutoIns Extension DLL - version 1.0         }
  7. {                         }
  8. { This DLL modifies the basic behavior of the     }
  9. { AutoInsert function. Currently, when auto-     }
  10. { inserting a right brace, EW doesn't move       }
  11. { the cursor where you would expect, that is,     }
  12. { just before the right brace. Some users prefer }
  13. { the original behavior. If you don't, install   }
  14. { this DLL.                     }
  15. {                         }
  16. {************************************************}
  17.  
  18. (*
  19. To use this DLL simply load it from the user menu or add its name to the
  20. list of autoloaded Extension DLLs by using the Autoload dialog box from
  21. the User Menu of EW. That's all. This extension cannot be executed because
  22. it only adds a hook responding to E! notifications. AutoIns exports no
  23. EWExecute function.
  24.  
  25. After installation and if AutoInsert has been checked in the Local Default
  26. dialog box from the Control Center, the AutoInsert function behavior will
  27. be modified. After execution, the cursor will be moved backwards one
  28. position and will be located between the left and right braces.
  29.  
  30. Please refer to the documentation for details about the AutoInsert feature.
  31.  
  32. This small piece of code also shows you how easy it is to modify basic
  33. functions of E!.
  34. *)
  35.  
  36. {$IFDEF DEBUG}
  37. {$A+,G+,B-,D+,E-,F+,I-,N-,R+,S+,V-,L+,Q+,Y+,K+,X+}
  38. {$ELSE}
  39. {$A+,G+,B-,D-,E-,F+,I-,N-,R-,S-,V-,L-,Q-,Y-,K+,X+}
  40. {$ENDIF}
  41.  
  42. {$C MOVEABLE PRELOAD DISCARDABLE}
  43.  
  44. library AutoIns;
  45.  
  46. uses WinTypes, EWApiImp, Strings;
  47.  
  48. {$I ewuser.inc}
  49.  
  50. var
  51.   SaveExit : Pointer;
  52.  
  53. function NotifyHook(eventcode : word; wParam : word; lParam : longint) : integer; export;
  54. begin
  55.   NotifyHook := 0; {-A non-zero value would break the hook chain}
  56.   if  (eventcode = ewNotify_CharExit)
  57.   and (Char(Lo(wParam)) in [')', ']', '}'])
  58.   and (EWGetLocalFlag(EWLclbAutoInsert) <> 0)
  59.   and (EWGetInsertState <> 0) then
  60.     EWPrevCol;
  61. end;
  62.  
  63. procedure LibExit; far;
  64. begin
  65.   EWRemoveHook(EWHook_Notify, @NotifyHook);
  66.   ExitProc := SaveExit;
  67. end;
  68.  
  69. exports
  70.   NotifyHook index 1;
  71.  
  72. begin
  73.   EWSetHook(EWHook_Notify, @NotifyHook);
  74.   SaveExit := ExitProc;
  75.   ExitProc := @LibExit;
  76. end.
  77.