CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Posts
    69

    OPENFILENAME initialization

    look at the following code:
    Code:
    char filepath[1024] = {0};
    OPENFILENAME ofn;
    ...
    memset(&ofn, 0, sizeof(OPENFILENAME));
    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = hDlg;
    ofn.lpstrFile = filepath;
    ofn.nMaxFile = sizeof(filepath);
    ofn.lpstrTitle = "Choose A File";
    ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
    if (GetOpenFileName(&ofn)) {
    ...
    }
    i want that the first searching folder be the folder where the program resides. i thought that the above code would do that. but it starts searching from My Documents. what else do i need to start searching from current folder? thanks in advnace.
    ~Donotalo()

  2. #2
    Join Date
    Sep 2004
    Location
    Italy
    Posts
    389

    Re: OPENFILENAME initialization

    Yes, if both lpstrFile and lpstrInitialDir are empty, the initial folder is the personal folder. Fill the lpstrInitialDir member to set the initial directory. To get your program's folder, see this faq.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured