hbp555 发表于 2010-10-5 11:09:36

点击鼠标左键打开相应的地址,如何实现

我在程序里添加个label标签,设置鼠标移到上面为手的形状。
我想点击鼠标左键能够打开相应的文档。达到像IE中超级链接效果
本人刚刚学,想了很久。用GUICtrlGetState取得状态在执行,怎么都想不出好方法。
请大侠给个指点。谢谢!


$Label1 = GUICtrlCreateLabel("使用说明文件", 610, 50, 180, 20)
GUICtrlSetCursor (-1, 0)

wukaijj1314 发表于 2010-10-5 18:57:47

循环中设置
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Label1
                        ShellExecute("D:\help.chm")

        EndSwitch
WEnd


希望能够有所帮助~

xyold1 发表于 2010-10-5 21:55:37

本帖最后由 xyold1 于 2010-10-5 21:56 编辑

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 200, 84, 192, 124)
$Label1 = GUICtrlCreateLabel("使用说明文件", 48, 24, 76, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

                Case $Label1
                        ShellExecute("D:\")
        EndSwitch
WEnd

不知这么做对 不对

liufenglg 发表于 2010-10-5 22:14:21

不知这么做对 不对
xyold1 发表于 2010-10-5 21:55 http://www.autoitx.com/images/common/back.gif


    #include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 200, 84, 192, 124)
$Label1 = GUICtrlCreateLabel("使用说明文件", 48, 24, 76, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

                Case $Label1
                        FileOpenDialog("要打开的文件","","所有文件(*.*)")
      EndSwitch
WEnd

xyold1 发表于 2010-10-5 22:20:47

回复 4# liufenglg

谢谢指出错误

wukaijj1314 发表于 2010-10-6 12:49:45

回复 4# liufenglg


    楼主只需要打开特定文件 效果是“达到像IE中超级链接效果”

应该不需要做文件浏览对话框吧?
页: [1]
查看完整版本: 点击鼠标左键打开相应的地址,如何实现