Thread: Open file dialogue

  1. #1
    Mr Ed
    Guest

    Unhappy Open file dialogue

    hi, I want to popup the open file dialogue menu(just to get the file path).

    when i try to call
    LPCTSTR file;
    CDocument::OnOpenDocument(file);


    it gives me this error.
    CDocument::OnOpenDocument' : illegal call of non-static member function


    what should i do, is there other way to popup the open or select file menu.

  2. #2
    Unregistered
    Guest
    using VC6 on w98

  3. #3
    Registered User Esss's Avatar
    Join Date
    Aug 2001
    Posts
    133
    Use CFileDialog.
    Ess
    Like a rat in a maze who says,
    "Watch me choose my own direction"
    Are you under the illusion
    The path is winding your way?
    - Rush

  4. #4
    Registered User ski6ski's Avatar
    Join Date
    Aug 2001
    Posts
    133
    Code:
    CFileDialog theFileDialog(TRUE,"cpp", NULL,OFN_HIDEREADONLY|OFN_FILEMUSTEXIST,"cpp files(*.cpp)|*.cpp||");
    
    if(theFileDialog.DoModal()==IDOK)
    {
    	csFile= theFileDialog.GetPathName();
    }
    That should get you started.
    C++ Is Powerful
    I use C++
    There fore I am Powerful

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  3. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  4. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM