Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Revisiting the predefined saveas/open dialog box

Posted on 1998-08-18
4
Medium Priority
?
221 Views
Last Modified: 2010-04-01
null
0
Comment
Question by:kittles
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 200 total points
ID: 1170644
Yes!  use CFileDialog.  You aren't asking for any capability that isn't already present in CFileDialog.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1170645
You can access the OPENFILENAME structure in the m_ofn member of the CFileDialog object prior to opening the dialog.  In this structure you need to set  the lpstrInitialDir tot he directory you want to default to and lpstrFile to the file name and extension you want to default to.

Let me know if you have questions.
0
 

Author Comment

by:kittles
ID: 1170646
(FALSE,  // TRUE for Open or FALSE Save As
                        NULL,  (is this where I insert the m_OFN member?)
                        NULL,
                        OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
                        NULL,
                        this);  // the parent window is your dialog box

This is my code. From the help documentation this appears to be where I would modify the m_ofn structures you suggested such as lpstrInitialDir & lpszFileName. Is that correct? If so, and I manage to insert the file name I want and the path.. how then do I remove all of the unwanted elements such as the large window where the user choses the file they want, and leave only an edit box for typing in the file name desired? etc. Do I use  dwflags? My documentations says the following:
"dwFlags   A combination of one or more flags that allow you to customize the dialog box. For a description of these flags, see the OPENFILENAME structure in the Win32 SDK documentation. If you modify the m_ofn.Flags structure member, use a bitwise-OR operator in your changes to keep the default behavior intact."

I do not understand the part about a bitwise or operator, and I do not have any win32 sdk documentation that tells me how to do this. The only thing I can find in the MFC library on OPENFILENAME is the different commands to be used to modify the dialog box. Can I use these in the code above? Or must I do more as they suggest above= with the bitwise operator etc?
Thank you very much for answering so quickly & for your patience!


0
 
LVL 22

Expert Comment

by:nietod
ID: 1170647
>> how then do I remove all of the unwanted elements such as the large
>> window where the user choses the file they want, and leave only an
>> edit box for typing in the file name desired?

I didn't realize you wanted to do that.  I beleive that can be done using the lpTemplateName member of the OPENFILENAME structure.  However, I have no experience doing so, if you go really want to go that route you should reject this answer and see what else you can find.  But first consider if that is really a good idea.  Windows tries to present a common interface to the user.  This makes it easier and faster for them to use the software and makes them feel more comfortable.  If you aren't going to follow that interface, you had better have a good reason, one that outweights the issues I just mentioned.

>> I do not understand the part about a bitwise or operator
The | operator is the bitwise or operator.  You can make an integer value that is a combination of flags using | like

OFN_ALLOWMULTISELECT | OFN_ENABLEHOOK
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question