The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ferby on February 22, 2009, 10:04:47 PM

Title: problem with ADDR Function
Post by: ferby on February 22, 2009, 10:04:47 PM
Hello,

i have a problem with the ADDR Function

why is there a Syntax error because of ADDR fontClass?


[..]
.data
fontClass db "Tahoma", 0

[..]


Dialog "Dialog With Icon", ADDR fontClass, 9, \         ; caption,font,pointsize
            WS_OVERLAPPED or WS_SYSMENU or DS_CENTER, \     ; style
            3, \                                            ; control count
            50,50,150,80, \                                 ; x y co-ordinates
            1024                                            ; memory buffer size




if i writte "Tahoma" instead of ADDR fontClass everything works
Title: Re: problem with ADDR Function
Post by: BogdanOntanu on February 22, 2009, 10:20:26 PM
Ussually ADDR is used to obtain the address of a symbol when that symbol's address is unknown at compile time but will be known at runtime. Such an example is a local variable inside a PROC and in this case the ADDR will generate a hidden LEA instruction in order to obtain that address at runtime.

However when the variable is defined in the data section and thus known at compile time it is a custom to use OFFSET instead of ADDR.

Hence my first suggestion would be to try with OFFSET.

Then I guess that "Dialog" is a macro and this might (or might not) complicate things a little. This depends on the macro definition and it's parameters handling.
Title: Re: problem with ADDR Function
Post by: ferby on February 22, 2009, 11:09:59 PM
Hello,

when i use offset this error appears:

"initializer magnitude too large for specified size"



i have no idea :-(
Title: Re: problem with ADDR Function
Post by: MichaelW on February 22, 2009, 11:29:55 PM
The Dialog macro is coded to take a quoted string, a string address will not work. The definition is in \masm32\include\dialogs.inc.
Title: Re: problem with ADDR Function
Post by: ferby on February 24, 2009, 12:04:21 AM
thx



i have another question


when i use CallModelessDialog  instead of  CallModalDialog no Dialog Window appears.

why?