News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

how to CONVERT bitmap.bmWidth to dword

Started by xiahan, March 30, 2012, 07:04:57 AM

Previous topic - Next topic

xiahan


I want to use a MessageBox to prompt the Width&Height of the BITMAP i use ,but it give me weird output i searched the Web and found the bitmap.bmWidth is a LONGĀ  data type , 8-bytes long. is there exists a trick to handle this kind of problem

jj2007

LONG is actually 4 bytes, a DWORD. To show it in a MessageBox, you need one of the dword2Ascii functions, for example the str$(eax) macro.

include \masm32\include\masm32rt.inc

.code
start:   invoke GetTickCount
   push eax
   invoke Sleep, 500
   invoke GetTickCount
   pop ecx
   sub eax, ecx
   MsgBox 0, str$(eax), "Milliseconds:", MB_OK
   exit
end start

xiahan

Quote from: jj2007 on March 30, 2012, 07:30:35 AM
LONG is actually 4 bytes, a DWORD. To show it in a MessageBox, you need one of the dword2Ascii functions, for example the str$(eax) macro.

include \masm32\include\masm32rt.inc

.code
start:   invoke GetTickCount
   push eax
   invoke Sleep, 500
   invoke GetTickCount
   pop ecx
   sub eax, ecx
   MsgBox 0, str$(eax), "Milliseconds:", MB_OK
   exit
end start

:U