首页
社区
课程
招聘
[求助]关于获取本地时间问题..
发表于: 2006-10-11 18:35 5261

[求助]关于获取本地时间问题..

2006-10-11 18:35
5261
代码如下,我不知道写得对不对:

.386
.model flat, stdcall
option casemap :none
include                windows.inc
include                user32.inc
includelib        user32.lib
include                kernel32.inc
includelib        kernel32.lib
.data?
SysTime     SYSTEMTIME      <>
.data
szTime db        '今天是20号',0
szDay   db '获取时间',0
szNoDay db '今天不是20号',0
.code
start:
      invoke GetSystemTime,addr SysTime
      .if eax == 14h
      invoke  MessageBox,NULL,addr szTime, addr szDay,MB_OK
      invoke  ExitProcess,NULL
      .elseif
      invoke MessageBox,NULL,addr szNoDay,addr szDay,MB_OK
      invoke  ExitProcess,NULL
      .endif
end start      

*************************************************

另外,14h对应的20号,那么11号,12号,对应着什么?我想知道一下
不过找不到资料....

[课程]Android-CTF解题方法汇总!

收藏
免费 0
支持
分享
最新回复 (7)
雪    币: 2384
活跃值: (766)
能力值: (RANK:410 )
在线值:
发帖
回帖
粉丝
2
GetSystemTime函数有返回值吗?似乎没有吧。
下面的MSDN里的参考。

VOID GetSystemTime(

    LPSYSTEMTIME lpSystemTime         // address of system time structure  
   );       

Parameters

lpSystemTime

Points to a SYSTEMTIME structure to receive the current system date and time.

Return Values

This function does not return a value.

The SYSTEMTIME structure represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and millisecond.

typedef struct _SYSTEMTIME {  // st  
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} SYSTEMTIME;

Members

wYear

Specifies the current year.

wMonth

Specifies the current month; January = 1, February = 2, and so on.

wDayOfWeek

Specifies the current day of the week; Sunday = 0, Monday = 1, and so on.

wDay

Specifies the current day of the month.

wHour

Specifies the current hour.

wMinute

Specifies the current minute.

wSecond

Specifies the current second.

wMilliseconds

Specifies the current millisecond.

Remarks

It is not recommended that you add and subtract values from the SYSTEMTIME structure to obtain relative times. Instead, you should
2006-10-11 19:00
0
雪    币: 380
活跃值: (101)
能力值: ( LV13,RANK:370 )
在线值:
发帖
回帖
粉丝
3
获取本地时间好像是GetLocalTime吧
2006-10-11 19:00
0
雪    币: 2384
活跃值: (766)
能力值: (RANK:410 )
在线值:
发帖
回帖
粉丝
4
最初由 llydd 发布
获取本地时间好像是GetLocalTime吧

都可以。
2006-10-11 19:05
0
雪    币: 214
活跃值: (10)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
5
.386
.model flat, stdcall
option casemap :none
include    windows.inc
include    user32.inc
includelib  user32.lib
include    kernel32.inc
includelib  kernel32.lib
.data?
SysTime     SYSTEMTIME      <>
.data
szTime db  '今天是20号',0
szDay   db '获取时间',0
szNoDay db '今天不是20号',0
.code
start:
      invoke GetSystemTime,addr SysTime
      .if eax == 14h
      invoke  MessageBox,NULL,addr szTime, addr szDay,MB_OK
      invoke  ExitProcess,NULL
      .elseif
      invoke MessageBox,NULL,addr szNoDay,addr szDay,MB_OK
      invoke  ExitProcess,NULL
      .endif
end start
____________________________________________________
invoke MessageBox,NULL,addr szNoDay,addr szDay,MB_OK
不能直接这样输出的
要转换成字符才行
如用wsprintf
还有.if eax == 14h
不知道楼主是什么意思。
2006-10-11 20:45
0
雪    币: 796
活跃值: (370)
能力值: ( LV9,RANK:380 )
在线值:
发帖
回帖
粉丝
6
GetSystemTime没有返回值的话,如果我要先判断本地时间,如果是20号就执行某一操作,该怎么做?请指教....
2006-10-11 21:39
0
雪    币: 2384
活跃值: (766)
能力值: (RANK:410 )
在线值:
发帖
回帖
粉丝
7
.386
.model flat,stdcall
option casemap:none

include windows.inc
include kernel32.inc
include user32.inc

includelib kernel32.lib
includelib user32.lib

.data
        lpMsgTitle db "时间",0
        lpBuff db 256 dup(0)
        lpFormat db "今天是:%d年%d月%d日",0

.data?
        lpSystemTime SYSTEMTIME <?>

.code
start:
        invoke GetSystemTime,offset lpSystemTime
        movzx eax,lpSystemTime.wYear  ;获取本地年
        movzx edx,lpSystemTime.wMonth ;获取本地月
        movzx ecx,lpSystemTime.wDay   ;获取本地日,你可以判断这个变量就可以了。
        invoke wsprintf,offset lpBuff,offset lpFormat,eax,edx,ecx
        invoke MessageBox,NULL,offset lpBuff,offset lpMsgTitle,MB_OK
        invoke ExitProcess,NULL
end start
2006-10-11 21:52
0
雪    币: 796
活跃值: (370)
能力值: ( LV9,RANK:380 )
在线值:
发帖
回帖
粉丝
8
谢谢小虾哥哥,我又学到了一招
2006-10-11 23:21
0
游客
登录 | 注册 方可回帖
返回
//