I am retrieving the day of the month with GetDateFormat, here's the code:
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
include \masm32\include\masm32.inc
includelib \masm32\lib\masm32.lib
SYSTEMTIME STRUCT
wYear WORD ?
wMonth WORD ?
wDayOfWeek WORD ?
wDay WORD ?
wHour WORD ?
wMinute WORD ?
wSecond WORD ?
wMilliseconds WORD ?
SYSTEMTIME ENDS
.data
szDFormat db "dd", 0Dh, 0Ah, 0
.data?
stCurTime SYSTEMTIME <>
szDate db 5 dup (?)
.code
_ep:
invoke GetLocalTime, addr stCurTime
invoke GetDateFormat, LOCALE_USER_DEFAULT, NULL, addr stCurTime, addr szDFormat, addr szDate, 5
invoke MessageBox, NULL, addr szDate, NULL, MB_OK
invoke ExitProcess,0
end _ep
It works fine and the msgbox show the current day, but now I want to compare that day with another hardcoded value, for example: "if szDate == 12 || szDate == 24 do something".
I have tried:
.if szDate == 12
msgbox here
.endif
But didn't work. Also tried:
date db "12", 00h
...
invoke lstrcmp, addr szDate, addr date
.if eax == 0
msgbox here
.endif
But eax is never 0, how can I compare the result of GetDateFormat with a hardcoded value?
My bad, I was entering the wrong size for the 4th param.
Welcome to the Forum :U
That was enough proof that you are not a bot :green2
i think you want to compare strings
be sure you force the right format :P
here is what i use, as i always wanted 24-hour format hh:mm:ss
INVOKE GetTimeFormat,LOCALE_USER_DEFAULT,TIME_FORCE24HOURFORMAT or TIME_NOTIMEMARKER,NULL,NULL,eax,32
welcome to the forum :U