Click here to Skip to main content
15,905,325 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralSetup API Pin
Laroo24-Sep-03 7:03
Laroo24-Sep-03 7:03 
GeneralGetOpenFileName filter Pin
Jason Henderson24-Sep-03 6:05
Jason Henderson24-Sep-03 6:05 
GeneralRe: GetOpenFileName filter Pin
David Crow24-Sep-03 8:26
David Crow24-Sep-03 8:26 
GeneralRe: GetOpenFileName filter Pin
valikac24-Sep-03 9:18
valikac24-Sep-03 9:18 
GeneralRe: GetOpenFileName filter Pin
Neville Franks24-Sep-03 10:29
Neville Franks24-Sep-03 10:29 
GeneralRe: GetOpenFileName filter Pin
Jason Henderson24-Sep-03 10:46
Jason Henderson24-Sep-03 10:46 
GeneralRe: GetOpenFileName filter Pin
Neville Franks24-Sep-03 10:48
Neville Franks24-Sep-03 10:48 
GeneralRe: GetOpenFileName filter Pin
Alvaro Mendez24-Sep-03 11:03
Alvaro Mendez24-Sep-03 11:03 
How about a little function that you can call for that:

int AddToFilter(TCHAR* szFilter, int nSize, LPCTSTR szDescription, LPCTSTR szExtension)
{
   ASSERT(szFilter);
   ASSERT(szDescription);
   ASSERT(szExtension);
 
   _tcscpy(&szFilter[nSize], szDescription);
   int nLenDesc = _tcslen(szDescription);
 
   _tcscpy(&szFilter[nSize + nLenDesc + sizeof(TCHAR)], szExtension);
   int nLenExt = _tcslen(szExtension);
 
   return nSize + nLenDesc + nLenExt + (sizeof(TCHAR) * 2);
}

Then you can use it like this:

TCHAR szFilter[300] = _T("");
int nSize = 0;
 
if (IsWordInstalled())
   nSize = AddToFilter(szFilter, nSize, _T("Word"), _T("*.doc"));
 
if (IsExcelInstalled())
   nSize = AddToFilter(szFilter, nSize, _T("Excel"), _T("*.xls"));
 
AddToFilter(szFilter, nSize, _T("All Files"), _T("*.*"));



I haven't tested (or even compiled) this, but hopefully it's close enough.

Regards,
Alvaro


Hey! It compiles! Ship it.
GeneralRe: GetOpenFileName filter Pin
Jason Henderson24-Sep-03 11:12
Jason Henderson24-Sep-03 11:12 
GeneralRe: GetOpenFileName filter Pin
JWood24-Sep-03 11:12
JWood24-Sep-03 11:12 
Generalspeeding bitmap loading Pin
Ph@ntom24-Sep-03 5:34
Ph@ntom24-Sep-03 5:34 
GeneralRe: speeding bitmap loading Pin
Joaquín M López Muñoz24-Sep-03 7:47
Joaquín M López Muñoz24-Sep-03 7:47 
GeneralVC AVI problem!! Pin
iameddiewong24-Sep-03 4:49
iameddiewong24-Sep-03 4:49 
Generalc++.net crash Pin
pffdaddy24-Sep-03 4:48
pffdaddy24-Sep-03 4:48 
GeneralRe: c++.net crash Pin
jhwurmbach24-Sep-03 5:18
jhwurmbach24-Sep-03 5:18 
Questionwhere to download images? Pin
includeh1024-Sep-03 4:36
includeh1024-Sep-03 4:36 
AnswerRe: where to download images? Pin
Ravi Bhavnani24-Sep-03 4:46
professionalRavi Bhavnani24-Sep-03 4:46 
AnswerRe: where to download images? Pin
David Crow24-Sep-03 8:27
David Crow24-Sep-03 8:27 
GeneralGetting Attributes of folder....PLEASE HELP Pin
rohit.dhamija24-Sep-03 4:33
rohit.dhamija24-Sep-03 4:33 
GeneralRe: Getting Attributes of folder....PLEASE HELP Pin
Carlos Antollini24-Sep-03 4:40
Carlos Antollini24-Sep-03 4:40 
Generaltrying to prevent enter key from making dlg vanish Pin
ns24-Sep-03 4:29
ns24-Sep-03 4:29 
GeneralRe: trying to prevent enter key from making dlg vanish Pin
Ravi Bhavnani24-Sep-03 4:31
professionalRavi Bhavnani24-Sep-03 4:31 
GeneralRe: thanks... Pin
ns24-Sep-03 4:44
ns24-Sep-03 4:44 
GeneralRe: thanks... Pin
Ravi Bhavnani24-Sep-03 4:52
professionalRavi Bhavnani24-Sep-03 4:52 
GeneralRe: thanks... Pin
ns24-Sep-03 9:57
ns24-Sep-03 9:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.