Solved

Open File Name mask

Posted on 2007-04-03
6
762 Views
Last Modified: 2012-05-05
Hi Experts. I have a Dir with filesnames like 123.fgm ; 124.fgm; 125;fgm and a Mask file containing the names of the xxx.fgm files. I know how to extract the names out of the Mask file. But now I want these extracted names to be visible in the OpenFileName dialog so a user can select the wanted file.
How do I make these filenames visible using the GetOpenFileName(ofn) dialog ?
Thanks again
0
Comment
Question by:Frits2
  • 2
  • 2
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 18846866
Are you thnking about

    BYTE            Filter  [ 100] = "FGM files (*.fgm)\0*.fgm\0\0";    
    char            acBuf   [ MAX_PATH];
    OPENFILENAME    ofName;

    ZeroMemory  (   &ofName,    sizeof( OPENFILENAME));
    ZeroMemory  (   acBuf,  MAX_PATH);
   
    ofName.hwndOwner        =   NULL;
    ofName.lStructSize      =   sizeof( OPENFILENAME);
    ofName.lpstrFile        =   acBuf;
    ofName.nMaxFile         =   MAX_PATH;
    ofName.lpstrInitialDir  =   NULL;
    ofName.Flags            =   OFN_HIDEREADONLY | OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_LONGNAMES;
    ofName.lpstrDefExt      =   "fgm";
    ofName.lpstrFilter      =   ( char *) Filter;
    ofName.nFilterIndex     =   1;
    ofName.lpstrTitle       =   "Choose FGM file";

?
0
 

Author Comment

by:Frits2
ID: 18847014
Hi jkr,

thanks for your fast reply!
Yes this code generates a standard OpenFileDialog with the 123.fgm; 124.fgm ..files visible.
Now the xxx.fgm filenames must be made visible in this dialogbox with there real names.
I don't know how to go from here:
Do I have to use a OFN_ENABLEHOOK procedure to add this hook to made the real names visible in the dialogbox and how do I do this. or is there a easier way to change the xxx.fgm names to their names which are hidden in the mask file.

Best regards
Frits
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 18848317
Hmm, it seems that I now understand what you want to do, and that is IMO not possible with the standard "File Open" dialog, youd rather have to write a replacement for that, which is not too hard. http://msdn2.microsoft.com/en-us/library/aa365200.aspx ("Listing the Files in a Directory") will give you the basics on how to get the file listing and http://www.codeproject.com/listctrl/ ("List Controls") should cover the rest.
0
 

Author Comment

by:Frits2
ID: 18849143
Hi jkr
Actaully I hoped to do the trick with a hook procedure in the GetOpenFileName(ofn) and could see an example of this hook procedure OFN_ENABLEHOOK.
Can't find anything leading to a solution within my capacities in these url's.

thanks agian and best regards
Frits
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21156538
Forced accept.

Computer101
EE Admin
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question