Jump to content

RichEdit Control


GaryFrost
 Share

Recommended Posts

  • Replies 67
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Link to comment
Share on other sites

Thanks!

I got another problem: _GUICtrlRichEditGetText() doesn't work properly. (That's what I think :P )

$iLen = RichText_GetLenght($hRichText)

$sText = _GUICtrlRichEditGetText($hRichText, 0, $iLen)

Func RichText_GetLenght($hWnd)
    
    $TStr = DllStructCreate("int Flags; int charset")
    DllStructSetData($TStr,1,0x00000000)
    DllStructSetData($TStr,2,1200)

    Return _SendMessage($hRichText, $EM_GETTEXTLENGTHEX, DllStructGetPtr($TStr), 0)
    
EndFunc
GetLenght() returns 12, (thats how long the string is), but GetText only returns the first character :s
Link to comment
Share on other sites

Well, can you post a full example ?

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Thanks!

I got another problem: _GUICtrlRichEditGetText() doesn't work properly. (That's what I think :P )

$iLen = RichText_GetLenght($hRichText)

$sText = _GUICtrlRichEditGetText($hRichText, 0, $iLen)

Func RichText_GetLenght($hWnd)
    
    $TStr = DllStructCreate("int Flags; int charset")
    DllStructSetData($TStr,1,0x00000000)
    DllStructSetData($TStr,2,1200)

    Return _SendMessage($hRichText, $EM_GETTEXTLENGTHEX, DllStructGetPtr($TStr), 0)
    
EndFunc
GetLenght() returns 12, (thats how long the string is), but GetText only returns the first character :s
Works fine for me if I add a button called $Btn2 in the example in post #1 and have

Case $msg = $btn2
                $iLen = RichText_GetLenght($h_RichEdit)
                ConsoleWrite("Length of text = " & $iLen & @CRLF)
                $sText = _GUICtrlRichEditGetText ($h_RichEdit, 0, $iLen)
                ConsoleWrite($sText & @CRLF)

Not connected with your problem but I think your function should be

Func RichText_GetLenght($hWnd)
    
    $TStr = DllStructCreate("int Flags; int charset")
    DllStructSetData($TStr,1,0x00000000)
    DllStructSetData($TStr,2,1200)

    Return _SendMessage($hWnd, $EM_GETTEXTLENGTHEX, DllStructGetPtr($TStr), 0);<--- use the handle passed as parameter
    
EndFunc

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Return _SendMessage($hWnd, $EM_GETTEXTLENGTHEX, DllStructGetPtr($TStr), 0);<--- use the handle passed as parameter

Ofcourse, stupid mistake :P

I know what the problem is. I used MSFTEDIT.DLL (RichText 4.1) instead of RichEd20.dll (RichText 2.0/3.0).

Kinda weird that the new version doesn't work where the older version does work. Because Microsoft says that they are a superset of each other.

Edited by Kip
Link to comment
Share on other sites

Well, this one works possibly with UNicode, so you have to use wchar in GetText :P

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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...