Lets say I want to display the API function GetSystemTime in a MessageBox, how do I do that? Obviously I cannot just invoke/call it as the text of the messagebox (I tried and got some odd characters displayed in the box :))

Any info is appreciated :)
Posted on 2002-03-06 12:08:16 by Psionicist
GetSystemTime fills in a structure for you.
You will basically need to extract the data from this structure, and convert it to some presentable format (ie text).

I would advise something like the wsprintf function.

So your code will look something like this:


.data
mySysTime SYSTEMTIME <>
bigOleBuffer

.code
; ...
invoke GetSystemTime, OFFSET mySysTime

mov eax, mySysTime.Hour
; Do some to-text conversions
; Place it all in a buffer

invoke MessageBox, NULL, OFFSET bigOleBuffer, NULL, MB_OK
; ...


Mirno
Posted on 2002-03-06 12:46:52 by Mirno