Results 1 to 8 of 8
  1. #1
    What's that...? mesman00's Avatar
    Join Date
    Nov 2001
    Location
    USA
    Posts
    1,425

    mfc open dialg question

    i'm using the CFileDialog class to create an open dialog box. here is my question. i wanna set the file filter types, but i am unsure how to do it. i know i need to use the m_ofn struct, and the lpstrFilter member flag. but i don't know how to initialize the flag so it displays properly in the combo box of the open dialog box. i want to use the flag to filter out the following two file types:



    structured report files with the .dcm extension
    text files with the .txt extension

    these two things should be the two options in the combo box. so, how should i initialize the lpstrFilter flag. the name of my CFileDialog object is m_OpenDialog. thus

    m_OpenDialog->m_ofn.lpstrFiler = ?

    what should be in place of the ?
    <font color="blue">System Specs</font>
    Dual Boot:
    1. Gentoo Linux
    2. Win2k
    Athlon XP Barton 2700
    512 MB PC 2700 DDR Ram
    GF4 Ti4200 AGP 8X 64 MB
    Onboard Sound


    • Advertising

      advertising
      EmuTalk.net
      has no influence
      on the ads that
      are displayed
        
       

  2. #2
    Moderator smcd's Avatar
    Join Date
    Jun 2004
    Posts
    2,503
    This should do it:
    m_ofn.lpstrFilter="Text Files(*.txt)\0*.txt\0Structured Report Files(*.dcm)\0*.dcm\0\0";

    The stuff in ( ) aren't necessary, but it is nice to see the extension for each file type anyhow... it's a matter of personal preference.

    The format in general is:
    Description \NULL Extension Filter \NULL ... and the last entry ends with 2 NULL

    You can specify more than one extension at a time, for example:
    "Any valid file\0*.txt;*.dcm\0\0"

    Just separate each extension filter with a semicolon.
    Last edited by smcd; July 28th, 2004 at 20:11.

  3. #3
    What's that...? mesman00's Avatar
    Join Date
    Nov 2001
    Location
    USA
    Posts
    1,425
    thanks, couldn't find that anywhere on msdn.
    <font color="blue">System Specs</font>
    Dual Boot:
    1. Gentoo Linux
    2. Win2k
    Athlon XP Barton 2700
    512 MB PC 2700 DDR Ram
    GF4 Ti4200 AGP 8X 64 MB
    Onboard Sound

  4. #4
    Moderator smcd's Avatar
    Join Date
    Jun 2004
    Posts
    2,503
    You can look up OPENFILENAME in google, click the first link, if you need more information about other member items.

  5. #5
    ????????????????????????? Doomulation's Avatar
    Join Date
    Nov 2001
    Location
    ????????????????
    Posts
    8,780
    *cough* revives thread *cough*
    In MFC's class, you use extensions such as this:
    "*.ext|description|*.new ext|description||"
    At the end you use two |.
    With pure win32, you use \0.
    I hope you already didn't know that...
    Atashi wa juu-yon-sai no onna no ko! Atashi no namae wa Miizuki. Yurushiku ne!
    Nani? Atashi o shinjirimasen desu ka? Baka!
    "You're all doomed! Doomed, I say! Hehe... are we approaching the end of the world?"

    shikata ga kaite aru - "the instructions are written above"
    Need to download GoodN64 or instructions to use it? Need to check if it's a good or bad rom?
    Download: Glide64 | Hacktarux's wrapper

  6. #6
    Moderator smcd's Avatar
    Join Date
    Jun 2004
    Posts
    2,503
    Quote Originally Posted by Doomulation
    *cough* revives thread *cough*
    In MFC's class, you use extensions such as this:
    "*.ext|description|*.new ext|description||"
    At the end you use two |.
    With pure win32, you use \0.
    I hope you already didn't know that...
    I don't use MFC! Muwhahahaha!

  7. #7
    EmuTalk Member zenogais's Avatar
    Join Date
    Jun 2004
    Location
    California
    Posts
    215
    Actually, here's a little snippet which might help you from NeoGameBoy:

    Code:
    afx_msg VOID MFCWindow::OnFileOpen()
    {
    	//============================================================
    	// Prompt the user for the ROM file to load.
    	//============================================================
    	TCHAR filter[] = "Gameboy ROM (*.GB)|*.GB|Gameboy Color ROM (*.GBC)|*.GBC||";
    	CFileDialog fileDialog(true, 0, 0, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, filter, this);
    	fileDialog.DoModal();
    
    	//============================================================
    	// Load the ROM file into memory.
    	//============================================================
    	CString file = fileDialog.GetPathName();
    	MessageBox(file);
    
    	mGameboy.loadGame( file.GetBuffer() );
    	file.ReleaseBuffer();
    }

  8. #8
    ????????????????????????? Doomulation's Avatar
    Join Date
    Nov 2001
    Location
    ????????????????
    Posts
    8,780
    Damn, I think I swapped them again
    So confusing and hard to remember...
    Atashi wa juu-yon-sai no onna no ko! Atashi no namae wa Miizuki. Yurushiku ne!
    Nani? Atashi o shinjirimasen desu ka? Baka!
    "You're all doomed! Doomed, I say! Hehe... are we approaching the end of the world?"

    shikata ga kaite aru - "the instructions are written above"
    Need to download GoodN64 or instructions to use it? Need to check if it's a good or bad rom?
    Download: Glide64 | Hacktarux's wrapper

Similar Threads

  1. ePSXecutor question - Keeping ePSXe gui open
    By Chandro in forum Other Emulation Discussion
    Replies: 0
    Last Post: July 27th, 2004, 18:01
  2. Open Source Question
    By LinkOfTime in forum Programming
    Replies: 3
    Last Post: May 30th, 2004, 06:43
  3. Open source software on Windows
    By zero0w in forum Talk of the Town
    Replies: 1
    Last Post: September 26th, 2002, 19:27
  4. Rom question about byteswapping
    By ashade in forum General N64 Emulation Discussion
    Replies: 1
    Last Post: August 1st, 2002, 21:52
  5. UltraHLE 2002 Reborn?
    By aprentice in forum UltraHLE 2064
    Replies: 69
    Last Post: July 26th, 2002, 15:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •