Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Open File Name mask

Posted on 2007-04-03
6
Medium Priority
?
779 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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

972 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