找回密码
 加入
搜索
查看: 2594|回复: 3

[AU3基础] 点击文字能弹出网页,请问怎么做的啊

[复制链接]
发表于 2010-4-19 17:38:07 | 显示全部楼层 |阅读模式

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

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 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[4])
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
发表于 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
发表于 2010-4-19 19:31:32 | 显示全部楼层
修改楼上的,用UDF实现:
第一行加入inculde <ie.au3>
第20行改为_IECreate("www.autoitx.com")
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-21 02:29 , Processed in 0.078965 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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