【已解决】 求助 点击按钮控件后,主菜单不退出的,解决办法!
本帖最后由 franly 于 2015-11-22 23:09 编辑点击菜单中的,按钮后,主菜单就退出了!怎么解决,让菜单常在,直到我们自己手动关!
分享个菜单!
代码如下:
#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Icon=D:\autoit3\Aut2Exe\Icons\favicon.ico
#PRE_Outfile=MINI菜单.exe
#PRE_Compression=4
#PRE_Res_Comment=MINI菜单
#PRE_Res_Description=MINI菜单
#PRE_Res_Fileversion=1.0.0.0
#PRE_Res_LegalCopyright=by MINI菜单
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>
If Not FileExists("menu.ini") Then
IniWrite("menu.ini","title","title","软件菜单")
IniWrite("menu.ini","command","菜单名称1","路径1")
IniWrite("menu.ini","command","菜单名称2","路径2")
IniWrite("menu.ini","command","菜单名称3","路径3")
IniWrite("menu.ini","command","菜单名称4","路径4")
IniWrite("menu.ini","command","以此类推","有多少写多少,最多不超20个为宜")
EndIf
Global $Form
Opt("GUIOnEventMode", 1)
$Command = IniReadSection("menu.ini", "command")
$title=IniRead("menu.ini","title","title","")
$height2=$Command*45
$Form1 = GUICreate($title, 150, $height2+20, -1, -1,BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
For $I = 1 To $Command
$Command[$i] = GUICtrlCreateButton($Command[$i], 16, 16+($i-1)*45, 123, 40)
$img= _GUIImageList_Create(32, 32, 5, 1, 0)
_GUIImageList_AddIcon($img, $Command[$I], 0, True)
_GUICtrlButton_SetImageList(-1, $img)
GUICtrlSetOnEvent($Command[$I], "Command")
Next
;DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 1000, "long", 0x00080000)
GUISetState()
While 1
Sleep(1000)
WEnd
Func Command()
For $i = 1 To UBound($Command, 1) - 1
If @GUI_CtrlId = $Command[$I] Then Run($Command[$I],StringLeft ( $Command[$I], StringInStr($Command[$I], "\",0,-1)))
Next
_exit()
EndFunc
Func _Exit()
;DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 1000, "long", 0x00090000);渐隐
;DllCall($dll, "int:cdecl", "DeInitDecoration")
;DllCall($dll, "int:cdecl", "RemoveSkin")
;DllClose($dll)
;FileDelete(@TempDir&"\SkinCrafterDll.dll")
;FileDelete(@TempDir&"\skin.skf")
Exit
EndFunc ;_exit() 在那里加,请教2楼,求解 急,求解呀!大神们,请指教哟! 回复 3# franly
发帖不按规范,代码不用代码标签,我如何指出哪一行? 回复 5# afan 怎么标签? 置顶帖
http://www.autoitx.com/thread-18544-1-1.html
第三条
可以删除,也可以加分号注释掉 回复 9# fuldho 删除了,和加了分号都不行呀! 回复 8# afan 版主求解呀! 本帖最后由 afan 于 2015-11-22 21:48 编辑
回复 11# franly
因为你不愿编辑帖子,9#的坛友只能给你上贴图说明了…
[ code]你的代码[/ code] (删除标签空格)加代码标签就这么难吗?
既然你照他说的也没用,那就没办法了。 #NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Icon=D:\autoit3\Aut2Exe\Icons\favicon.ico
#PRE_Outfile=MINI菜单.exe
#PRE_Compression=4
#PRE_Res_Comment=MINI菜单
#PRE_Res_Description=MINI菜单
#PRE_Res_Fileversion=1.0.0.0
#PRE_Res_LegalCopyright=by MINI菜单
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>
If Not FileExists("menu.ini") Then
IniWrite("menu.ini", "title", "title", "软件菜单")
IniWrite("menu.ini", "command", "菜单名称1", "路径1")
IniWrite("menu.ini", "command", "菜单名称2", "路径2")
IniWrite("menu.ini", "command", "菜单名称3", "路径3")
IniWrite("menu.ini", "command", "菜单名称4", "路径4")
IniWrite("menu.ini", "command", "以此类推", "有多少写多少,最多不超20个为宜")
EndIf
Global $Form
Opt("GUIOnEventMode", 1)
$Command = IniReadSection("menu.ini", "command")
$title = IniRead("menu.ini", "title", "title", "")
$height2 = $Command * 45
$Form1 = GUICreate($title, 150, $height2 + 20, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
For $I = 1 To $Command
$Command[$I] = GUICtrlCreateButton($Command[$I], 16, 16 + ($I - 1) * 45, 123, 40)
$img = _GUIImageList_Create(32, 32, 5, 1, 0)
_GUIImageList_AddIcon($img, $Command[$I], 0, True)
_GUICtrlButton_SetImageList(-1, $img)
GUICtrlSetOnEvent($Command[$I], "Command")
Next
;DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 1000, "long", 0x00080000)
GUISetState()
While 1
Sleep(1000)
WEnd
Func Command()
For $I = 1 To UBound($Command, 1) - 1
If @GUI_CtrlId = $Command[$I] Then Run($Command[$I], StringLeft($Command[$I], StringInStr($Command[$I], "\", 0, -1)))
Next
_exit()
EndFunc ;==>Command
Func _Exit()
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 1000, "long", 0x00090000);渐隐
DllCall($dll, "int:cdecl", "DeInitDecoration")
DllCall($dll, "int:cdecl", "RemoveSkin")
DllClose($dll)
FileDelete(@TempDir & "\SkinCrafterDll.dll")
FileDelete(@TempDir & "\skin.skf")
Exit
EndFunc ;==>_Exit
新手嘛,要多泡论坛哟。 #NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Icon=D:\autoit3\Aut2Exe\Icons\favicon.ico
#PRE_Outfile=MINI菜单.exe
#PRE_Compression=4
#PRE_Res_Comment=MINI菜单
#PRE_Res_Description=MINI菜单
#PRE_Res_Fileversion=1.0.0.0
#PRE_Res_LegalCopyright=by MINI菜单
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>
If Not FileExists("menu.ini") Then
IniWrite("menu.ini", "title", "title", "软件菜单")
IniWrite("menu.ini", "command", "菜单名称1", "路径1")
IniWrite("menu.ini", "command", "菜单名称2", "路径2")
IniWrite("menu.ini", "command", "菜单名称3", "路径3")
IniWrite("menu.ini", "command", "菜单名称4", "路径4")
IniWrite("menu.ini", "command", "以此类推", "有多少写多少,最多不超20个为宜")
EndIf
Global $Form
Opt("GUIOnEventMode", 1)
$Command = IniReadSection("menu.ini", "command")
$title = IniRead("menu.ini", "title", "title", "")
$height2 = $Command * 45
$Form1 = GUICreate($title, 150, $height2 + 20, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
For $I = 1 To $Command
$Command[$I] = GUICtrlCreateButton($Command[$I], 16, 16 + ($I - 1) * 45, 123, 40)
$img = _GUIImageList_Create(32, 32, 5, 1, 0)
_GUIImageList_AddIcon($img, $Command[$I], 0, True)
_GUICtrlButton_SetImageList(-1, $img)
GUICtrlSetOnEvent($Command[$I], "Command")
Next
;DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 1000, "long", 0x00080000)
GUISetState()
While 1
Sleep(1000)
WEnd
Func Command()
For $I = 1 To UBound($Command, 1) - 1
If @GUI_CtrlId = $Command[$I] Then Run($Command[$I], StringLeft($Command[$I], StringInStr($Command[$I], "\", 0, -1)))
Next
_exit()
EndFunc ;==>Command
Func _Exit()
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 1000, "long", 0x00090000);渐隐
DllCall($dll, "int:cdecl", "DeInitDecoration")
DllCall($dll, "int:cdecl", "RemoveSkin")
DllClose($dll)
FileDelete(@TempDir & "\SkinCrafterDll.dll")
FileDelete(@TempDir & "\skin.skf")
Exit
EndFunc ;==>_Exit
新手嘛,要多泡论坛哟。 回复 14# lpxx 大神用你的代码,还是主菜单退出哟!怎么回事?求解
页:
[1]
2