News:

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

Trying to use OR, but keep getting "constant expected"

Started by uziq, March 12, 2007, 11:11:48 PM

Previous topic - Next topic

uziq

How can I add flags together (using OR)?
This doesn't work..

.data?
icontype DWORD ?

.
.
.

mov icontype, MB_ICONINFORMATION
invoke MessageBox, NULL, addr msg, addr dialogtitle, MB_SYSTEMMODAL or icontype

hutch--

The problem occurs because "icontype" is a runtime value where the "or" operator between two styles is an assembly time operator which only works with a constant value.

Try something like this.


mov icontype, MB_SYSTEMMODAL
; more code
or icontype, MB_ICONINFORMATION
; more code
invoke MessageBox, NULL, addr msg, addr dialogtitle, icontype
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php