求一个setTimer API的例子
资料区的都看不懂,主要是setTimer的最后一个参数不知道怎么弄(如何把SetTimer和msgbox联系起来是个难题)求一个每1秒钟出现一个msgbox的例子,要求20行以内
报酬2元(最初是不想给钱的,不过还是大出血一次吧)
[ 本帖最后由 kakinkgb 于 2008-5-29 22:24 编辑 ] 报酬2元(最初是不想给钱的,不过还是大出血一次吧)
:face (33): $x=SetLocalTime(17,20,0,2007,10,15)
MsgBox(0,"",$x)
Func SetLocalTime($Hour, $Min, $Sec =0,$Year = 0,$Month = 0,$Day = 0)
Local $Error = 0
Local $Return = False
If $Hour < 0 Or $Hour > 23 Then $Error = 1
If $Min < 0 Or $Min > 59 Then $Error = 1
If $Sec < 0 Or $Sec > 59 Then $Error = 1
If @NumParams > 3 And ($Day < 1 Or $Day > 31) Then $Error = 1
If @NumParams > 4 And ($Month < 1 Or $Month > 12) Then $Error = 1
If @NumParams > 5 And ($Year < 1601 Or $Year > 30827) Then $Error = 1
If Not $Error Then
Local $Struct = DLLStructCreate('Short;Short;Short;Short;Short;Short;Short;Short')
Local $StructPtr = DLLStructGetPtr($Struct)
If @NumParams < 6 Then
DLLCall('Kernel32', 'None', 'GetLocalTime', 'Ptr', $StructPtr)
If @Error Then $Error = 2
EndIf
If Not $Error Then
DLLStructSetData($Struct, 5, $Hour)
DLLStructSetData($Struct, 6, $Min)
DLLStructSetData($Struct, 7, $Sec)
DLLStructSetData($Struct, 8, 0)
If @NumParams > 3 Then DLLStructSetData($Struct, 4, $Day)
If @NumParams > 4 Then DLLStructSetData($Struct, 2, $Month)
If @NumParams > 5 Then DLLStructSetData($Struct, 1, $Year)
DLLCall('Kernel32', 'None', 'SetLocalTime', 'Ptr', $StructPtr)
Local $Result = DLLCall('Kernel32', 'Int', 'SetLocalTime', 'Ptr', $StructPtr)
If @Error Then
$Error = 2
Else
$Return = ($Result <> 0)
EndIf
EndIf
EndIf
SetError($Error)
Return $Return
EndFunc 他要20行啊。。哈哈 3hen别傻笑了,给个例子啊.钱多花不了给我点
bing614的不对,我要的是user32.dll里的SetTimer 怎么不直接用timer的udf算了= =…… 经研究自己做好了:face (33): ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 代码出来出瞅瞅
页:
[1]