From: Tom Serface on 16 Sep 2009 12:32 You should get the drives and folders. I thought of another thing. You could debug down into the CFileDialog set up code and see what is being passed to the action open window call. Tom "Guido Franzke" <guidof73(a)yahoo.de> wrote in message news:ecjTJrtNKHA.3552(a)TK2MSFTNGP04.phx.gbl... > The list field is empty. There are no drives, although I have harddisks > and > net drives. When I open e.g. in notepad, I can see the same CFileDialog, > but > here the My Computer drives are all shown. > Why they are not shown in my CFileDialog? I can only select my drive with > the combobox on top, when I select there, all drives and files/dirs are > shown everywhere (e.g. in C: system) > > Do you know why in "My Computer" nothing is shown?
From: Alexander Grigoriev on 16 Sep 2009 22:25 Make sure you're not calling CoInitializeEx with argument other than COINIT_APARTMENTTHREADED. If COM is initialized on the current thread with COINIT_MULTITHREADED mode, the shell functions (including the file dialog) won't work. "Guido Franzke" <guidof73(a)yahoo.de> wrote in message news:OXfGyusNKHA.3588(a)TK2MSFTNGP05.phx.gbl... > Hello NG, > > I see a strange behaviour of CFileDialog on some, but not all computers. > When I open a dialog in Windows XP with > > static char hFilter[] = "jpg Files (*.jpg,*.jpeg)|*.jpg;*.jpeg|All Files > (*.*)|*.*||"; > CFileDialog fdlg(TRUE, "", "",OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, > hFilter, this); > if (fdlg.DoModal() == IDOK) ... > > When I press left on "My Computer", the file list don't show files and > directories. But there are e.g drives and network drives. When I press "My > documents" the file and directory list is shown correctly. > > Even when I swap the filter definitions to > static char hFilter[] = "All Files (*.*)|*.*|jpg Files > (*.jpg,*.jpeg)|*.jpg;*.jpeg||"; > the "My Computer" does not show anything. > > Why is it? > > Thanks for help, > Guido > >
From: Joseph M. Newcomer on 21 Sep 2009 02:03 See below... On Wed, 16 Sep 2009 14:45:09 +0200, "Guido Franzke" <guidof73(a)yahoo.de> wrote: >Hello NG, > >I see a strange behaviour of CFileDialog on some, but not all computers. >When I open a dialog in Windows XP with > > static char hFilter[] = "jpg Files (*.jpg,*.jpeg)|*.jpg;*.jpeg|All Files >(*.*)|*.*||"; **** Do not use a static variable. Do not use char (obsolete) Do not put text like this in a source program. You should load this from a STRINGTABLE entry. Always think "localization". If you put an English-language string in your program, you have made a design error. I've not seen this fail. But I've never used a static char. Are you sure the right thing is being done, or could it be that the second and subsequent calls fail because they are modifying this string "in place"? I'd say avoid the static char and go with a CString. ***** > CFileDialog fdlg(TRUE, "", "",OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, >hFilter, this); **** _T(""), _T(""), always think Unicode! joe **** > if (fdlg.DoModal() == IDOK) ... > >When I press left on "My Computer", the file list don't show files and >directories. But there are e.g drives and network drives. When I press "My >documents" the file and directory list is shown correctly. > >Even when I swap the filter definitions to > static char hFilter[] = "All Files (*.*)|*.*|jpg Files >(*.jpg,*.jpeg)|*.jpg;*.jpeg||"; >the "My Computer" does not show anything. > >Why is it? > >Thanks for help, >Guido > Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Joseph M. Newcomer on 21 Sep 2009 10:16 See below... On Mon, 21 Sep 2009 02:03:30 -0400, Joseph M. Newcomer <newcomer(a)flounder.com> wrote: >See below... >On Wed, 16 Sep 2009 14:45:09 +0200, "Guido Franzke" <guidof73(a)yahoo.de> wrote: > >>Hello NG, >> >>I see a strange behaviour of CFileDialog on some, but not all computers. >>When I open a dialog in Windows XP with >> >> static char hFilter[] = "jpg Files (*.jpg,*.jpeg)|*.jpg;*.jpeg|All Files >>(*.*)|*.*||"; >**** >Do not use a static variable. >Do not use char (obsolete) >Do not put text like this in a source program. > >You should load this from a STRINGTABLE entry. Always think "localization". If you put >an English-language string in your program, you have made a design error. > >I've not seen this fail. But I've never used a static char. Are you sure the right thing >is being done, or could it be that the second and subsequent calls fail because they are >modifying this string "in place"? I'd say avoid the static char and go with a CString. >***** **** I checked the code this morning and it makes a copy of the input string, so this guess is incorrect. But nothing else about the variable is right: static is questionable char is wrong hFilter[] is a lousy name (violates proper HN usage) the use of anything other than a CString is questionable it is not loaded from the STRINGTABLE The example from which this is copied has NOTHING RIGHT IN IT! It is an AMAZINGLY poor example! joe **** >> CFileDialog fdlg(TRUE, "", "",OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, >>hFilter, this); >**** >_T(""), _T(""), always think Unicode! > joe > >**** >> if (fdlg.DoModal() == IDOK) ... >> >>When I press left on "My Computer", the file list don't show files and >>directories. But there are e.g drives and network drives. When I press "My >>documents" the file and directory list is shown correctly. >> >>Even when I swap the filter definitions to >> static char hFilter[] = "All Files (*.*)|*.*|jpg Files >>(*.jpg,*.jpeg)|*.jpg;*.jpeg||"; >>the "My Computer" does not show anything. >> >>Why is it? >> >>Thanks for help, >>Guido >> >Joseph M. Newcomer [MVP] >email: newcomer(a)flounder.com >Web: http://www.flounder.com >MVP Tips: http://www.flounder.com/mvp_tips.htm Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Guido Franzke on 22 Sep 2009 09:07 Ok, thank you for your detailed analysis. Guido "Joseph M. Newcomer" <newcomer(a)flounder.com> > **** > I checked the code this morning and it makes a copy of the input string, so this guess is > incorrect. But nothing else about the variable is right: > > static is questionable > char is wrong > hFilter[] is a lousy name (violates proper HN usage) > the use of anything other than a CString is questionable > it is not loaded from the STRINGTABLE > > The example from which this is copied has NOTHING RIGHT IN IT! It is an AMAZINGLY poor > example! > joe > ****
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: No source on specified on that location Next: Applying windows 7 theme in MFC application |