找回密码
 加入
搜索
查看: 2801|回复: 8

求一个setTimer API的例子

[复制链接]
发表于 2008-5-26 00:47:11 | 显示全部楼层 |阅读模式
资料区的都看不懂,主要是setTimer的最后一个参数不知道怎么弄(如何把SetTimer和msgbox联系起来是个难题)
求一个每1秒钟出现一个msgbox的例子,要求20行以内
报酬2元(最初是不想给钱的,不过还是大出血一次吧)

[ 本帖最后由 kakinkgb 于 2008-5-29 22:24 编辑 ]
发表于 2008-5-26 01:40:19 | 显示全部楼层
报酬2元(最初是不想给钱的,不过还是大出血一次吧)


发表于 2008-5-26 03:07:45 | 显示全部楼层
[au3]$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] <> 0)
            EndIf
        EndIf        
    EndIf
    SetError($Error)
    Return $Return
EndFunc[/au3]
发表于 2008-5-26 13:21:12 | 显示全部楼层
他要20行啊。。哈哈
 楼主| 发表于 2008-5-26 15:59:56 | 显示全部楼层
3hen别傻笑了,给个例子啊.钱多花不了给我点
bing614的不对,我要的是user32.dll里的SetTimer
发表于 2008-5-26 23:42:43 | 显示全部楼层
怎么不直接用timer的udf算了= =……
 楼主| 发表于 2008-5-29 22:28:36 | 显示全部楼层
经研究自己做好了
发表于 2011-2-22 23:29:21 | 显示全部楼层
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
发表于 2011-12-5 22:53:36 | 显示全部楼层
代码出来出瞅瞅
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-1 05:27 , Processed in 0.076541 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表