The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: uziq on March 12, 2007, 11:11:48 PM

Title: Trying to use OR, but keep getting "constant expected"
Post by: uziq on March 12, 2007, 11:11:48 PM
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
Title: Re: Trying to use OR, but keep getting "constant expected"
Post by: hutch-- on March 12, 2007, 11:41:59 PM
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
Title: Re: Trying to use OR, but keep getting "constant expected"
Post by: uziq on March 12, 2007, 11:59:02 PM
Great! Thanks!  :bg