CFileDialog doubt
-
Wow Roger! There's documentation for these things? Who'd have thought. OT: How are things going for you? It's been a long time. :)
“Follow your bliss.” – Joseph Campbell
-
Hi All, I am using CFileDialog class in my application to browse a file. when i click on browse always by default application is opening desktop folder. I have one default path how to open that path instead of desktop. Thanks in advance. Regards, anil
You should set the
lpstrInitialDir
member of theCFileDialog
'sm_ofn
struct (see [^] and [^]). Please read carefully the documentation: file dialog behaviour is OS-dependant (for instance,Windows 7
behaves distinctively with respect the initial directory). :) [added] Wow! Damned *fast* Roger! [/added] :-DIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Wow Roger! There's documentation for these things? Who'd have thought. OT: How are things going for you? It's been a long time. :)
“Follow your bliss.” – Joseph Campbell
:-) Hi Rajesh! Yep it's been a long time. The main reason is that I've been assigned to do Java-mumbo-jumbo and Eclipse plugins. ;-) Not really my cup of tea. Besides I've been busy (and still am...) trying to get my spare time to fit into the 24 hours given for each day. :zzz: How are things at your end? Busy? Nice things to work with?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
:-) Hi Rajesh! Yep it's been a long time. The main reason is that I've been assigned to do Java-mumbo-jumbo and Eclipse plugins. ;-) Not really my cup of tea. Besides I've been busy (and still am...) trying to get my spare time to fit into the 24 hours given for each day. :zzz: How are things at your end? Busy? Nice things to work with?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknownYeah, there are a few interesting things that I'm trying out (involved in a research). Nothing new or profoundly exciting though. :)
“Follow your bliss.” – Joseph Campbell
-
You should set the
lpstrInitialDir
member of theCFileDialog
'sm_ofn
struct (see [^] and [^]). Please read carefully the documentation: file dialog behaviour is OS-dependant (for instance,Windows 7
behaves distinctively with respect the initial directory). :) [added] Wow! Damned *fast* Roger! [/added] :-DIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Thanks Pallini :) I have problem with filter, i am adding filter like this dlgFile.m_ofn.lpstrFilter = _T("*.pdm"); it has to display all .pdm files, but its not displaying .pdm files in the dialog. please help me in this regard. Thanks in advance. Regards, Anil
-
You should set the
lpstrInitialDir
member of theCFileDialog
'sm_ofn
struct (see [^] and [^]). Please read carefully the documentation: file dialog behaviour is OS-dependant (for instance,Windows 7
behaves distinctively with respect the initial directory). :) [added] Wow! Damned *fast* Roger! [/added] :-DIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]CPallini wrote:
[added] Wow! Damned *fast* Roger! [/added]
Yeah, but I've been waiting for that one for about two months without answering anything else, so I was *really* ready. :cool:
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
CPallini wrote:
[added] Wow! Damned *fast* Roger! [/added]
Yeah, but I've been waiting for that one for about two months without answering anything else, so I was *really* ready. :cool:
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknownWell, I cannot give way to "anyone waiting for about two months"... :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Thanks Pallini :) I have problem with filter, i am adding filter like this dlgFile.m_ofn.lpstrFilter = _T("*.pdm"); it has to display all .pdm files, but its not displaying .pdm files in the dialog. please help me in this regard. Thanks in advance. Regards, Anil
Member 4399771 wrote:
dlgFile.m_ofn.lpstrFilter = _T("*.pdm");
Should be
dlgFile.m_ofn.lpstrFilter = _T("*.pdm\0");
:)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Yeah, there are a few interesting things that I'm trying out (involved in a research). Nothing new or profoundly exciting though. :)
“Follow your bliss.” – Joseph Campbell
Rajesh R Subramanian wrote:
involved in a research
Rajesh R Subramanian wrote:
Nothing new or profoundly exciting though.
I see a contraddiction, Watson! :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Member 4399771 wrote:
dlgFile.m_ofn.lpstrFilter = _T("*.pdm");
Should be
dlgFile.m_ofn.lpstrFilter = _T("*.pdm\0");
:)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Dear Pallini thanks for your reply! I tried with \0 still dialog not filtering. please check the code below.
CFileDialog dlgFile(TRUE); CString fileName; const int c\_cMaxFiles = 100; const int c\_cbBuffSize = (c\_cMaxFiles \* (MAX\_PATH + 1)) + 1; dlgFile.GetOFN().lpstrFile = fileName.GetBuffer(c\_cbBuffSize); dlgFile.GetOFN().nMaxFile = c\_cMaxFiles; dlgFile.m\_ofn.lpstrInitialDir = m\_sWorkpathPdm; dlgFile.m\_ofn.lpstrFilter = \_T("\*.sct\\0"); dlgFile.DoModal(); fileName.ReleaseBuffer(); if (!fileName.IsEmpty()) m\_sMapFileName = fileName; UpdateData(FALSE);
Regards, Anil
hi
-
Dear Pallini thanks for your reply! I tried with \0 still dialog not filtering. please check the code below.
CFileDialog dlgFile(TRUE); CString fileName; const int c\_cMaxFiles = 100; const int c\_cbBuffSize = (c\_cMaxFiles \* (MAX\_PATH + 1)) + 1; dlgFile.GetOFN().lpstrFile = fileName.GetBuffer(c\_cbBuffSize); dlgFile.GetOFN().nMaxFile = c\_cMaxFiles; dlgFile.m\_ofn.lpstrInitialDir = m\_sWorkpathPdm; dlgFile.m\_ofn.lpstrFilter = \_T("\*.sct\\0"); dlgFile.DoModal(); fileName.ReleaseBuffer(); if (!fileName.IsEmpty()) m\_sMapFileName = fileName; UpdateData(FALSE);
Regards, Anil
hi
Member 4399771 wrote:
dlgFile.m_ofn.lpstrFilter = _T("*.sct\0");
Change to
dlgFile.m_ofn.lpstrFilter = _T("sct files\0*.sct\0");
dlgFile.m_ofn.nFilterIndex = 1;:)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Member 4399771 wrote:
dlgFile.m_ofn.lpstrFilter = _T("*.sct\0");
Change to
dlgFile.m_ofn.lpstrFilter = _T("sct files\0*.sct\0");
dlgFile.m_ofn.nFilterIndex = 1;:)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Thank you very much Pallini :) The problem is fixed! Is there any documentation available on this topic. Regards, Anil
-
Thank you very much Pallini :) The problem is fixed! Is there any documentation available on this topic. Regards, Anil
Member 4399771 wrote:
Thank you very much Pallini
You are welcome.
Member 4399771 wrote:
Is there any documentation available on this topic.
There is, of course:
:)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Rajesh R Subramanian wrote:
involved in a research
Rajesh R Subramanian wrote:
Nothing new or profoundly exciting though.
I see a contraddiction, Watson! :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Problem is, it isn't anywhere in my area of interests that I'm "researching" on. :)
“Follow your bliss.” – Joseph Campbell