Page 1 of 1

search plugin for auto-indent

Posted: Mon Dec 31, 2007 7:10 am
by eddy
hi,

I tried to code an auto-indent functionality but I don't know how to catch event from external app.

My idea was to replace callback...

Code: Select all

sci = Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))
pb = Val(GetEnvironmentVariable("PB_TOOL_MainWindow"))
oldproc = SetWindowLong_(sci, #GWL_WNDPROC, @ScintillaWindowCallback()) 

Code: Select all

Procedure ScintillaWindowCallback(hWnd.l, Message.l, wParam.l, lParam.l)
    result.l = 0
    Select Message
        Case #WM_NOTIFY
            *lpnmhdr.NMHDR = lParam
            *notify.SCNotification = lParam
            Select *lpnmhdr\code
                Case #SCN_CHARADDED
                ;....
                Case #SCN_STYLENEEDED
                ;....
            EndSelect
        Default
            result = CallWindowProc_(oldproc, hWnd, Msg, wParam, lParam)
    EndSelect
    ProcedureReturn result
EndProcedure 
... no result for the moment

Posted: Mon Dec 31, 2007 2:06 pm
by Foz

Posted: Mon Dec 31, 2007 3:30 pm
by eddy
not really...
I want to indent code without using file.

Posted: Tue Jan 01, 2008 6:19 am
by netmaestro
Your approach isn't going to yield results:
MSDN wrote:Calling SetWindowLong with the GWL_WNDPROC index creates a subclass of the window class used to create the window. An application can subclass a system class, but should not subclass a window class created by another process.
If I were trying to accomplish your goal I'd consider installing a number of keyboard hooks and sending scintilla messages based on the various keypresses. In any case, you won't be able to read the IDE's message queue as it isn't owned by your process.