GetSaveFileName problem on Pocket PC 
Author Message
 GetSaveFileName problem on Pocket PC

I have a fairly irritating problem with the GetSaveFileName() function call:
When I debug-step through the following code on my Fujitsu Siemens Pocket
Loox, after actually filling out the File Dialog and hitting 'OK', next thing
I get a

"First-chance exception in ofntest.exe: 0xC0000005: Access Violation"

If I don't debug, it simply bails out, without displaying the message box.

I believe the code is straight forward and 'from the book'; however, I might
overlook something (btw, I'm using the Pocket PC SDK on a Pocket PC 2002
machine, but I don't see why this actually should be a problem).

Here's the code (that's all of it, I narrowed the problem down so far)

#include <windows.h>
#include <commdlg.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
            LPWSTR lpCmdLine, int nShowCmd)
    TCHAR name[1024] = TEXT("");

    memset(&ofn, 0, sizeof(ofn));
    ofn.lStructSize = sizeof(ofn);
    ofn.hwndOwner = NULL;
    ofn.hInstance = 0;
    ofn.lpstrFilter = TEXT("All files (*.*)\0*.*\0");
    ofn.lpstrCustomFilter = NULL;
    ofn.nMaxCustFilter = 0;
    ofn.nFilterIndex = 1;
    ofn.lpstrFile = name;
    ofn.nMaxFile = sizeof(name) / sizeof(TCHAR);
    ofn.lpstrFileTitle = NULL;
    ofn.nMaxFileTitle = 0;
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = TEXT("Select File for REU");
    ofn.Flags = 0;
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lpstrDefExt = NULL;

    if (GetSaveFileName(&ofn))
        MessageBox(NULL, name, TEXT("Selected File"), MB_OK);

    return 0;


Thanks for looking into this,


Sun, 11 Sep 2005 05:20:54 GMT  
 GetSaveFileName problem on Pocket PC
Hallo Markus,

>ofn.lpstrFilter = TEXT("All files (*.*)\0*.*\0");

hier fehlt eine abschlie?ende Null:            ^
ofn.lpstrFilter = TEXT("All files (*.*)\0*.*\0\0");

MfG Wolfgang

Sun, 11 Sep 2005 05:35:32 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Pocket PC / Pocket PC 2002: CDialog::m_bFullScreen

2. New article at Pocket PC Developer Network - Testing programs on Pocket PC

3. Pocket PC / Pocket PC 2002: CDialog::m_bFullScreen

4. what differencies are between Pocket PC SDK an Pocket PC 2002 SDK

5. need help on getting desktop PC to communicate w/ Pocket PC

6. Difference between PalmSize PC et Pocket PC

7. Serial Communication between Pocket PC and Visual C PC Application

8. make a communcation btw pc and pocket pc

9. Winsock problem in pocket PC

10. Problem Dynamically Replace Menu in Pocket PC

11. pocket pc msxml save() problem

12. IID_IPropertyBag problem (OBEX on Pocket PC 2002)


Powered by phpBB® Forum Software