找回密码
 加入
搜索
查看: 1590|回复: 0

[AU3基础] 请问富文本里的url鼠标点击如何调用浏览器访问?_GUICtrlRichEdit_AutoDetectURL

[复制链接]
发表于 2014-3-30 09:46:54 | 显示全部楼层 |阅读模式
#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $hRichEdit

Main()

Func Main()
    Local $hGui, $iMsg
    $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
    $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
            BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    GUISetState()

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    _GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_LINK)

    _GuiCtrlRichEdit_AutoDetectURL($hRichEdit, True)
    _GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "http://www.autoitscript.com")
    While True
        $iMsg = GUIGetMsg()
        Select
            Case $iMsg = $GUI_EVENT_CLOSE
                GuiDelete()
                Exit
        EndSelect
    WEnd
EndFunc   ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
    #forceref $hWnd, $iMsg, $iWparam
    Local $hWndFrom, $iCode, $tNMHDR, $tEnLink, $cpMin, $cpMax, $tMsgFilter
    $tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hRichEdit
            Select
                Case $iCode = $EN_LINK
                    $tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
                    If DllStructGetData($tMsgFilter, "msg") = $WM_LBUTTONUP Then
                        $tEnLink = DllStructCreate($tagENLINK, $iLparam)
                        $cpMin = DllStructGetData($tEnLink, "cpMin")
                        $cpMax = DllStructGetData($tEnLink, "cpMax")
                        MsgBox(0, "", "Invoke your web browser here and point it to " & _
                                _GuiCtrlRichEdit_GetTextInRange($hRichEdit, $cpMin, $cpMax))
                    EndIf
            EndSelect
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY
如何点击这串地址http://www.autoitscript.com并访问这链接?有哪位试过了没
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-3 05:53 , Processed in 0.077808 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表