Jump to content

Rich Edit


Nahuel
 Share

Recommended Posts

I made an IM client a while back and I wanted to make it look better. I discovered Gary's GuiRichEdit.au3 just today and I've been playing around with it. The thing is that I don't have a clue of how it works. Here's what I've been playing with:

#include "GuiRichEdit.au3"
#include <GUIConstants.au3>
#include <Misc.au3>

$hgui= GUICreate("", 426, 356, 205, 131)
$Recieve =_GUICtrlRichEditCreate ($hgui, 8, 2, 393, 263,BitOR($ES_WANTRETURN, $WS_HSCROLL, $ES_SUNKEN, $ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$Send = GUICtrlCreateEdit("", 8, 272, 333, 75, BitOR($ES_AUTOVSCROLL,$WS_VSCROLL))
$Button1 = GUICtrlCreateButton("&Send", 348, 282, 75, 65, $BS_DEFPUSHBUTTON)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_Events")
$lResult = _SendMessage($Recieve, $EM_AUTOURLDETECT, True)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _GUICtrlRichEditAppendText ($Recieve,@UserName & " says:" & @CRLF & GUICtrlRead($Send)& @CRLF)
            GUICtrlSetData($Send,"")
            ControlFocus($hgui,"",$Send)
    EndSwitch
WEnd


Func WM_NOTIFY_Events($hWndGUI, $MsgID, $wParam, $lParam)
    #forceref $hWndGUI, $MsgID
    Local $identifier, $nmhdr, $hwndFrom, $idFrom, $code
    ;----------------------------------------------------------------------------------------------
    $nmhdr = DllStructCreate($NMHDR_fmt, $lParam)
    $hwndFrom = DllStructGetData($nmhdr, 1)
    $idFrom = DllStructGetData($nmhdr, 2)
    $code = DllStructGetData($nmhdr, 3)
    Switch $hwndFrom
        Case $Recieve
            Switch $code
                Case $EN_LINK
                    Local $EN_LINK_struct = DllStructCreate($ENLINK_fmt, $lParam)
                    $hwndFrom = DllStructGetData($EN_LINK_struct, 1)
                    $idFrom = DllStructGetData($EN_LINK_struct, 2)
                    $code = DllStructGetData($EN_LINK_struct, 3)
                    Local $en_link_msg = DllStructGetData($EN_LINK_struct, 4)
                    Local $en_link_wParam = DllStructGetData($EN_LINK_struct, 5)
                    Local $en_link_lParam = DllStructGetData($EN_LINK_struct, 6)
                    Local $cpMin = DllStructGetData($EN_LINK_struct, 7)
                    Local $cpMax = DllStructGetData($EN_LINK_struct, 8)
                    If BitAND($en_link_msg, $WM_LBUTTONDOWN) = $WM_LBUTTONDOWN Then
                        Local $link_clicked = _GUICtrlRichEditGetText ($hwndFrom, $cpMin, $cpMax) ; doesn't seem to work on zoomed text
                        If $link_clicked <> "" Then Run(@ComSpec & ' /c START "" "' & $link_clicked & '"', @SystemDir, @SW_HIDE)

                    EndIf
                    ;----------------------------------------------------------------------------------------------
                Case $EN_MSGFILTER
                    Local $EN_MSGFILTER_struct = DllStructCreate($msgfilter_fmt, $lParam)
                    $hwndFrom = DllStructGetData($EN_MSGFILTER_struct, 1)
                    $idFrom = DllStructGetData($EN_MSGFILTER_struct, 2)
                    $code = DllStructGetData($EN_MSGFILTER_struct, 3)
                    Local $en_msgfilter_msg = DllStructGetData($EN_MSGFILTER_struct, 4)
                    Local $en_msgfilter_wParam = DllStructGetData($EN_MSGFILTER_struct, 5)
                    Local $en_msgfilter_lParam = DllStructGetData($EN_MSGFILTER_struct, 6)
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG

EndFunc   ;==>WM_NOTIFY_Events

Here's Gary's thread.

Notice that when you type www.google.com, for example, it turns into a click-able link. But what I'm actually looking for is different fonts, or at least make the username appear in bold.

Link to comment
Share on other sites

It's not finished.

Different fonts are not implemented yet.

To finish it I'll have to take a look at the Callbacks UDF

Haven't found any motivation to finish it, don't use RichEdit for any of my projects at the moment.

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

  • 1 month later...

If you need it now, you can look here:

http://www.autoitscript.com/forum/index.ph...mp;hl=rich+edit

together with the RTC (Callbacks UDF) it works (you'll have to make some changes)

Shouldn't be any need for the (Callbacks UDF) anymore, Callbacks is in the Beta

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

Shouldn't be any need for the (Callbacks UDF) anymore, Callbacks is in the Beta

OK

I only wanted to point at that RTC, because there is a RTC with MSFTEDIT.DLL and arcker

uses it too.

I know you made a lot of good work too, you have a RTC_Create too, but with it (RICHED20.DLL) I didn`t get

a function (I don't remember witch) to work (combining), but I think I could format text and some other things too

Edited by grham
Link to comment
Share on other sites

Another possibility...

#include <GUIConstants.au3>
#include <IE.au3>
#include-once

Global $XT_oIE


XSkinConsole( "", 10, 10, 400, 300)

XSkinText("This is an example...")
Sleep(1000)
XSkinText("Starting tasks...")
Sleep(1000)
XSkinText() ; sends a blank line
XSkinText("... Clearing Screen")
Sleep(700)
XSkinText("CLR") ;Clears the XSkinConsole

$Text = StringSplit("Checking System...,System Located,Checking Folders...,Folders Found,Checking Files...,Files Found, Verifying Data....,....Complete",",") 
$color = StringSplit("red,brown,orange,blue,yellow,green,gray,",",")

For $i = 1 To $Text[0] -1
    Sleep(1000)
    $msg = $i & @TAB & $Text[$i]
    XSkinText($msg, $color[$i])
Next

Sleep(700)
XSkinText() ; send a blank line
XSkinText($Text[8], "Red", 6)

Sleep(5000)

Func XSkinConsole($XT_GUI, $left, $top, $width, $height)
    _IEErrorHandlerRegister()
    $XT_oIE = _IECreateEmbedded()
    If Not IsHWnd($XT_GUI) Then
        $XT_GUI = GUICreate("", $width + (2 * $left), $height + (2 * $top))
        GUISetState()
    EndIf
    $XT_ActiveX = GUICtrlCreateObj($XT_oIE, $left, $top, $width, $height)
    _IENavigate($XT_oIE, "about:blank")
    Return $XT_ActiveX
EndFunc   ;==>XSkinConsole

Func XSkinText($msg = "", $color = "black", $size = "3")
    If $msg == "CLR"  Then Return _IEDocWriteHTML($XT_oIE, "")
    Return _IEDocWriteHTML($XT_oIE, _IEDocReadHTML($XT_oIE) & '<font color="' & $color & '" size=' & $size & '>' & $msg & '</font><br>')
EndFunc   ;==>XSkinText

8)

NEWHeader1.png

Link to comment
Share on other sites

OK

I only wanted to point at that RTC, because there is a RTC with MSFTEDIT.DLL and arcker

uses it too.

I know you made a lot of good work too, you have a RTC_Create too, but with it (RICHED20.DLL) I didn`t get

a function (I don't remember witch) to work (combining), but I think I could format text and some other things too

Look here - there must be done some tweaks in CallBack UDF examples to be OK on WIN9x/XP

Link to comment
Share on other sites

A3LRichEdit.au3 doesn't work on Windows 2000. I get an error in Spanish saying:

_Api_CreateWindowEx:Can't find the window class

I tested it with the latest Beta and it shows 352 errors from these includes: A3LConstants.au3, Structures.au3, A3LWinAPI.au3, A3LStructs.au3, A3LMenu.au3, A3LToolBar.au3 and A3LRichEdit.au3! Because of what Gary said..

I loved Val's idea though! I think I might use it (if you don't mind). The only problem (which is nothing, really) is that it'd take it a few more seconds to start. Specially on my slowww machine.

Link to comment
Share on other sites

A3LRichEdit.au3 doesn't work on Windows 2000. I get an error in Spanish saying:

_Api_CreateWindowEx:Can't find the window class

I tested it with the latest Beta and it shows 352 errors from these includes: A3LConstants.au3, Structures.au3, A3LWinAPI.au3, A3LStructs.au3, A3LMenu.au3, A3LToolBar.au3 and A3LRichEdit.au3! Because of what Gary said..

I loved Val's idea though! I think I might use it (if you don't mind). The only problem (which is nothing, really) is that it'd take it a few more seconds to start. Specially on my slowww machine.

just use the Val's idea : its good

the errors are because of some duplicate constants I think

Link to comment
Share on other sites

Yes, what Gary said.

I just found out another problem.. scrolling down... Using $oIE.document.parentwindow.scroll looks awful and makes you dizzy. I suppose I could just make it add one line and delete another one from the top...

Link to comment
Share on other sites

A3LRichEdit.au3 doesn't work on Windows 2000. I get an error in Spanish saying:

_Api_CreateWindowEx:Can't find the window class

I tested it with the latest Beta and it shows 352 errors from these includes: A3LConstants.au3, Structures.au3, A3LWinAPI.au3, A3LStructs.au3, A3LMenu.au3, A3LToolBar.au3 and A3LRichEdit.au3! Because of what Gary said..

I loved Val's idea though! I think I might use it (if you don't mind). The only problem (which is nothing, really) is that it'd take it a few more seconds to start. Specially on my slowww machine.

RTF DLL name and Class name is different in WIN9x/WINXP

Look here as I said before.

Link to comment
Share on other sites

RTF DLL name and Class name is different in WIN9x/WINXP

Look here as I said before.

I have both dlls in the system dir and it's possible to make a rtc with both of them

For RICHED20.DLL the ClassName is RichEdit20W

and for MSFTEDIT.DLL the ClassName is RichEdit50W

Edited by grham
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...