News:

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

small prob with supplying a constant

Started by Rainstorm, December 18, 2008, 03:37:48 PM

Previous topic - Next topic

Rainstorm

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.

jdoe


:U



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

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

.endif




jdoe


Maybe in that case this is better...


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



Rainstorm


Damos

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.
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction. - Albert Einstien

Vortex

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

Rainstorm