Skip to main content
Email Password   helpLost your password?

Sample screenshot

Introduction

On the PocketPC, the File Open dialog is not very versatile. In fact, you are limited to a small number of directories, which may be too limiting for your own purposes. I started to think about a possible solution for this problem after reading a post in the Mobile / Embedded forum, where a reader complains about the limitations of CFileDialog.

This article describes a solution for this problem, by implementing a more advanced File Open dialog.

CFileOpenDlg

The dialog is implemented in the CFileOpenDlg class in the demo application. Its usage is very straightforward, as you can see from the sample below:

void CChildView::OnFileOpen() 
{
    CFileOpenDlg    dlg;

    if(IDOK == dlg.DoModal())
    {
        CString    strFullPath(dlg.GetPath());

        strFullPath += dlg.GetFileName();

        MessageBox(strFullPath);
    }
}

In order to get the full path name, you have to append the path and the file name, as reported by GetPath() and GetFileName().

File filters are set through the SetFilter method. By default, the dialog uses SetFilter("*"), so all files are displayed. Please note that this filter will only affect file browsing, not directory browsing.

Using The Class

Unfortunately, this class is not completely encapsulated because it needs some resources, namely the bitmaps for the list header and the dialog itself. When porting this code to your application, some cutting and pasting will be necessary. Apart from that, you will need the CExDialog and CExDlgEngine classes in order to be able to print a header in the dialog. This code is heavily based on prior art, which you can find in this article: How can I create a dialog title like in Control Panel property pages?

Limitations and Future Improvements

There are a number of limitations that will be addressed in future updates:

Release History

26 January 2004

Third release in CodeProject with the following updates:

15 May 2003

Removed references to spurious #includes and symbols.

14 May 2003

Second release in CodeProject with the following updates:

27 Mar 2003

First release in CodeProject.

Thank You

Amit Dey provided the code and idea for using the system image list. Also, he provided guidance when I completely goofed the first time I tried it.

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
Generalhow to run .ppt file on smartdevice application Pin
Member 4120189
1:38 25 Sep '08  
GeneralMak it work across a LAN Pin
jima2z
5:22 6 Jan '07  
Generalshell open command Pin
M i s t e r L i s t e r
19:02 17 Oct '06  
GeneralCode ported to PPC2003 and WM5 under VS2005 [modified] Pin
Vincent_RICHOMME
8:38 10 Aug '06  
GeneralRe: Code ported to PPC2003 and WM5 under VS2005 Pin
JasonHo
2:32 24 Aug '06  
QuestionRe: Code ported to PPC2003 and WM5 under VS2005 Pin
goddamnelectric
0:06 10 Jan '07  
GeneralRe: Code ported to PPC2003 and WM5 under VS2005 Pin
noob_the_penguin
2:32 7 Jun '07  
GeneralRe: Code ported to PPC2003 and WM5 under VS2005 Pin
Vincent_RICHOMME
12:31 7 Jun '07  
GeneralFileOpen2: A Command Line Version [modified] Pin
NaviGer
1:23 27 May '06  
Generalanyone ported this to VS 2005? Pin
miggedy
18:12 21 Mar '06  
GeneralRe: anyone ported this to VS 2005? Pin
Vincent_RICHOMME
8:39 10 Aug '06  
GeneralManaged Code Equivalent of this? Pin
Vasudevan Deepak Kumar
5:10 14 Mar '06  
GeneralRe: Managed Code Equivalent of this? Pin
João Paulo Figueira
5:16 14 Mar '06  
GeneralSaving Bitmaps in WinCE Pin
Justin Clayden
17:01 12 Dec '05  
GeneralCan I use that on my (GLP) project? Pin
haamsteer
10:10 17 Oct '05  
GeneralRe: Can I use that on my (GLP) project? Pin
João Paulo Figueira
12:18 17 Oct '05  
GeneralRe: Can I use that on my (GLP) project? Pin
franprak
18:35 6 Mar '07  
GeneralRe: Can I use that on my (GLP) project? Pin
João Paulo Figueira
23:59 6 Mar '07  
GeneralCan not found Deque.h Pin
lvguangchuan
12:21 6 Oct '05  
GeneralRe: Can not found Deque.h Pin
João Paulo Figueira
13:18 6 Oct '05  
GeneralRe: Can not found Deque.h Pin
NaviGer
6:48 21 May '06  
GeneralRe: Can not found Deque.h Pin
NaviGer
6:52 21 May '06  
GeneralRe: Can not found Deque.h Pin
João Paulo Figueira
7:16 21 May '06  
GeneralRe: Can not found Deque.h [modified] Pin
Andy Byron
8:14 28 Sep '06  
GeneralSmall improvements Pin
Dmitry Yakimov
6:53 18 Aug '05  


Last Updated 26 Jan 2004 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009