I don't mean to annoy the readers, but I need some help with an exception problem with the function (I'm sure a lot of you have used this function, but I'm still inexperienced with it). Below is my code:
I'm getting exception errors at run-time after I have pressed "OK" button on the Save File dialog box.
BOOL AskUser(IN HWND hDlg,
OUT PEXTDEVMODE pdevmode)
// initialize OPENFILENAME structure
fn.lStructSize = sizeof(OPENFILENAME);
fn.Flags = OFN_HIDEREADONLY;
fn.lpstrTitle = L"PDF SaveFile";
fn.hwndOwner = NULL;
fn.lpstrCustomFilter = NULL;
fn.nMaxCustFilter = 0;
// output format
fn.lpstrFilter = L"*.pdf";
fn.nFilterIndex = 0; //formatIdx+1; // the index here is not zero-based
// output file name + path + ext
fn.lpstrFile = L"";
fn.nMaxFile = 1000;
// output file name + ext
fn.lpstrFileTitle = L"";
fn.nMaxFileTitle = 500;
// output folder
fn.lpstrInitialDir = NULL;
After searching through the forum, there's a similar problem with an exception getting thrown (http://cboard.cprogramming.com/showt...Name+exception). However, I'm not sure 100% if this is the case. I'm not sure what is fundamentally wrong with how I've set up the openfilename structure as I have attempted to follow MSDN documentation as diligently as I could. The next step for me perhaps would be using a debugger such as windbg or Visual Studio debugger to look at the register values to get some clue about the exception, but I'm not sure how to make sense out of it. Any suggestions would be much appreciated. Thanks in advance.
First-chance exception at 0x763b1ff8 (comdlg32.dll) in Savefile.exe: 0xC0000005: Access violation writing location 0x0041597c.
Unhandled exception at 0x763b1ff8 (comdlg32.dll) in Savefile.exe: 0xC0000005: Access violation writing location 0x0041597c.