News:

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

problem with ADDR Function

Started by ferby, February 22, 2009, 10:04:47 PM

Previous topic - Next topic

ferby

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

BogdanOntanu

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.
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

ferby

Hello,

when i use offset this error appears:

"initializer magnitude too large for specified size"



i have no idea :-(

MichaelW

The Dialog macro is coded to take a quoted string, a string address will not work. The definition is in \masm32\include\dialogs.inc.
eschew obfuscation

ferby

thx



i have another question


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

why?