Jump to content

is there such thing as a RichEdit GuiCtrlRead?


_Kurt
 Share

Recommended Posts

Hey guys,

I'm wondering if there is some sort of function or way to read a RichEdit editbox? GuiCtrlRead($richedit) returns 0.

Thanks,

Kurt

PS: why did i use the puking icon for this topic?

Awaiting Diablo III..

Link to comment
Share on other sites

Hey guys,

I'm wondering if there is some sort of function or way to read a RichEdit editbox? GuiCtrlRead($richedit) returns 0.

Thanks,

Kurt

PS: why did i use the puking icon for this topic?

RichEdit is not a Control that can be created with GUICtrlCreateEdit so why do you want to read somethink that is not supported?
Link to comment
Share on other sites

Use the WM_GETTEXT API function

for example:

#include <GUIConstants.au3>
#include <Misc.au3>
$struct_string = DllStructCreate("char[496]")
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

$oRP = ObjCreate("RICHTEXT.RichtextCtrl.1")

GUICreate("Embedded RICHTEXT control Test", 320, 200, -1, -1,BitOr($WS_OVERLAPPEDWINDOW,$WS_VISIBLE,$WS_CLIPSIBLINGS))
$TagsPageC = GuiCtrlCreateLabel('Visit Tags Page', 5, 180, 100, 15, $SS_CENTER)
GuiCtrlSetFont($TagsPageC,9,400,4)
GuiCtrlSetColor($TagsPageC,0x0000ff)
GuiCtrlSetCursor($TagsPageC,0)
$AboutC = GUICtrlCreateButton('About',105,177,70,20)
$PrefsC = GUICtrlCreateButton('FontSize',175,177,70,20)
$StatC = GUICtrlCreateButton('Plain Style',245,177,70,20)

$GUIActiveX = GUICtrlCreateObj( $oRP, 10, 10 , 400 , 260 )
GUICtrlSetPos($GUIActiveX,10,10,300,160)

With $oRP; Object tag pool
.OLEDrag()
.Font = 'Arial'
.text = "Hello - Au3 supports ActiveX components like the RICHTEXT thanks to SvenP" & @CRLF & 'Try write some text and quit to reload'
;.FileName = @ScriptDir & '\RichText.rtf'
;.BackColor = 0xff00
EndWith

GUISetState ();Show GUI
$h_REdit = ControlGetHandle("Embedded RICHTEXT control Test","","RichTextWndClass1")

_SendMessage($h_REdit, $WM_GETTEXT, 4096, DllStructGetPtr($struct_string))
ConsoleWrite(DllStructGetData($struct_string, 1) & @LF)

While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            $oRP.SaveFile( @ScriptDir & "\RichText.rtf", 0 )
            ExitLoop
        Case $msg = $TagsPageC
            Run(@ComSpec & ' /c start http://www.myplugins.info/guids/typeinfo/typeinfo.php?clsid={3B7C8860-D78F-101B-B9B5-04021C009402}','', @SW_HIDE)
        Case $msg = $AboutC
            $oRP.AboutBox() 
        Case $msg = $PrefsC
            $oRP.SelFontSize = 12
        Case $msg = $StatC
            $oRP.SelBold = False
            $oRP.SelItalic = False
            $oRP.SelUnderline = False 
            $oRP.SelFontSize = 8
    EndSelect
WEnd

Exit

Func MyErrFunc()

  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"      & @CRLF  & @CRLF & _
             "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
             "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "         & @TAB & hex($oMyError.number,8)  & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
             "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
             "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
            ,5)
  ; Will automatically continue after 5 seconds
            
    Local $err = $oMyError.number
    If $err = 0 Then $err = -1
    
    SetError($err)  ; to check for after this function returns
Endfunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

can also be used with external edit controls, for example:

#include <Misc.au3>
Global Const $WM_SETTEXT = 0xC
Global Const $WM_GETTEXT = 0xD
$struct_string = DllStructCreate("char[496]")
DllStructSetData($struct_string, 1, "This is a test")
Run("Notepad")
WinWaitActive("Untitled - Notepad")
$h_edit = ControlGetHandle("Untitled - Notepad","", "Edit1")
ConsoleWrite($h_edit & @LF)
_SendMessage($h_edit, $WM_SETTEXT, 0, DllStructGetPtr($struct_string))
DllStructSetData($struct_string, 1, "")
ConsoleWrite(_SendMessage($h_edit, $WM_GETTEXT, 4096, DllStructGetPtr($struct_string)) & " char(s)" & @LF)
ConsoleWrite(DllStructGetData($struct_string, 1) & @LF)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...