au3的状态栏的文字上怎样加链接?有没有谁知道? 已解决
本帖最后由 yeqing880 于 2010-3-12 09:56 编辑如图示..我想在上面加一个链接..应该怎么做呢?
问题已解决,解决办法在三楼...谢谢大大的帮助! 上代码吧!:face (20): #include <GUIStatusBar.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
$hGUI = GUICreate("Test", 400, 300)
GUICtrlCreateLabel("www.google.cn", 4, 4, 200, 20)
GUICtrlSetFont(-1, 9, 400, 4, "Verdana")
$hFont = _SendMessage(GUICtrlGetHandle(-1), $WM_GETFONT, 0, 0)
Local $aText = ["www.google.cn", ""], $aPart =
$hStatusBar = _GUICtrlStatusBar_Create($hGUI, $aPart, $aText)
_SendMessage($hStatusBar, $WM_SETFONT, $hFont, 1, 0, "wparam", "int")
GUICtrlSetState(-1, $GUI_HIDE)
$hLibrary = _WinAPI_LoadLibrary("Shell32.dll")
$hCursor = _LoadCursor($hLibrary, 1002)
_WinAPI_FreeLibrary($hLibrary)
$hSTC = DllCallbackRegister("_StatusBarProcedure", "int", "hWnd;uint;wparam;lparam")
$hOSTC = _WinAPI_SetWindowLong($hStatusBar, -4, DllCallbackGetPtr($hSTC))
Func _StatusBarProcedure($hWnd, $iMsg, $iwParam, $ilParam)
Local $iX, $iY
If (($iMsg = $WM_MOUSEMOVE) Or ($iMsg = $WM_LBUTTONDOWN) Or _
($iMsg = $WM_LBUTTONUP) Or ($iMsg = $WM_LBUTTONDBLCLK)) Then
$iX = bitAnd($ilParam, 0xFFFF)
$iY = bitShift($ilParam, 0x10)
If ($iX > 0 And $iX < 100) And ($iY > 0 And $iY < 21) Then
_SetCursor($hCursor)
If ($iMsg = $WM_LBUTTONDBLCLK) Then
ShellExecute("www.google.cn")
EndIf
EndIf
EndIf
Return _WinAPI_CallWindowProc($hOSTC, $hWnd, $iMsg, $iwParam, $ilParam)
EndFunc ;==>_StatusBarProcedure
GUISetState()
Do
Until GUIGetMsg() = -3
Opt("TrayIconHide", 1)
ProcessClose(@AutoItPid)
Func _LoadCursor($hInstance, $iCursorId)
Local $iResult
$iResult = DllCall("User32.dll", "hWnd", "LoadCursor", "hWnd", $hInstance, "int", $iCursorId)
Return $iResult
EndFunc ;==>_LoadCursor
Func _SetCursor($hCursor)
Local $iResult = DllCall("User32.dll", "int", "SetCursor", "hWnd", $hCursor)
Return $iResult
EndFunc ;==>_SetCursor双击打开GOOGLE。
如果只是想截取双击这个通知以打开指定网站,用GUIRegisterMsg注册WM_NOTIFY消息也可以,WM_NOTIFY的lParam参数指向NMHEADER结构,此结构在StructureConstants.au3有定义。
然而,如果在以上基础上还要设置鼠标形状,就必须要用SetWindowLong函数改变StatusBar控件的消息接收地址,以截取所有消息。 我顶P大!!太强悍了! #include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("测试", 242, 135, 298, 213)
$Label1 = GUICtrlCreateLabel("文字连接", 88, 40, 52, 17)
GUICtrlSetColor(-1, 0x0000FF)
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("http://5300597.qzone.qq.com")
EndSwitch
WEnd 抱歉,没看清题目。状态栏。。。。。。 呵呵,学习一下。。 回复 3# pusofalse
谢谢提供..问题已解决~~ 非常感谢,我正需要 学习一下。。 我来学习了了。这个不错。 收藏先,,用得着的时候再用
页:
[1]