zhuang513 发表于 2008-11-13 17:10:28

类似开始菜单中的运行

想做个维护工具 类似开始菜单中的运行 (平常网吧里的开始菜单中的运行是禁用的)
我刚开始学,谁帮我看看是哪写错了?!有没有更好的办法?

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

;定义
dim $tywl

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("天逸网络维护工具", 369, 157, 226, 181)
$Combo1 = GUICtrlCreateInput($tywl, 64, 72, 283,20)
$Button1 = GUICtrlCreateButton("确定", 96, 112, 75, 25, 0)
$Button2 = GUICtrlCreateButton("取消", 184, 112, 75, 25, 0)
$Button3 = GUICtrlCreateButton("浏览", 272, 112, 75, 25, 0)
$Label1 = GUICtrlCreateLabel(" 运行:", 16, 72, 44, 17)
$Label2 = GUICtrlCreateLabel("[组策略:gpedit.msc].[启动项:msconfig].[注册表:regedit]", 16, 25, 324, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button2
                        Exit
                case $Button3
                        $open = open()
                case $Button1
                        $ad = ad()
        EndSwitch
WEnd

;浏览
Func open()
        AdlibDisable()
        $tywl = FileOpenDialog("浏览", @DesktopDir,"所有文件(*.*)")
        GUICtrlSetData($Combo1,$tywl)
EndFunc   

;确定
Func ad()
        AdlibDisable()
                        RunWait($tywl)
        Exit
EndFunc

[ 本帖最后由 zhuang513 于 2008-11-14 21:58 编辑 ]

zhuang513 发表于 2008-11-14 03:16:40

:face (2):   没人能帮我吗??

sunless 发表于 2008-11-14 11:08:08

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

;定义
dim $tywl

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("天逸网络维护工具", 369, 157, 226, 181)
$Combo1 = GUICtrlCreateInput($tywl, 64, 72, 283,20)
$Button1 = GUICtrlCreateButton("确定", 96, 112, 75, 25, 0)
$Button2 = GUICtrlCreateButton("取消", 184, 112, 75, 25, 0)
$Button3 = GUICtrlCreateButton("浏览", 272, 112, 75, 25, 0)
$Label1 = GUICtrlCreateLabel(" 运行:", 16, 72, 44, 17)
$Label2 = GUICtrlCreateLabel("[组策略:gpedit.msc].[启动项:msconfig].[注册表:regedit]", 16, 25, 324, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button2
                        Exit
                case $Button3
                        $open = open()
                case $Button1
                        $ad = ad()
      EndSwitch
WEnd

;浏览
Func open()
      AdlibDisable()
      $tywl = FileOpenDialog("浏览", @DesktopDir,"所有文件(*.*)")
      GUICtrlSetData($Combo1,$tywl)
EndFunc   

;确定
Func ad()
      AdlibDisable()
                $pro= GUICtrlRead($Combo1)
                ShellExecute($pro)    ; 改成ShellExecuteWait可以等待程序运行结束
      Exit
EndFunc

cjl 发表于 2008-11-14 12:43:52

Send("#r")
WinWaitActive("")

cjl 发表于 2008-11-14 12:46:18

run("rundll32 shell32.dll #61")

zhuang513 发表于 2008-11-14 21:58:26

谢谢啊。:face (23):
页: [1]
查看完整版本: 类似开始菜单中的运行