goodchap 发表于 2010-4-19 17:38:07

点击文字能弹出网页,请问怎么做的啊


如上图的窗体
当点击那个“www.cnzz6.com”的时候能弹出网页
请问这样的代码怎么写的啊

kxing 发表于 2010-4-19 18:59:11

本帖最后由 kxing 于 2010-4-19 19:06 编辑


#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Local $GethWnd,$Cur=True

$Form=GUICreate("URL",200,100) ;创建主窗口
GUISetBkColor(0x000000)
$Web=GUICtrlCreateLabel("点击访问无忧天空技术论坛",10,10,180,20) ;创建文字控件
GUICtrlSetColor(-1, 0x999fff)
GuiCtrlSetCursor(-1,0) ;指定一个鼠标指针
$Email=GUICtrlCreateLabel("点击 E-Mail 与我联系",10,40,180,20) ;同上
GUICtrlSetColor(-1, 0x999fff)
GuiCtrlSetCursor(-1,0) ;同上
GUISetState() ;显示已创建的窗口及控件

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Web ;双击Url 打开天空官网
ShellExecute("http://sky808.com")
Case $Email;双击Email 打开Outlook
ShellExecute("Mailto:sky808@126.com?subject=hi!!!","",@SW_HIDE)
EndSwitch
$Pos = GUIGetCursorInfo($Form)
If Not @error Then_Hyperlink($Pos)
WEnd

Func _Hyperlink($GethWnda)
If $GethWnda = $Web Or $GethWnda = $Email Then
If $Cur = True Then
$GethWnd = $GethWnda
GUICtrlSetFont($GethWnda, 9, 400, 4)
GUICtrlSetColor($GethWnda, 0x0080CC)
$Cur = False
EndIf
Else
If $Cur = False Then
GUICtrlSetColor($GethWnd, 0x999fff)
$Cur = True
EndIf
EndIf
EndFunc

Hen5ei 发表于 2010-4-19 19:19:03

事件模式:#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)

$Form1 = GUICreate("Form1", 234, 67, 192, 124)
$Label1 = GUICtrlCreateLabel("http://www.autoitx.com/", 24, 24, 180, 17)
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent(-1, "OnWWW")

GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")

GUISetState(@SW_SHOW)

While 1
        Sleep(1000)
WEnd

Func OnWWW()
        Run(@ComSpec & " /c " & 'start http://www.autoitx.com/', "", @SW_HIDE)
EndFunc   ;==>OnWWW

Func Quit()
        Exit
EndFunc

3mile 发表于 2010-4-19 19:31:32

修改楼上的,用UDF实现:
第一行加入inculde <ie.au3>
第20行改为_IECreate("www.autoitx.com")
页: [1]
查看完整版本: 点击文字能弹出网页,请问怎么做的啊