#NoTrayIcon
#include <GuiConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <GuiToolBar.au3>
#include <GuiToolTip.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <FontConstants.au3>
Opt("GuiOnEventMode", 1)
#region variables and settings
Global $MSG_NOTIFY
Global Enum $ToolBar_Open = 1000, $ToolBar_Close, $ToolBar_Extract, $ToolBar_View, $ToolBar_Test, $ToolBar_Decrypt
#endregion variables and settings
#region GUI
;===============# Main GUI #===============================================
$hGUIMain = GUICreate("管理工具", @DesktopWidth - 10, 79, 0, 0)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$hToolBar = _GUICtrlToolbar_Create($hGUIMain, $TBSTYLE_FLAT)
$hToolBar_Image = _GUIImageList_Create(1, 1, 1, 1)
_GUIImageList_AddIcon($hToolBar_Image, @ScriptDir & "\sicon.DLL", 1, True)
_GUIImageList_AddIcon($hToolBar_Image, @ScriptDir & "\sicon.DLL", 2, True)
_GUIImageList_AddIcon($hToolBar_Image, @ScriptDir & "\sicon.DLL", 3, True)
_GUIImageList_AddIcon($hToolBar_Image, @ScriptDir & "\sicon.DLL", 4, True)
_GUIImageList_AddIcon($hToolBar_Image, @ScriptDir & "\sicon.DLL", 5, True)
_GUIImageList_AddIcon($hToolBar_Image, @ScriptDir & "\sicon.DLL", 6, True)
_GUICtrlToolbar_SetImageList($hToolBar, $hToolBar_Image)
$STEP1 = _GUICtrlToolbar_AddString($hToolBar, "测试一下")
$CloseString = _GUICtrlToolbar_AddString($hToolBar, " 进程管理 ")
$ExtractString = _GUICtrlToolbar_AddString($hToolBar, " 垃圾清理 ")
$ViewString = _GUICtrlToolbar_AddString($hToolBar, " 系统安全 ")
$TestString = _GUICtrlToolbar_AddString($hToolBar, " Test ")
_GUICtrlToolbar_AddButton($hToolBar, $ToolBar_Open, 0, $STEP1) ;窗口管理
_GUICtrlToolbar_AddButtonSep($hToolBar)
_GUICtrlToolbar_AddButton($hToolBar, $ToolBar_Close, -1, $CloseString)
_GUICtrlToolbar_AddButtonSep($hToolBar)
;设置字体
$hFont = _WinAPI_CreateFont(16, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, '黑体')
_WinAPI_SetFont($hToolBar, $hFont, True)
_GUICtrlToolbar_SetButtonSize($hToolBar,40, 320)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUISetState(@SW_SHOW, $hGUIMain)
#endregion GUI
If $CmdLine[0] > 0 Then ; 每个事件都需建这个东东
_SelectArchive() ; 关联第95行
EndIf ;
While 1
_GetMsgNotify()
Sleep(100)
WEnd
Func _Exit()
Exit
EndFunc ;==>_Exit
Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
Local $tNMHDR, $hWndFrom, $iCode, $tNMTOOLBAR, $iItem
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
$tNMTOOLBAR = DllStructCreate($tagNMTOOLBAR, $lParam)
$iItem = DllStructGetData($tNMTOOLBAR, "iItem")
Switch $hWndFrom
Case $hToolBar
Switch $iCode
Case $NM_LDOWN
Switch $iItem
Case $ToolBar_Open ;这是读取第37行的。
$MSG_NOTIFY = "MenuOpen" ;第102行
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
Func _GetMsgNotify();获取事件
Switch $MSG_NOTIFY
Case "MenuOpen"
_SelectArchive() ;第95行
Case "MenuExit"
_Exit()
EndSwitch
$MSG_NOTIFY = ""
EndFunc ;==>_GetMsgNotify
Func _SelectArchive()
Run("Notepad.exe")
EndFunc ;==>_SelectArchive
不完全解决办法 !~~