The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: xiahan on March 30, 2012, 07:04:57 AM

Title: how to CONVERT bitmap.bmWidth to dword
Post by: xiahan on March 30, 2012, 07:04:57 AM
(http://images.cjb.net/5a0d4.gif)
I want to use a MessageBox to prompt the Width&Height of the BITMAP i use ,but it give me weird output(http://images.cjb.net/c5699.gif) 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
Title: Re: how to CONVERT bitmap.bmWidth to dword
Post by: 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
Title: Re: how to CONVERT bitmap.bmWidth to dword
Post by: xiahan on March 30, 2012, 07:34:43 AM
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