aimini 发表于 2008-11-4 12:43:44

去除系统托盘,让程序运行在系统进程当中

如何去除这段代码中的需要在windows快捷托盘图标,让这个程序运行在进程内


不运行在桌面上,只运行在进行当中,希望高手可以指点


此段代码是关机代码
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=桌面\Software_Icons_004.ico
#AutoIt3Wrapper_Res_Description=日利
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $rq, $btn, $msg,$hListView, $h, $m, $s, $T, $n, $y, $r,$sht,$nowt,$SHT,$NOWT,$rqc,$timec,$StartTicks,$EndTicks
    Local$tTime, $aTime
    Global $Sec, $Min, $Hour, $Time
    GUICreate(" 定时关机", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES

    ; Get current system time
    $StartTicks = _TimeToTicks(@HOUR,@MIN,@SEC)
    $EndTicks = $StartTicks
    _TicksToTime($EndTicks,$Hour,$Min,$Sec)

    $tTime = _Date_Time_GetSystemTime()
    $aTime = _Date_Time_SystemTimeToArray($tTime)
   
    $n = GUICtrlCreateInput($aTime, 45,10, 30, 20)
    GUICtrlCreateLabel("日期:", 10, 13,30,20)
    GUICtrlCreateLabel("(输入日期)", 150, 13,150,20)
    $y = GUICtrlCreateInput($aTime, 75,10, 30, 20)
    $rq = GUICtrlCreateInput("", 105,10, 30, 20)

    $h = GUICtrlCreateInput("", 45,40, 30, 20)
    GUICtrlCreateLabel("时间:", 10, 43,30,20)
    GUICtrlCreateLabel("(输入时间)", 150, 43,150,20)
   
    $m = GUICtrlCreateInput("", 75,40, 30, 20)
    $s = GUICtrlCreateInput("", 105,40, 30, 20)

$btn = GUICtrlCreateButton("确认", 40, 75, 60, 20)

    GUISetState()
Do
      $msg = GUIGetMsg()
if $msg =$btnthen
      $RQ = GUICtrlRead($rq)
      $H = GUICtrlRead($h)
      $M = GUICtrlRead($m)
      $S = GUICtrlRead($s)
   If $RQ > 31 or $H > 24 or $M > 60 or $S > 60 Then
      MsgBox(4096,"", "输入有误,请重新输入时间.")
      EndIf


   MsgBox(262144,'' , '你输入的关机时间:' & $RQ & '号' &$H & ":" & $M & ":" & $S)

   $rqc = $RQ - $aTime
   $sht = $H * 3600000 +$M * 60000 + $S * 1000
   $nowt = $Hour * 3600000 + $Min * 60000 + $Sec * 1000
   $timec = 24 * $rqc * 3600000 + $sht - $nowt

MsgBox(4096, "开始启动",$timec, 10)
WinSetState(" 定时关机", "", @SW_HIDE)
Sleep($timec)

Shutdown(5)




EndIf

Until $msg = $GUI_EVENT_CLOSE

    EndFunc   ;==>Example

liongodmien 发表于 2008-11-4 13:26:47

If $RQ > 31 or $H > 24 or $M > 60 or $S > 60 Then31号我们是说的多了,但24点、60分、60秒我们好像真的很少说啊!

liongodmien 发表于 2008-11-4 13:29:19

另外,真的不明白LZ你的意思!惭愧啊......

78391493 发表于 2008-11-4 15:28:07

意思就是不显示托盘图标?
#NoTrayIcon

KEYFree2008 发表于 2008-11-4 23:53:06

我理解出来的意思跟楼上一样

rl1320 发表于 2008-12-4 03:13:06

#NoTrayIcon

netegg 发表于 2008-12-4 05:58:23

是不是要后台执行呀?代码看了不是很清楚?
页: [1]
查看完整版本: 去除系统托盘,让程序运行在系统进程当中