News:

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

GetSaveFileName file extension problem

Started by dedndave, March 02, 2011, 02:03:08 PM

Previous topic - Next topic

dedndave

i have more-or-less working dialog code - lol
it works fine, but....

if the user puts in a filename extension, the default extension is also appended to it   :red

QuotelpstrDefExt

    The default extension. GetOpenFileName and GetSaveFileName append this extension to the
file name if the user fails to type an extension. This string can be any length, but only the first
three characters are appended. The string should not contain a period (.). If this member is NULL
and the user fails to type an extension, no extension is appended.

test code attached....

jj2007

Not on my PC (Win XP SP2). Are your "known" extensions visible in Explorer?

dedndave

i typed in "abc.abc", and got this....



and - i hate when the known extensions are hidden - lol
that's one of the first things i set when i rebuild

dedndave

anyone else have the same problem as me ?
or does it work on more than one machine ?

FORTRANS

Hi,

   Yep.  Exactly as described.  Both with your app (?) and with
WordPad every so often.  You can work around this "feature"
by using quotes.

Regards,

Steve N.

dedndave

thanks, both of you
i was worried there was something wrong with me, my machine, or my code - lol
probably all three   :bg

jj2007

Actually, it is more complicated:

abc.abc yields abc.abc.txt
abc.doc yields abc.doc

Apparently, the OS checks if the extension is known. If not, the default extension will be added.

FORTRANS

Hi,

   Cute.  Went into WordPad and tried to save TEST.ASM and
got TEST.ASM.txt.  Went to the Control Panel and added ASM
as a file type and repeated the experiment and got TEST.ASM.
I would never have known that an ASM file has the file type
FT000001.  What you can learn in the land of Microsloth.

Cheers,

Steve N.

dedndave

 :P
it can be cleaned up with code, easy enough

Antariy

#9
Edit: Oh, reading posts from bottom to the top, do not saw that there is answer already.