The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: DC on November 23, 2005, 07:25:54 AM

Title: OPENFILENAME
Post by: DC on November 23, 2005, 07:25:54 AM
lpOFN       OPENFILENAME <sizeof OPENFILENAME, NULL, NULL, NULL, NULL, NULL, NULL, addr lpBufTo, 1000, \
                        NULL, NULL, addr lpCurDir, addr lpGetDir, NULL, 0, 0, NULL, NULL, NULL, NULL>

the above code is giving me an "extra characters" error, I checked with the struct and there are 20 members there and here,
if I use less here I still get the same error.
what am I doing wrong?
I want to retrieve just a dir with no file name.
thanx DC
Title: Re: OPENFILENAME
Post by: u on November 23, 2005, 10:06:09 AM
should not use "addr"


lpOFN       OPENFILENAME <sizeof OPENFILENAME, NULL, NULL, NULL, NULL, NULL, NULL,lpBufTo, 1000, \
                        NULL, NULL, lpCurDir,lpGetDir, NULL, 0, 0, NULL, NULL, NULL, NULL>

Title: Re: OPENFILENAME
Post by: Tedd on November 23, 2005, 12:56:53 PM
..assuming that "lpBufTo", "lpCurDir", and "lpGetDir" are all already pointers (the addresses of these things) - which their names imply.
If they're not, they should be, so you'll have to use OFFSET instead of ADDR (and it would be a good idea to remove "lp-" from their names.)
Title: Re: OPENFILENAME
Post by: u on November 23, 2005, 03:38:59 PM
>> "so you'll have to use OFFSET instead of ADDR"
You don't need to use "offset" in compile-time structure initialization.

Compile-time structure initialization cannot get the value of some .data or .code member - it knows only the offset, then the linker replaces that offset with the "real" address. Thus, it is irrelevant to MASM whether you mention "offset" or not.
Title: Re: OPENFILENAME
Post by: DC on November 24, 2005, 12:20:39 AM
thanx guys,
that's the first time I ever tried .data initialization, I don't know why I've had such a hard time knowing when to use addr, offset, and ptr, it's slowly sinking in.
thanx again,
DC