[已解决]下面的小程序怎么实现双击就执行而不出窗口界面和按钮?
本帖最后由 风中柳 于 2011-4-29 10:24 编辑#include <GuiButton.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <GuiComboBoxEx.au3>
#include <TabConstants.au3>
#include <GUITab.au3>
Opt('MustDeclareVars', 0)
$Form1=GUICreate("常用小工具",360,300)
$button_1=GUICtrlCreateButton("清除打印任务", 15, 60, 100, 60)
GUISetState(@SW_SHOW, $Form1)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button_1
ToolTip("正在清理打印任务... ", @DesktopWidth - 140, @DesktopHeight - 40, "", 0, 2)
If ProcessExists("SPOOLSV.EXE") Then
RunWait(@ComSpec & " /c net stop spooler", "", @SW_HIDE)
ProcessWaitClose("SPOOLSV.EXE")
EndIf
FileDelete(@SystemDir & "\spool\PRINTERS\*.*")
If Not ProcessExists("spoolsv.exe") Then
RunWait(@ComSpec & ' /c sc config spooler start= "AUTO"', '', @SW_HIDE)
RunWait(@ComSpec & ' /c net start spooler', '', @SW_HIDE)
EndIf
ToolTip("")
MsgBox(64, "清除打印任务工具", "打印任务清除成功! ", 2)
EndSelect
WEnd 楼主的意思是这个程序编译后,双击就执行?如果是这样的话,就不要创建窗口了. 你不绘窗口,不就行了。 本帖最后由 风中柳 于 2011-4-29 10:24 编辑
回复 2# mo_shaojie
删除窗口之后,是可以了,但是总是重复执行,最后在后面加了exit命令可以了! 回复 4# 风中柳
晕,你不退出当然重复执行.要EXIT 直接这样编译就好了
ToolTip("正在清理打印任务... ", @DesktopWidth - 140, @DesktopHeight - 40, "", 0, 2)
If ProcessExists("SPOOLSV.EXE") Then
RunWait(@ComSpec & " /c net stop spooler", "", @SW_HIDE)
ProcessWaitClose("SPOOLSV.EXE")
FileDelete(@SystemDir & "\spool\PRINTERS\*.*")
Else
RunWait(@ComSpec & ' /c sc config spooler start= "AUTO"', '', @SW_HIDE)
RunWait(@ComSpec & ' /c net start spooler', '', @SW_HIDE)
EndIf
ToolTip("")
MsgBox(64, "清除打印任务工具", "打印任务清除成功! ", 2)
页:
[1]