File open/save-dialogbox

This is a discussion on File open/save-dialogbox within the Windows Programming forums, part of the Platform Specific Boards category; I'm doing a little game in DirectX, right now. I've done a mapeditor for it, and now when I findly ...

  1. #1
    Registered User FearOfTheDark's Avatar
    Join Date
    Jan 2003
    Posts
    31

    File open/save-dialogbox

    I'm doing a little game in DirectX, right now.
    I've done a mapeditor for it, and now when I findly have got it working properly, I would like to have a open/save-dialogbox, so that you can be able to save different maps in an easy way.

    And I found this code:

    Code:
    OPENFILENAME ofn;
        char szFileName[MAX_PATH] = "";
    
        ZeroMemory(&ofn, sizeof(ofn));
    
        ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
        ofn.hwndOwner = hwnd;
        ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";
        ofn.lpstrFile = szFileName;
        ofn.nMaxFile = MAX_PATH;
        ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
        ofn.lpstrDefExt = "txt";
    
        if(GetOpenFileName(&ofn))
        {
            // Do something usefull with the filename stored in szFileName 
        }
    On: http://winprog.org/tutorial/app_two.html

    but I had some problem when I compiled it! It wouldn't recognice the OPENFILENAME class, does anyone know why?
    Or do you know some other way to do this?

    /Thanks FearOfTheDark
    Last edited by FearOfTheDark; 04-10-2003 at 06:51 PM.
    -We're living in a illusion!
    -Ok, if that's what you think!

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,647
    You probably have WIN32_LEAN_AND_MEAN defined...just #include <commdlg.h> directly.

    gg

  3. #3
    Registered User FearOfTheDark's Avatar
    Join Date
    Jan 2003
    Posts
    31
    Hm... I don't know if I did something wrong, but I still get the same error!

    Hm...
    I suppose I have to do some reading here...
    But thanks anyway, you're probably right, I've probably just made som other misstake!

    /FearOfTheDark
    -We're living in a illusion!
    -Ok, if that's what you think!

  4. #4
    Registered User
    Join Date
    Feb 2003
    Posts
    9
    Just a guess, but is comdlg32.lib linked in your project?

    Good luck,
    Chris

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,647
    Post your compiler errors/warnings.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  2. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  3. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  4. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 09:57 AM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM

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