Solved

Open File Name mask

Posted on 2007-04-03
6
754 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now