请帮我看下这段代码错在哪里?
#include <GUIConstants.au3>#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <Array.au3>
#include <Timers.au3>
#include <Date.au3>
Dim $main
Global $timer, $Secs, $Mins, $Hour, $Time
$main = GUICreate("Test",500, 500)
GUICtrlCreatePic(@WindowsDir&"\web\wallpaper\Windows XP.jpg",0,0,500,500,BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetBkColor (0x4D6ED5)
for $i=0 to 4
$w=15
$pro= GUICtrlCreateLabel("■",39+$w*$i, 20, 135, 10)
GUICtrlSetFont(-1,6)
GUICtrlSetBkColor($pro, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($pro, 0x008000)
Next
AdlibEnable("Scroll",2000)
$t =GUICtrlCreateLabel("",50,350, 90,20);计时器
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$d =GUICtrlCreateLabel(@YEAR&" 年 "&@MON&" 月 "&@MDAY&" 日",50,380, 150,20);当天日期
GUICtrlSetBkColor($d, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($d, 0xFFFFFF)
$timer = TimerInit()
_Timer_SetTimer($main, 100, "Timer")
GUISetState(@SW_SHOW)
_ReduceMemory(@AutoItPID) ;释放内存
While 1
Sleep(100)
WEnd
Func _ReduceMemory($i_PID = -1) ;释放内存
If $i_PID <> -1 Then
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle)
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle)
Else
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $ai_Return
EndFunc
Func Timer() ;计时器函数
_TicksToTime(Int(TimerDiff($timer)),$Hour,$Mins, $Secs)
Local $sTime = $Time
If @OSLang = 0409 Then
$Time = StringFormat("%02i : %02i",$Mins, $Secs)
Else
$Time = StringFormat("%02i 分 %02i 秒",$Mins, $Secs)
EndIf
If $sTime <> $Time Then GUICtrlSetData($t, $Time)
EndFunc ;==>Timer
Func Scroll()
$h=15
$i=0
Do
$i = $i + 1
$pro= GUICtrlCreateLabel("●",39+$h*($i-1), 20, 10, 10)
GUICtrlSetFont(-1,6)
GUICtrlSetColor(-1, 0x00ff00)
Sleep(300)
GUICtrlDelete($pro)
if $i=5 Then ExitLoop
Until $i>=5
EndFunc
计时器没有显示,而且滚动条过几秒钟也会死掉。。。
[ 本帖最后由 新手上路 于 2008-11-30 19:44 编辑 ] 顶上去:face (13): 高手们都睡觉去啦?:face (35): 好多的错啊,我也不知道错在哪里!
一运行,弹出N个对话框出来~
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <Array.au3>
#include <Timers.au3>
#include <Date.au3>
Dim $main
Global $timer, $Secs, $Mins, $Hour, $Time
$main = GUICreate("Test",500, 500)
GUICtrlCreatePic(@WindowsDir&"\web\wallpaper\Windows XP.jpg",0,0,500,500,BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetBkColor (0x4D6ED5)
for $i=0 to 4
$w=15
$pro= GUICtrlCreateLabel("■",39+$w*$i, 20, 135, 10)
GUICtrlSetFont(-1,6)
GUICtrlSetBkColor($pro, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($pro, 0x008000)
Next
AdlibEnable("Scroll",2000)
$t =GUICtrlCreateLabel("",50,350, 90,20);计时器
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$d =GUICtrlCreateLabel(@YEAR&" 年 "&@MON&" 月 "&@MDAY&" 日",50,380, 150,20);当天日期
GUICtrlSetBkColor($d, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($d, 0xFFFFFF)
GUISetState(@SW_SHOW)
_ReduceMemory(@AutoItPID) ;释放内存
$timer = TimerInit()
_Timer_SetTimer($main, 1000, "Timer")
While 1
Sleep(100)
WEnd
Func _ReduceMemory($i_PID = -1) ;释放内存
If $i_PID <> -1 Then
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle)
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle)
Else
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $ai_Return
EndFunc
Func Timer($hWnd, $Msg, $iIDTimer, $dwTime) ;计时器函数
_TicksToTime(Int(TimerDiff($timer)),$Hour,$Mins, $Secs)
Local $sTime = $Time
If @OSLang = 0409 Then
$Time = StringFormat("%02i : %02i",$Mins, $Secs)
Else
$Time = StringFormat("%02i 分 %02i 秒",$Mins, $Secs)
EndIf
If $sTime <> $Time Then GUICtrlSetData($t, $Time)
EndFunc ;==>Timer
Func Scroll()
$h=15
$i=0
Do
$i = $i + 1
$pro= GUICtrlCreateLabel("●",39+$h*($i-1), 20, 10, 10)
GUICtrlSetFont(-1,6)
GUICtrlSetColor(-1, 0x00ff00)
Sleep(300)
GUICtrlDelete($pro)
if $i=5 Then ExitLoop
Until $i>=5
EndFunc
页:
[1]