Open/Save Dialog

This is a discussion on Open/Save Dialog within the Windows Programming forums, part of the Platform Specific Boards category; I am trying to make a prompt for Opening/Saving Files with ifstream/ofstream. If any can help I'd appreciate it....

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    16

    Question Open/Save Dialog

    I am trying to make a prompt for Opening/Saving Files with ifstream/ofstream.
    If any can help I'd appreciate it.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    I'm not sure what you mean. Are using the Win32 API or are you just making a console application? There are common controls for saving and opening files in the Win32 API or you can simply output some text requesting the file name to save or open if you are in console mode. Please elaborate on the situation.

  3. #3
    Registered User
    Join Date
    Jul 2003
    Posts
    16
    I am using Win32 API

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Then you want to lookup two functions:

    Opening a file:
    Code:
    BOOL GetOpenFileName( LPOPENFILENAME lpofn );
    Saving a file:
    Code:
    BOOL GetSaveFileName( LPOPENFILENAME lpofn );
    The structure OPENFILENAME can be a little tricky to fill in at first. If you need help let me know.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  5. #5
    Registered User
    Join Date
    Jul 2003
    Posts
    16
    Thanks that helped a lot.
    But now i can't figure out how to ungrey the close button in the menu...

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Ungrey the close button? What are you talking about?

  7. #7
    Registered User
    Join Date
    Jul 2003
    Posts
    16
    I disabled a button (not clickable) and want it enabled (Clickable) when a file is opened.

  8. #8
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Check it out yo.

    Code:
    BOOL EnableWindow( HWND hWnd, BOOL bEnable );
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  9. #9
    Registered User
    Join Date
    Jul 2003
    Posts
    16
    I can't seem to figure out how that works..

  10. #10
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Well you have an hwnd for your button right? If not, get it by using the function GetDlgItem( ). It takes 2 parameters, the first is the hwnd to your main dialog and the second is the identifier of the button. Something like IDC_BUTTON_1. Once you have the hwnd to your button, then call EnableWindow with that hwnd and FALSE or TRUE depending on whether you want it enabled or not.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  11. #11
    Registered User
    Join Date
    Jul 2003
    Posts
    16
    Thanks a lot for your help!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  2. make Child Dialog not Popup?
    By Zeusbwr in forum Windows Programming
    Replies: 5
    Last Post: 04-08-2005, 03:42 PM
  3. Getting the position of a dialog without parent on the screen
    By stormbringer in forum Windows Programming
    Replies: 1
    Last Post: 08-27-2003, 03:59 AM
  4. How to modify file open/save dialog?
    By _Elixia_ in forum Windows Programming
    Replies: 3
    Last Post: 07-05-2003, 12:41 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 10:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21