Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 259133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:14:19+00:00 2026-05-11T22:14:19+00:00

I use GetOpenFilename() to let the user select a file. Here is the code:

  • 0

I use GetOpenFilename() to let the user select a file. Here is the code:

  wchar_t buffer[MAX_PATH] = { 0 };

  OPENFILENAMEW open_filename = { sizeof (OPENFILENAMEW) };

  open_filename.hwndOwner   = handle_;
  open_filename.lpstrFilter = L"Video Files\0*.avi;*.mpg;*.wmv;*.asf\0"
                              L"All Files\0*.*\0";
  open_filename.lpstrFile   = buffer;
  open_filename.nMaxFile    = MAX_PATH; 
  open_filename.lpstrTitle  = L"Open media file...";
  open_filename.Flags       = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;

  ::GetOpenFileNameW(&open_filename);

The file dialog shows up, but when I

  • change the Filter or
  • click on “My Computer“

the file list turns empty. Pressing [F5] does not help, but if I switch to the parent folder and return to the original folder (in the case of the Filter change) the filtering works fine and files show up in the list.

EDIT: My system is Windows XP (SP3) 32-bit – nothing special. It happens on other machines – with the same config – as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:14:19+00:00Added an answer on May 11, 2026 at 10:14 pm

    Okay, I have figured out the problem, or at least, I have a solution that is working for me.

    Earlier in the code, I had the following call to initialize COM…

    ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
    

    Well, changing this to…

    ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
    

    …solves the problem for me! Now the file dialog is filtering again.

    I searched the web for this and it seems that a very few people faces the same problem, but no one published the aforementioned solution. Can anyone verify my findings?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.