Saving files on pocket pc 2002 using microsoft ce file system control

Saving files on pocket pc 2002 using microsoft ce file system control

Post by debbi » Thu, 13 Feb 2003 00:29:27



Hello.

I need to create a text file and write data to it using
pocket pc 2002. The only reference I can make is to
microsoft ce file system control and I dont know how to
use this or if it even works with ppc 2002 (and not
windows ce) platform.

Cheers

 
 
 

Saving files on pocket pc 2002 using microsoft ce file system control

Post by Pete » Thu, 13 Feb 2003 01:32:06


Quote:>-----Original Message-----
>Hello.

>I need to create a text file and write data to it using
>pocket pc 2002. The only reference I can make is to
>microsoft ce file system control and I dont know how to
>use this or if it even works with ppc 2002 (and not
>windows ce) platform.

>Cheers
>.

Debbie,

Assuming 'C'...

You can use GetSaveFileName function call to open a save
dialog box eg;

        TCHAR                           szFile[MAX_PATH] =
TEXT("\0");
        TCHAR                           szPath[MAX_PATH] =
TEXT("\\My Documents");

        memset( &(ofn), 0, sizeof(ofn));

        ofn.lStructSize         = sizeof(ofn);
        ofn.hwndOwner           = hWnd;;
        ofn.nMaxFile            = MAX_PATH;
        ofn.lpstrFilter         = TEXT("Text(*.txt)
\0*.tsk\0");  
        ofn.lpstrTitle          = TEXT("Save As");
        ofn.Flags                       =
OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT;
        ofn.lpstrDefExt         = TEXT("txt");
        ofn.lpstrInitialDir = szPath;
        ofn.lpstrFile           = szFile;

        if (!GetSaveFileName(&ofn)){
                return false;
        }

Then pass the filename to CreateFile function eg;

if ((hFile = CreateFile
(ofn.lpstrFile,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTR
IBUTE_NORMAL,NULL)) == INVALID_HANDLE_VALUE){
                MessageBox(g_hWnd,L"Error saving
theme",NULL,MB_OK|MB_ICONERROR);
                return false;
        }

Then use WriteFile function to write to the file...
Closing it with CloseHandle

Cheers

Peter.

 
 
 

Saving files on pocket pc 2002 using microsoft ce file system control

Post by debbi » Thu, 13 Feb 2003 01:57:26


Sorry, new to this and forgot to mention - working with
embedded visual basic 3.0

Thankyou though..