?
Solved

Open File Name mask

Posted on 2007-04-03
6
Medium Priority
?
773 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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…
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 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++.
Suggested Courses

765 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