#region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=ico/Run.ico
#AutoIt3Wrapper_UseX64=n
#endregion ;**** 参数创建于 ACNWrapper_GUI ****
#include <Constants.au3>
#include <WindowsConstants.au3>
#include <FontConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <TabConstants.au3>
#include <WinAPI.au3>
#include <WinAPIEx.au3>
#include <GUIConstantsEx.au3>
#include <GuiTab.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>
#include <GuiToolbar.au3>
#include <GuiStatusBar.au3>
#include <GDIPlus.au3>
#include <IE.au3>
#include <Misc.au3>
#include <array.au3>
#include <icons.au3>
_Singleton("Service Desk Helper") ;防止程序重复运行
TraySetClick(16)
Opt("TrayMenuMode", 3)
Opt("trayOnEventMode", 1)
TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "_showwin")
Local $aboutitem = TrayCreateItem("关于")
TrayItemSetOnEvent($aboutitem, "TrayMsg")
TrayCreateItem("")
Local $websiteitem = TrayCreateItem("网站")
TrayItemSetOnEvent($websiteitem, "TrayMsg")
TrayCreateItem("")
Local $exititem = TrayCreateItem("退出")
TrayItemSetOnEvent($exititem, "TrayMsg")
Local $week[7] = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
Global $hGUI, $GUIMsg
Global $TabHover = False, $TABActiveID = 0, $TabHoverID = -1, $Count = 0
Global $WinWidth = 971, $WinHeight = 651, $TabWidth = 100, $TabHeight = 30, $Tabcount = 4
Global $bannerHeight = 104
Global $hTABCallback = DllCallbackRegister("My_TABProc", "int", "hWnd;uint;wparam;lparam")
Global $tTABCallback = DllCallbackGetPtr($hTABCallback)
$hGUI = GUICreate("Service Desk Helper", $WinWidth, $WinHeight, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_POPUP, $WS_GROUP, $WS_CLIPSIBLINGS))
;--------------------------------------------------------------------------------
Local $version_srv = IniRead(@ScriptDir & "\ini\svrconf.ini", "Config", "Version", "")
Local $download_url = IniRead(@ScriptDir & "\ini\svrconf.ini", "Config", "download_url", "")
Local $download_suffix = IniRead(@ScriptDir & "\ini\svrconf.ini", "Config", "download_suffix", "")
Local $download_action = IniRead(@ScriptDir & "\ini\svrconf.ini", "Config", "download_action", "")
$hStatus = _GUICtrlStatusBar_Create($hGUI)
$pBG = GUICtrlCreatePic(@ScriptDir & "\images\bg_content.jpg", 0, $bannerHeight + $TabHeight, $WinWidth - 1, $WinHeight - ($bannerHeight + $TabHeight) - 1)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel("主程序版本:" & $version_srv, 10, 628, 180, 24)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreateLabel("制作者:冉松", 200, 628, 280, 24)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
Local $size = InetGetSize($download_url & "svrconf.ini")
If $size > 0 Then
GUICtrlCreateIcon(@ScriptDir & "\images\con_ok.ico", -1, 680, 628, 18, 16)
GUICtrlCreateLabel("网络连接成功", 702, 630, 80, 16)
GUICtrlSetFont(-1, 10, 400, '宋体')
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
Local $hDownload = InetGet($download_url & "svrconf.ini", @ScriptDir & "\ini\svrconf.ini", 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
$version_srv = IniRead(@ScriptDir & "\ini\svrconf.ini", "Config", "Version", "")
$version_loc = IniRead(@ScriptDir & "\ini\locconf.ini", "Config", "Version", "")
If $version_srv <> $version_loc Then
If FileExists(@ScriptDir & "" & "uAutoitDownload.exe") Then ShellExecute(@ScriptDir & "" & "uAutoitDownload.exe")
EndIf
Else
GUICtrlCreateIcon(@ScriptDir & "\images\con_bad.ico", -1, 680, 628, 18, 16)
GUICtrlCreateLabel("网络连接异常", 702, 630, 80, 16)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
EndIf
;--------------------------------------------------------------------------------
$BG_banner = GUICtrlCreatePic(@ScriptDir & "\images\bg_banner.jpg", 0, 0, $WinWidth - 1, $bannerHeight)
GUICtrlSetState(-1, $GUI_DISABLE)
$BG_logo = GUICtrlCreatePic(@ScriptDir & "\images\bg_logo.jpg", 5, 2, 23, 22)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel("服务台助手1.0 Beta", 28, 6, 200, 22)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(-1, 10, 600, '宋体')
GUICtrlSetColor(-1, 0xFFFFFF)
;----------------------------------------------------------------------------------------------------------
Global $btn_system[3], $jishu[3]
$btn_system[0] = GUICtrlCreatePic(@ScriptDir & "\images\btn\0.jpg", 396 + 470, 1, 31, 19)
GUICtrlSetCursor(-1, 0)
$btn_system[1] = GUICtrlCreatePic(@ScriptDir & "\images\btn\1.jpg", 427 + 470, 1, 31, 19)
GUICtrlSetCursor(-1, 0)
$btn_system[2] = GUICtrlCreatePic(@ScriptDir & "\images\btn\2.jpg", 458 + 470, 1, 40, 19)
GUICtrlSetCursor(-1, 0)
;---------------------------------------------------------------------------------------------------------
$BG_sl = GUICtrlCreatePic(@ScriptDir & "\images\bg_sl.jpg", 0, $bannerHeight, 2, $TabHeight)
GUICtrlSetState(-1, $GUI_DISABLE)
$BG_sr = GUICtrlCreatePic(@ScriptDir & "\images\bg_sr.jpg", $WinWidth - 3, $bannerHeight, 2, $TabHeight)
GUICtrlSetState(-1, $GUI_DISABLE)
;Local $ico[5], $bj[5], $flag[5], $ID[1]
Local $ico[1], $bj[1], $flag[1]
Local $ID[1]
For $i = 0 To UBound($ico) - 1
$ico[$i] = GUICtrlCreateIcon(@ScriptDir & "\images\app" & $i & ".ico", -1, 5 + (89 * $i), 25, 73, 74)
GUICtrlSetCursor(-1, 0)
Next
GUICtrlSetImage($ico[0], @ScriptDir & "\images\app\0h.ico")
;--------------------------------------------------------------------------------
$tab = GUICtrlCreateTab(2, $bannerHeight, $WinWidth - 4, $WinHeight, BitOR($TCS_FIXEDWIDTH, $TCS_OWNERDRAWFIXED))
$tabHwnd = GUICtrlGetHandle(-1)
_GUICtrlTab_SetItemSize($tab, $TabWidth, $TabHeight)
GUICtrlSetCursor(-1, 0)
;----------------------------------------------------------------------------------------------
GUICtrlCreateTabItem("首页")
Local $k = 0
Dim $link[1], $link_bg[1], $link_tooltips[1], $link_ExePath[1]
$link_ini_file = @ScriptDir & "\ini\link.ini"
$link_type = IniReadSection($link_ini_file, "type")
GUICtrlCreateLabel("你最常用的功能将会出现在这里", 120, 160, 400, 24)
GUICtrlSetFont(-1, 11, 400, '宋体')
GUICtrlSetColor(-1, 0x868686)
For $i = 1 To $link_type[0][0]
GUICtrlCreateLabel($link_type[$i][1], 45, 160 + (140 * ($i - 1)), 80, 24)
GUICtrlSetFont(-1, 11, 600, '宋体')
GUICtrlSetColor(-1, 0x047ecb)
$link_sub = IniReadSection($link_ini_file, $link_type[$i][1] & ".list") ;读取分类数量
For $x = 1 To $link_sub[0][0] ;循环
$link_info1 = IniReadSection($link_ini_file, $link_sub[$x][1]) ;读取分类字段名
ReDim $link[$k + 1]
ReDim $link_bg[$k + 1]
ReDim $link_tooltips[$k + 1]
ReDim $link_ExePath[$k + 1]
$link_ExePath[$k] = $link_info1[3][1]
$link_tooltips[$k] = $link_info1[4][1]
;$link[$k] = GUICtrlCreateButton('', 5 + (90 * $x), 200 + (140 * ($i - 1)), 56, 56, BitOR($BS_MULTILINE, $BS_BOTTOM))
;_GUICtrlButton_SetImageList(-1, _GetImageListHandle(@ScriptDir & $link_info1[2][1], 125 + $x, True), 5)
;$link_hover[$k]=GUICtrlCreatePic("out.gif",5 + (110 * $x), 200 + (140 * ($i - 1)),152,85)
$link_bg[$k] = GUICtrlCreatePic("",5 - 8 + (110 * $x), 200 - 8 + (140 * ($i - 1)),80,80)
GUICtrlSetCursor(-1, 0)
$link[$k] =GUICtrlCreatePic("",5 + (110 * $x), 200 + (140 * ($i - 1)), 64, 64)
GUICtrlSetCursor(-1, 0)
_SetImage(-1,@ScriptDir & $link_info1[2][1])
GUICtrlCreateLabel($link_info1[1][1], 5 + (110 * $x) - 10, 275 + (140 * ($i - 1)), 86, 24, $SS_CENTER)
GUICtrlSetFont(-1, 10, 400, '宋体')
$k += 1
Next
Next
Local $Link_Flag[UBound($link)]
;-----------------------------------------------------------------------------------------------
GUICtrlCreateTabItem("信息查询")
$url = "http://10.43.8.44/jquery-easyui-1.3.2/demo/flat/index.php"
_oIE($url)
;-----------------------------------------------------------------------------------------------
GUICtrlCreateTabItem("文件服务器")
Local $k = 0, $yy = 0
Dim $file_srv[1], $file_srv_bg[1], $file_srv_tooltips[1], $file_srv_ExePath[1]
$file_srv_ini_file = @ScriptDir & "\ini\file_srv.ini"
$file_srv_type = IniReadSection($file_srv_ini_file, "type")
GUICtrlCreateLabel("所有文件服务器在这里", 110, 155, 400, 24)
GUICtrlSetFont(-1, 11, 400, '宋体')
GUICtrlSetColor(-1, 0x868686)
For $i = 1 To $file_srv_type[0][0]
If $i>1 Then
GUICtrlCreateLabel('', 105, 155 + (100 * ($i - 1))+ $yy + 6, 820, 1, $SS_ETCHEDHORZ)
EndIf
GUICtrlCreateLabel($file_srv_type[$i][1], 5, 155 + (100 * ($i - 1))+ $yy, 100, 24, $SS_RIGHT)
GUICtrlSetFont(-1, 11, 600, '宋体')
GUICtrlSetColor(-1, 0x047ecb)
$file_srv_sub = IniReadSection($file_srv_ini_file, $file_srv_type[$i][1] & ".list") ;读取分类数量
For $x = 1 To $file_srv_sub[0][0] ;循环
$file_srv_info1 = IniReadSection($file_srv_ini_file, $file_srv_sub[$x][1]) ;读取分类字段名
ReDim $file_srv[$k + 1]
ReDim $file_srv_bg[$k + 1]
ReDim $file_srv_tooltips[$k + 1]
ReDim $file_srv_ExePath[$k + 1]
$file_srv_ExePath[$k] = $file_srv_info1[3][1]
$file_srv_tooltips[$k] = $file_srv_info1[4][1]
If $x<6 Then
;$file_srv[$k] = GUICtrlCreateButton('', 50 + (180 * ($x - 1)), 170 + (100 * ($i - 1)) + $yy, 48, 48, BitOR($BS_MULTILINE, $BS_BOTTOM))
;_GUICtrlButton_SetImageList(-1, _GetImageListHandle(@ScriptDir & $file_srv_info1[2][1], 125 + $x, True), 5)
;GUICtrlSetCursor(-1, 0)
$file_srv_bg[$k] = GUICtrlCreatePic("",20 -4 + (180 * ($x - 1)), 180 - 4 + (100 * ($i - 1)) + $yy + 10, 178, 56)
GUICtrlSetCursor(-1, 0)
$file_srv[$k] =GUICtrlCreatePic("",20 + (180 * ($x - 1)), 180 + (100 * ($i - 1)) + $yy + 10, 48, 48)
GUICtrlSetCursor(-1, 0)
_SetImage(-1,@ScriptDir & $file_srv_info1[2][1])
GUICtrlCreateLabel($file_srv_info1[1][1], 18 + 65 + (180 * ($x - 1)) - 10, 180 + (100 * ($i - 1)) + $yy + 10 + 10, 96, 28)
GUICtrlSetFont(-1, 10, 400, '宋体')
ElseIf 5<$x<12 Then
$xx = $x - 5
;$file_srv[$k] = GUICtrlCreateButton('', 50 + (180 * ($xx - 1)), 170 + (100 * ($i)) - 30, 48, 48, BitOR($BS_MULTILINE, $BS_BOTTOM))
;_GUICtrlButton_SetImageList(-1, _GetImageListHandle(@ScriptDir & $file_srv_info1[2][1], 125 + $x, True), 5)
;GUICtrlSetCursor(-1, 0)
$file_srv_bg[$k] = GUICtrlCreatePic("",20 - 4 + (180 * ($xx - 1)), 180 - 4 + (100 * ($i)) - 30, 178, 56)
GUICtrlSetCursor(-1, 0)
$file_srv[$k] =GUICtrlCreatePic("",20 + (180 * ($xx - 1)), 180 + (100 * ($i)) - 30, 48, 48)
GUICtrlSetCursor(-1, 0)
_SetImage(-1,@ScriptDir & $file_srv_info1[2][1])
GUICtrlCreateLabel($file_srv_info1[1][1], 18 + 65 + (180 * ($xx - 1)) - 10, 180 + (100 * ($i)) - 30 + 10, 96, 28)
GUICtrlSetFont(-1, 10, 400, '宋体')
$yy = 100 - 30
Else
MsgBox(0,0,"请联系系统管理员!")
EndIf
$k += 1
Next
Next
Local $file_srv_Flag[UBound($file_srv)]
;-----------------------------------------------------------------------------------------------
GUICtrlCreateTabItem("关于软件")
Local $startHeight = 150, $offsetHeight = 30
GUICtrlCreateLabel("服务台助手", 20, $startHeight, 800, 20)
GUICtrlSetFont(-1, 14, 600, '宋体')
$str = "软件大小:2.19M 更新日期:2013-11-28 最新版本:" & $version_srv
GUICtrlCreateLabel($str, 40, $startHeight + $offsetHeight, 800, 20)
GUICtrlSetFont(-1, 11, 400, '宋体')
GUICtrlCreateLabel("软件位数:32位 支持系统:winxp/win7", 40, $startHeight + $offsetHeight * 2, 800, 20)
GUICtrlSetFont(-1, 11, 400, '宋体')
GUICtrlCreateLabel("软件简介", 20, $startHeight + $offsetHeight * 3, 800, 20)
GUICtrlSetFont(-1, 12, 600, '宋体')
GUICtrlCreateLabel("服务台助手是一款由Joy Ran开发的基于用户界面设计的自助服务办公软件。", 40, $startHeight + $offsetHeight * 4, 800, 20)
GUICtrlSetFont(-1, 11, 400, '宋体')
GUICtrlCreateLabel("制作者:冉松", 40, $startHeight + $offsetHeight * 5, 800, 20)
GUICtrlSetFont(-1, 11, 400, '宋体')
GUICtrlCreateLabel("软件网站:http://10.43.8.44", 40, $startHeight + $offsetHeight * 6, 800, 20)
GUICtrlSetFont(-1, 11, 400, '宋体')
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlCreateLabel("版本特征", 20, $startHeight + $offsetHeight * 7, 800, 20)
GUICtrlSetFont(-1, 12, 600, '宋体')
GUICtrlCreateLabel("1.友好的用户界面设计,便于用户快速上手", 40, $startHeight + $offsetHeight * 8, 800, 20)
GUICtrlSetFont(-1, 12, 400, '宋体')
GUICtrlCreateLabel("2.方便用户访问公司资源。如网站、文件服务器、应用系统、软件下载", 40, $startHeight + $offsetHeight * 9, 800, 20)
GUICtrlSetFont(-1, 12, 400, '宋体')
GUICtrlCreateLabel("3.基于Windows系统组件开发,稳定并易于扩展", 40, $startHeight + $offsetHeight * 10, 800, 20)
GUICtrlSetFont(-1, 12, 400, '宋体')
GUICtrlCreateLabel("4.软件版本自动检测升级", 40, $startHeight + $offsetHeight * 11, 800, 20)
GUICtrlSetFont(-1, 12, 400, '宋体')
GUICtrlCreateTabItem("")
$hdisplayDC = _WinAPI_CreateDC()
;初始化选项卡图像DC
$MyhImage = _WinAPI_LoadImage(0, @ScriptDir & "\images\officeh.bmp", $IMAGE_BITMAP, 0, 0, $LR_LOADFROMFILE)
$hBmpDC = _WinAPI_CreateCompatibleDC($hdisplayDC)
$hBmpSv = _WinAPI_SelectObject($hBmpDC, $MyhImage)
_WinAPI_DeleteObject($MyhImage)
;初始化临时DC,也就是二次缓冲,防止闪烁
$hTempDC = _WinAPI_CreateCompatibleDC($hdisplayDC)
$hTempImage = _WinAPI_CreateCompatibleBitmap($hdisplayDC, $TabWidth * $Tabcount, $TabHeight)
$hTempSv = _WinAPI_SelectObject($hTempDC, $hTempImage)
_WinAPI_DeleteObject($hTempImage)
_WinAPI_DeleteDC($hdisplayDC)
Global $TABCallProc = _WinAPI_SetWindowLong(GUICtrlGetHandle($tab), -4, $tTABCallback)
;-------------------------------------------------------------------------------------
Global $mzwidth = 29, $mzheight = 17
Global $mytupian = @ScriptDir & "\images\arrow.png"
Global $mao_gui = GUICreate("", $mzwidth, $mzheight, 764, -$mzheight + 4, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD, $WS_EX_TRANSPARENT), $hGUI)
_maozi()
_GUIRoundCorners($hGUI, 0, 0, 4, 4)
GUISetState(@SW_SHOW, $mao_gui)
GUISetState(@SW_SHOW, $hGUI)
While 1
$GUIMsg = GUIGetMsg()
;-------------------------------------------------------------------------------------
$i = 1
If $jishu[$i] = 0 Then
If _Hover($hGUI, 427 + 470, 1, 31, 19) = 1 Then
GUICtrlSetImage($btn_system[$i], @ScriptDir & "\images\btn" & $i & "h.jpg")
$jishu[$i] = 1
EndIf
Else
If _Hover($hGUI, 427 + 470, 1, 31, 19) = 0 Then
GUICtrlSetImage($btn_system[$i], @ScriptDir & "\images\btn" & $i & ".jpg")
$jishu[$i] = 0
EndIf
EndIf
$i = 2
If $jishu[$i] = 0 Then
If _Hover($hGUI, 458 + 470, 1, 40, 19) = 1 Then
GUICtrlSetImage($btn_system[$i], @ScriptDir & "\images\btn" & $i & "h.jpg")
$jishu[$i] = 1
EndIf
Else
If _Hover($hGUI, 458 + 470, 1, 40, 19) = 0 Then
GUICtrlSetImage($btn_system[$i], @ScriptDir & "\images\btn" & $i & ".jpg")
$jishu[$i] = 0
EndIf
EndIf
;-------------------------------------------------------------------------------------
$ID = GUIGetCursorInfo($hGUI)
For $k = 0 To UBound($ico) - 1
If $ID[4] = $ico[$k] And $bj[$k] = 0 Then
GUICtrlSetImage($ico[$k], @ScriptDir & "\images\app" & $k & "h.ico")
$bj[$k] = 1
ElseIf $ID[4] <> $ico[$k] And $bj[$k] = 1 And $flag[$k] <> 1 Then
GUICtrlSetImage($ico[$k], @ScriptDir & "\images\app" & $k & ".ico")
$bj[$k] = 0
EndIf
Next
For $i = 0 To UBound($ico) - 1
If $GUIMsg = $ico[$i] Then
If $i <> 0 Then
GUICtrlSetImage($ico[0], @ScriptDir & "\images\app\0.ico")
EndIf
$flag[$i] = 1
For $j = 0 To UBound($ico) - 1
If $i <> $j Then
$flag[$j] = 0
EndIf
Next
EndIf
Next
;--------------------------------------Links-------------------------------------------------
For $k = 0 To UBound($link) - 1
$pos = ""
If $ID[4] = $link[$k] And $Link_Flag[$k] = 0 Then
GUICtrlSetImage($link_bg[$k],@ScriptDir & "\images\link\over.gif")
ToolTip($link_tooltips[$k])
#cs
$pos = ControlGetPos("","",$link_bg[$k])
If Not @error Then
ToolTip($link_tooltips[$k],$pos[0]+65,$pos[1]+99,"",0,3)
EndIf
#ce
$Link_Flag[$k] = 1
Sleep(200)
ElseIf $ID[4] <> $link[$k] And $Link_Flag[$k] = 1 Then
GUICtrlSetImage($link_bg[$k],"")
ToolTip("")
$Link_Flag[$k] = 0
Sleep(200)
EndIf
Next
For $i = 0 To UBound($link) - 1
If $GUIMsg = $link_bg[$i] Then
$result = StringLeft($link_ExePath[$i], 3)
If $result = "IE:" Then
$url = StringMid($link_ExePath[$i], 4, StringLen($link_ExePath[$i]) - 3)
ShellExecute("C:\Program Files\Internet Explorer\iexplore.exe", $url)
Else
ShellExecute($link_ExePath[$i])
EndIf
EndIf
Next
;--------------------------------------File_Srv-------------------------------------------------
For $k = 0 To UBound($file_srv) - 1
If $ID[4] = $file_srv[$k] And $file_srv_Flag[$k] = 0 Then
;ToolTip($file_srv_tooltips[$k])
;$file_srv_Flag[$k] = 1
GUICtrlSetImage($file_srv_bg[$k],@ScriptDir & "\images\file_srv\over.gif")
#cs
$pos = ControlGetPos("","",$file_srv_bg[$k])
If Not @error Then
ToolTip($file_srv_tooltips[$k],$pos[0]+65,$pos[1]+99,"",0,3)
EndIf
#ce
$file_srv_Flag[$k] = 1
Sleep(200)
ElseIf $ID[4] <> $file_srv[$k] And $file_srv_Flag[$k] = 1 Then
;ToolTip("")
;$file_srv_Flag[$k] = 0
GUICtrlSetImage($file_srv_bg[$k],"")
;ToolTip("")
$file_srv_Flag[$k] = 0
Sleep(200)
EndIf
Next
For $i = 0 To UBound($file_srv) - 1
If $GUIMsg = $file_srv_bg[$i] Then
$result = StringLeft($file_srv_ExePath[$i], 3)
If $result = "IE:" Then
$url = StringMid($file_srv_ExePath[$i], 4, StringLen($file_srv_ExePath[$i]) - 3)
ShellExecute("C:\Program Files\Internet Explorer\iexplore.exe", $url)
Else
ShellExecute($file_srv_ExePath[$i])
EndIf
EndIf
Next
;---------------------------------------------------------------------------------------
Switch $GUIMsg
Case $btn_system[0]
$url = "http://10.43.8.44/jquery-easyui-1.3.2/demo/flat/index.php"
ShellExecute("C:\Program Files\Internet Explorer\iexplore.exe", $url)
Case $btn_system[1]
GUISetState(@SW_MINIMIZE, $hGUI)
Case $btn_system[2]
GUISetState(@SW_HIDE, $hGUI)
GUISetState(@SW_HIDE, $mao_gui)
Case $GUI_EVENT_CLOSE
_myexitfunc()
Case $GUI_EVENT_PRIMARYDOWN
mouseCHK()
EndSwitch
WEnd
;托盘函数事件
Func TrayMsg() ;系统托盘
Switch @TRAY_ID
Case $aboutitem
MsgBox(64, "关于软件", "服务台助手1.0正式版 | 制作者:冉松")
Case $websiteitem
$url = "http://10.43.8.44/jquery-easyui-1.3.2/demo/flat/index.php"
ShellExecute("C:\Program Files\Internet Explorer\iexplore.exe", $url)
Case $exititem
_myexitfunc()
EndSwitch
EndFunc ;==>TrayMsg
Func _showwin()
GUISetState(@SW_SHOW, $hGUI)
GUISetState(@SW_SHOW, $mao_gui)
Return
EndFunc ;==>_showwin
;退出函数,退出前要改回TAB原来的处理函数,不然退出要报错
Func _myexitfunc()
_WinAPI_SetWindowLong(GUICtrlGetHandle($tab), -4, $TABCallProc)
DllCallbackFree($hTABCallback)
;删除DC
_WinAPI_SelectObject($hBmpDC, $hBmpSv)
_WinAPI_DeleteDC($hBmpDC)
_WinAPI_SelectObject($hTempDC, $hTempSv)
_WinAPI_DeleteDC($hTempDC)
Exit
EndFunc ;==>_myexitfunc
Func My_TABProc($hWnd, $msg, $wParam, $lParam)
Switch $msg
Case $WM_MOUSEMOVE
If Not $TabHover Then;
$TabHover = True
_WinAPI_TrackMouseEvent($hWnd, 0x00000002)
EndIf
$mx = _WinAPI_LoWord($lParam)
$my = _WinAPI_HiWord($lParam)
onMouseMove($hWnd, $mx, $my)
Return 0
Case 0x2A3;WM_MOUSELEAVE
$TabHover = False
$TabHoverID = -1
RedrawAllTAB()
Return 0
Case $WM_ERASEBKGND
_JiuGongDraw($wParam, 0, 0, $WinWidth, $WinHeight, $hBmpDC, 19, 25, 1, 2, 0, 0, 0, 0)
_JiuGongDraw($wParam, 0, 0, $WinWidth, $TabHeight, $hBmpDC, 0, 0, 1, 27, 0, 0, 0, 1)
Return 0
Case $WM_LBUTTONDOWN
$mx = _WinAPI_LoWord($lParam)
$my = _WinAPI_HiWord($lParam)
onMouseDown($hWnd, $mx, $my)
Return _WinAPI_CallWindowProc($TABCallProc, $hWnd, $msg, $wParam, $lParam)
Case $WM_PAINT
If $Count = 0 Then
Local $tPAINTSTRUCT, $hDC
$Count += 1
$hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT)
RedrawAllTAB()
_WinAPI_EndPaint($hWnd, $tPAINTSTRUCT)
$Count -= 1
Return 0
EndIf
EndSwitch
Return _WinAPI_CallWindowProc($TABCallProc, $hWnd, $msg, $wParam, $lParam)
EndFunc ;==>My_TABProc
Func onMouseMove($hWnd, $mx, $my)
If $my <= $TabHeight Then
$Idx = Int($mx / $TabWidth)
If $Idx >= 0 And $Idx <= $Tabcount - 1 Then
If $Idx <> $TabHoverID Then
$TabHoverID = $Idx
RedrawAllTAB()
EndIf
Else
If $TabHoverID <> -1 Then
$TabHoverID = -1
RedrawAllTAB()
EndIf
EndIf
Else
If $TabHoverID >= 0 Then
$TabHoverID = -1
RedrawAllTAB()
EndIf
EndIf
EndFunc ;==>onMouseMove
Func onMouseDown($hWnd, $mx, $my)
If $my <= $TabHeight Then
$Idx = Int($mx / $TabWidth)
If $Idx >= 0 And $Idx <= $Tabcount - 1 Then
$TABActiveID = $Idx
EndIf
EndIf
EndFunc ;==>onMouseDown
Func RedrawAllTAB()
For $i = 0 To $Tabcount - 1
If $i = $TabHoverID Then
$stata = 1
Else
$stata = 0
EndIf
DrawTAB($hTempDC, $i, $stata, $i * $TabWidth, 0, $TabWidth, $TabHeight)
Next
$hDC = _WinAPI_GetDC($tabHwnd)
_WinAPI_BitBlt($hDC, 0, 0, $TabWidth * $Tabcount, $TabHeight, $hTempDC, 0, 0, $SRCCOPY)
_WinAPI_ReleaseDC($tabHwnd, $hDC)
EndFunc ;==>RedrawAllTAB
Func DrawTAB($hDC, $nTabID, $TabState, $nLeft, $nTop, $nRight, $nBottom)
;这里的数字是由于图像文件决定的
If $nTabID = $TABActiveID Then;相等就是当前选项卡
_JiuGongDraw($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBmpDC, 13 + $TabState * 13, 0, 13, 27, 6, 5, 6, 2);$TabState是Hover标志
Else
If $TabState = 0 Then
_JiuGongDraw($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBmpDC, 0, 0, 1, 27, 0, 0, 0, 1)
Else
_JiuGongDraw($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBmpDC, 0, 0, 13, 27, 6, 5, 6, 2)
EndIf
EndIf
;绘制选项卡文字
$tRECT = DllStructCreate($tagRect)
DllStructSetData($tRECT, "Left", $nLeft)
DllStructSetData($tRECT, "Top", $nTop)
DllStructSetData($tRECT, "Right", $nRight + $nLeft)
DllStructSetData($tRECT, "Bottom", $nBottom)
_WinAPI_SetBkMode($hDC, $TRANSPARENT)
$hFont = _WinAPI_CreateFont(14, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _
$OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial')
$hOldFont = _WinAPI_SelectObject($hDC, $hFont)
_WinAPI_DrawText($hDC, _GUICtrlTab_GetItemText($tab, $nTabID), $tRECT, BitOR($DT_CENTER, $DT_VCENTER, $DT_SINGLELINE))
_WinAPI_SelectObject($hDC, $hOldFont)
_WinAPI_DeleteObject($hFont)
Return 1
EndFunc ;==>DrawTAB
;九宫格绘图,参数依次为:目标DC,左,上,长,高,图像DC,左,上,长,高,左上角的长,左上角的高,右下角的长,右下角的高
Func _JiuGongDraw($hDC, $dstX, $dstY, $dstWidth, $dstHeight, $hSrcDC, $SrcX, $SrcY, $srcWidth, $srcHeight, $gX1 = 0, $gY1 = 0, $gX2 = 0, $gY2 = 0)
If $dstWidth = 0 Or $dstHeight = 0 Or $srcWidth = 0 Or $srcHeight = 0 Then Return
Local $hmenDC = _WinAPI_CreateCompatibleDC($hDC)
Local $hSource = _WinAPI_CreateCompatibleBitmap($hDC, $dstWidth, $dstHeight)
Local $hSv = _WinAPI_SelectObject($hmenDC, $hSource)
If $gX1 <= 0 And $gX2 <= 0 And $gY1 <= 0 And $gY2 <= 0 Then
_WinApi_StretchBlt($hmenDC, 0, 0, $dstWidth, $dstHeight, $hSrcDC, $SrcX + $gX1, $SrcY + $gY1, $srcWidth - $gX2, $srcHeight - $gY2, $SRCCOPY)
Else
If $gX1 > 0 And $gY1 > 0 Then ;左上角
_WinAPI_BitBlt($hmenDC, 0, 0, $gX1, $gY1, $hSrcDC, $SrcX, $SrcY, $SRCCOPY)
EndIf
If $gX2 > 0 And $gY1 > 0 Then ;右上角
_WinAPI_BitBlt($hmenDC, $dstWidth - $gX2, 0, $gX2, $gY1, $hSrcDC, $SrcX + $srcWidth - $gX2, $SrcY, $SRCCOPY)
EndIf
If $gX1 > 0 And $gY2 > 0 Then ;左下角
_WinAPI_BitBlt($hmenDC, 0, $dstHeight - $gY2, $gX1, $gY2, $hSrcDC, $SrcX, $SrcY + $srcHeight - $gY2, $SRCCOPY)
EndIf
If $gX2 > 0 And $gY2 > 0 Then ;右下角
_WinAPI_BitBlt($hmenDC, $dstWidth - $gX2, $dstHeight - $gY2, $gX2, $gY2, $hSrcDC, $SrcX + $srcWidth - $gX2, $SrcY + $srcHeight - $gY2, $SRCCOPY)
EndIf
If $gX1 > 0 Then ;左边框
_WinApi_StretchBlt($hmenDC, 0, $gY1, $gX1, $dstHeight - $gY1 - $gY2, $hSrcDC, $SrcX, $SrcY + $gY1, $gX1, $srcHeight - $gY1 - $gY2, $SRCCOPY)
EndIf
If $gX2 > 0 Then ;右边框
_WinApi_StretchBlt($hmenDC, $dstWidth - $gX2, $gY1, $gX2, $dstHeight - $gY1 - $gY2, $hSrcDC, $SrcX + $srcWidth - $gX2, $SrcY + $gY1, $gX2, $srcHeight - $gY1 - $gY2, $SRCCOPY)
EndIf
If $gY1 > 0 Then ;上边框
_WinApi_StretchBlt($hmenDC, $gX1, 0, $dstWidth - $gX1 - $gX2, $gY1, $hSrcDC, $SrcX + $gX1, $SrcY, $srcWidth - $gX1 - $gX2, $gY1, $SRCCOPY)
EndIf
If $gY2 > 0 Then ;下边框
_WinApi_StretchBlt($hmenDC, $gX1, $dstHeight - $gY2, $dstWidth - $gX1 - $gX2, $gY2, $hSrcDC, $SrcX + $gX1, $SrcY + $srcHeight - $gY2, $srcWidth - $gX1 - $gX2, $gY2, $SRCCOPY)
EndIf
;中间的伸展部分
_WinApi_StretchBlt($hmenDC, $gX1, $gY1, $dstWidth - $gX1 - $gX2, $dstHeight - $gY1 - $gY2, $hSrcDC, $SrcX + $gX1, $SrcY + $gY1, $srcWidth - $gX1 - $gX2, $srcHeight - $gY1 - $gY2, $SRCCOPY)
EndIf
_WinAPI_BitBlt($hDC, $dstX, $dstY, $dstWidth, $dstHeight, $hmenDC, 0, 0, $SRCCOPY)
_WinAPI_SelectObject($hmenDC, $hSv)
_WinAPI_DeleteObject($hSource)
_WinAPI_DeleteDC($hmenDC)
EndFunc ;==>_JiuGongDraw
Func _WinAPI_CreateDC()
Local $aResult = DllCall("gdi32.dll", "handle", "CreateDC", "str", "DISPLAY", "str", "", "str", "", "ptr", 0)
If @error Then Return SetError(@error, @extended, 0)
Return $aResult[0]
EndFunc ;==>_WinAPI_CreateDC
;--------------------------------------------------------------------------------------------------------
Func _API_SetLayeredWindowAttributes($hWnd, $i_transcolor, $Transparency = 255, $isColorRef = True)
Local Const $AC_SRC_ALPHA = 1
Local Const $ULW_ALPHA = 2
Local Const $LWA_ALPHA = 0x2
Local Const $LWA_COLORKEY = 0x1
If Not $isColorRef Then
$i_transcolor = Hex(String($i_transcolor), 6)
$i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hWnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
Select
Case @error
Return SetError(@error, 0, 0)
Case $Ret[0] = 0
Return SetError(4, 0, 0)
Case Else
Return 1
EndSelect
EndFunc ;==>_API_SetLayeredWindowAttributes
;-----------------------------------------------------------------------------------
Func _oIE($url)
$oIE = ObjCreate("Shell.Explorer.2")
$GUIActiveX = GUICtrlCreateObj($oIE, 0, $bannerHeight + $TabHeight, $WinWidth, $WinHeight - $bannerHeight - $TabHeight - 26)
$oIE.document.body.scroll = "no"
$oIE.navigate($url)
Sleep(1000)
EndFunc ;==>_oIE
;------------------------------------------------------------------------------------
; using image list to set 1 image and have text on button
Func _GetImageListHandle($sFile, $nIconID = 0, $fLarge = False)
Local $iSize = 48
Local $hImage = _GUIImageList_Create($iSize, $iSize, 5, 3)
_GUIImageList_AddIcon($hImage, $sFile, 0, $fLarge)
;_GUIImageList_AddBitmap($hImage, $sFile)
Return $hImage
EndFunc ;==>_GetImageListHandle
;------------------------------------------------------------------------------------
Func _GUIRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
Local $XS_pos, $XS_ret, $XS_ret2
$XS_pos = WinGetPos($h_win)
$XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3)
If $XS_ret[0] Then
$XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1)
EndIf
EndFunc ;==>_GUIRoundCorners
;------------------------------------------------------------------------------------
Func _Hover($cH_hWin = "", $Pos_X = 0, $Pos_Y = 0, $Pos_W = 0, $Pos_H = 0)
$cH_Data = GUIGetCursorInfo($cH_hWin)
If Not IsArray($cH_Data) Then Return SetError(10086)
If $cH_Data[0] > $Pos_X And $cH_Data[0] < $Pos_X + $Pos_W And $cH_Data[1] > $Pos_Y And $cH_Data[1] < $Pos_Y + $Pos_H Then
Return 1
Else
Return 0
EndIf
EndFunc ;==>_Hover
;------------------------------------------------------------------------------------
Func mouseCHK()
$MS = GUIGetCursorInfo($hGUI)
If $MS[4] = $BG_banner Then move()
EndFunc ;==>mouseCHK
Func move()
Local $PosDiff[2], $MousePos, $WinPos
$MousePos = MouseGetPos()
$WinPos = WinGetPos($hGUI, "")
$PosDiff[0] = $WinPos[0] - $MousePos[0]
$PosDiff[1] = $WinPos[1] - $MousePos[1]
While _IsPressed("01", DllOpen("user32.dll"))
$MousePos = MouseGetPos()
WinMove($hGUI, "", $MousePos[0] + $PosDiff[0], $MousePos[1] + $PosDiff[1])
Sleep(10)
WEnd
EndFunc ;==>move
;------------------------------------------------------------------------------------
Func _maozi()
_GDIPlus_Startup()
Local $hHBITMAP = _WinAPI_CreateBitmap($mzwidth, $mzheight, 1, 32)
Local $hCDC = _WinAPI_CreateCompatibleDC(0)
Local $hOld = _WinAPI_SelectObject($hCDC, $hHBITMAP)
Local $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hCDC)
Local $kzImage = _GDIPlus_ImageLoadFromFile($mytupian)
_GDIPlus_GraphicsDrawImageRectRect($hGraphic, $kzImage, 0, 0, _GDIPlus_ImageGetWidth($kzImage), _GDIPlus_ImageGetHeight($kzImage), 0, 0, $mzwidth, $mzheight)
_GDIPlus_ImageDispose($kzImage)
_GDIPlus_GraphicsDispose($hGraphic)
_WinAPI_SelectObject($hCDC, $hOld)
_WinAPI_DeleteDC($hCDC)
_GDIPlus_Shutdown()
_WinAPI_UpdateLayeredWindowEx($mao_gui, -1, -1, $hHBITMAP, 255, 1)
EndFunc ;==>_maozi