The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Rainstorm on December 18, 2008, 03:37:48 PM

Title: small prob with supplying a constant
Post by: Rainstorm on December 18, 2008, 03:37:48 PM
how would i go about supplying the value returned from GetWindowLong in this code
Quoteinvoke GetWindowLong, hDlg, GWL_EXSTYLE 
               invoke SetWindowLong, hDlg, GWL_EXSTYLE, WS_EX_LAYERED or eax
i get the "error constant expected"

thanks.
Title: Re: small prob with supplying a constant
Post by: jdoe on December 18, 2008, 04:11:03 PM

:U



invoke GetWindowLong, hDlg, GWL_EXSTYLE
.if (eax != 0)

    or eax, WS_EX_LAYERED
    invoke SetWindowLong, hDlg, GWL_EXSTYLE, eax

.endif



Title: Re: small prob with supplying a constant
Post by: jdoe on December 18, 2008, 04:14:47 PM

Maybe in that case this is better...


invoke GetWindowLong, hDlg, GWL_EXSTYLE
or eax, WS_EX_LAYERED
invoke SetWindowLong, hDlg, GWL_EXSTYLE, eax


Title: Re: small prob with supplying a constant
Post by: Rainstorm on December 18, 2008, 04:39:27 PM
jdoe, thanks! i got the picture  :U
Title: Re: small prob with supplying a constant
Post by: Damos on December 18, 2008, 05:59:29 PM
remember that the invoke macro unfolds to become a series of pushes followed by a call, so, you can't have 'constant or eax' because you can't 'push constant or eax'. so you would 'or eax,constant' then use eax as your parameter to invoke.
Title: Re: small prob with supplying a constant
Post by: Vortex on December 18, 2008, 06:30:03 PM
Hi Rainstorm,

Another solution based on the following macro :

.
.
TEST_VALUE equ 0

Calc MACRO operation

    operation

    EXITM <eax>

ENDM

.code

start:

    xor     eax,eax
    invoke  ExitProcess,Calc(<or eax,TEST_VALUE>)

END start
Title: Re: small prob with supplying a constant
Post by: Rainstorm on December 18, 2008, 08:44:33 PM
nice one, thx vortex !  :U