Below is the source for a basic Quick Editor plugin, the interface for the plugin uses only one procedure "QePlugIn" which is the same for all plugins. Quick Editor internally uses LoadLibrary() and GetProcAddress() then directly calls the DLL, it tests both the library handle and the procedure name before it makes the call and displays an error message if there is any error in either. The interface was primarily designed for short fast operations on the text in the rich edit control. The call to the procedure "QePlugIn" is a one pass operation that does not store the library handle so while displaying a window is easy enough, if it is not a modal window that disables the editor, there is no automatic method of closing the DLL if the editor is closed while the DLL is running. Text modification, insertion, replacement etc.. are simple enough operations. More ambitious tasks can be done on the editor as all of the useful handles are passed to the procedure "QePlugIn". Quick Editor is freeware and it has been hammered to death to make it a robust application. DLL access to its internal workings is one way of making a real mess so I would expect that any plugins that are distributed would only be distributed with their source code so that other programmers can build the plugin. I discourage binaries being distributed without source as it leaves open the risk of unreliable or dangerous software that will crash Quick Editor. The general drift is if you are going to distribute plugins, make sure they are slick, quick and reliable. Regards, hutch@pbq.com.au


The batch file to build the plugin DLL

=========================================

@echo off

if exist qeplugin.obj del qeplugin.obj
if exist qeplugin.dll del qeplugin.dll

\masm32\bin\ml /c /coff qeplugin.asm

\masm32\bin\Link /SUBSYSTEM:WINDOWS /DLL /DEF:qeplugin.def qeplugin.obj

dir qeplugin.*

pause

=========================================

qeplugin.def

LIBRARY qeplugin
EXPORTS QePlugIn

=========================================

qeplugin.asm

; #########################################################################

    .386
    .model flat, stdcall
    option casemap :none   ; case sensitive

; #########################################################################

    include \masm32\include\windows.inc
    include \masm32\include\user32.inc
    include \masm32\include\kernel32.inc
    include \MASM32\include\oleaut32.inc

    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\kernel32.lib
    includelib \MASM32\LIB\oleaut32.lib

; #########################################################################

    stralloc MACRO ln
      invoke SysAllocStringByteLen,0,ln
    ENDM

    strfree MACRO strhandle
      invoke SysFreeString,strhandle
    ENDM

    szText MACRO Name, Text:VARARG
      LOCAL lbl
        jmp lbl
          Name db Text,0
        lbl:
      ENDM

    m2m MACRO M1, M2
      push M2
      pop  M1
    ENDM

    return MACRO arg
      mov eax, arg
      ret
    ENDM

  ; -----------
  ; not needed
  ; -----------
    LibMain  PROTO :DWORD,:DWORD,:DWORD
    QePlugIn PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD

.code

; ##########################################################################

LibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD

        .if reason == DLL_PROCESS_ATTACH

            return TRUE
          ; -----------------------------
          ; If error at startup, return 0
          ; System will abort loading DLL
          ; -----------------------------

 ;         ---------------------
 ;          uncomment if needed
 ;         ---------------------
 ;         .elseif reason == DLL_PROCESS_DETACH
 ; 
 ;         .elseif reason == DLL_THREAD_ATTACH
 ; 
 ;         .elseif reason == DLL_THREAD_DETACH
            
        .endif

        ret

LibMain Endp

; ##########################################################################

QePlugIn proc hInst:DWORD,hMain:DWORD,hE
Posted on 2001-02-07 18:08:00 by hutch--
Hey, thanks for that response, but I have just a couple of little suggestions. One of them is, that there is no 'relible' way of finding out what version of Quick Editor the dll is running on. And there is no way to get the name of the file currently open (if any), without fetching the text from the main title bar, which is also unrelible. Thanks alot
Posted on 2001-02-08 01:10:00 by George
Great, we can make syntax highlightening with this... can't we?
Posted on 2001-02-11 15:58:00 by Milos