Jump to content
Sign in to follow this  

The interception of messages (events) from the editor "SciTE" by use "VM_NOTIFY".

Recommended Posts


Sorry for my English

How to get code of the event's (SciTE):

    Undo (WM_UNDO?)
    Redo (EM_REDO?)
    Paste (WM_PASTE?)
    CUT (WM_CUT?)
    ... and so on.

Functions I found:

    $hGui = GUICreate(StringTrimRight(@ScriptName, 4), 420, 350, -1, -1)
    $hRichEdit = _GUICtrlRichEdit_Create($hGui, "Это тест.", 10, 10, 400, 220, _
    _GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

are applicable to "GUI" user-created only.

How to get events when you click on the "Undo" button or when you insert text in the editor "SciTE" for example?

Is it possible?

Closest thing I have found is:

HotKeySet("{ESC}", "_Quit")

While 1
; Send a command to SciTE
Func SendSciTE_Command($sCmd)
    Local $WM_NOTIFY = 78

    Global $SciTE_Return_Info

    $Scite_hwnd = ControlGetHandle("[CLASS:SciTEWindow]", "", "[CLASS:Scintilla; INSTANCE:1]")
    Local $My_Hwnd = GUICreate("AutoIt3-SciTE interface") ; Create MyGUI to be able to receive SciTE info

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    ConsoleWrite('hwnd -  ' & $My_Hwnd & @LF)
    Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
    DllStructSetData($CmdStruct, 1, $sCmd)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
    DllStructSetData($COPYDATA, 1, 1)
    DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
    DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
    DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $Scite_hwnd, _
            'Int', $WM_NOTIFY, 'HWnd', $My_Hwnd, _
            'Ptr', DllStructGetPtr($COPYDATA))
    Return $SciTE_Return_Info
EndFunc   ;==>SendSciTE_Command
; Received Data from SciTE
Func WM_NOTIFY($hWnd, $msg, $wParam, $lParam)

    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr', $lParam)
    $SciTECmdLen = DllStructGetData($COPYDATA, 2)
    Local $CmdStruct = DllStructCreate('Char[' & $SciTECmdLen + 1 & ']', DllStructGetData($COPYDATA, 3))
    $SciTE_Return_Info = StringLeft(DllStructGetData($CmdStruct, 1), $SciTECmdLen)
    ConsoleWrite('SciTE Returned <-- ' & $SciTE_Return_Info & @CRLF)
    $SciTE_Return_Info = StringTrimLeft($SciTE_Return_Info, StringInStr($SciTE_Return_Info, ":", 0, 3))
EndFunc   ;==>WM_NOTIFY

Func _Quit()
EndFunc   ;==>_Quit

by use https://www.autoitscript.com/forum/topic/40372-more-complete-example-of-using-scintilla-in-autoit/ by "Jos".

But it's not quite what I need. Аnd maybe even not what I need. Point me in the right direction, please.

Edited by guti
Change the title

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this