Highlord
August 18th, 2004, 05:01 AM
The following error (appears in dialog) occurred after I close my program:
Debug Error!
Program:...\Application.exe
DAMAGE: after Normal block (#818) at 0x00ACF920.
(Press Retry to debug the application)
I have two common dialogs GetOpenFileName(&ofn), and GetSaveFileName(&ofn).
If I don't call the function, the program exit fine, but if I call them during the program execution, the above error occurred. What might be the cause of it?
The following are the functions that initiate the ofn structure, and call the function:
/** This is the general dialog generation for all load and save **/
void PopFileInitialize(HWND hwnd)
{
static TCHAR szFilter[] = TEXT ("Text Files (*.TXT)\0*.txt\0") \
TEXT ("All Files (*.*)\0*.*\0\0");
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.hInstance = NULL;
ofn.lpstrFilter = szFilter;
ofn.lpstrCustomFilter = NULL;
ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 0;
ofn.lpstrFile = NULL;
ofn.nMaxFile = 100;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 100;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = NULL;
ofn.Flags = 0;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = TEXT ("txt");
ofn.lCustData = 0L;
ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL;
}
int PopFileOpenDlg(HWND hwnd, PTSTR FileName, PTSTR TitleName)
{
TitleName = NULL;
ofn.hwndOwner = hwnd;
ofn.lpstrFile = FileName;
ofn.lpstrFileTitle = TitleName;
ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT ;
return GetOpenFileName(&ofn);
}
int PopFileSaveDlg(HWND hwnd, PTSTR FileName, PTSTR TitleName)
{
TitleName = NULL;
ofn.hwndOwner = hwnd;
ofn.lpstrFile = FileName;
ofn.lpstrFileTitle = TitleName;
ofn.Flags = OFN_OVERWRITEPROMPT;
return GetSaveFileName(&ofn);
}
I pass a string that is typecast into a (char*), I don't know if that makes a difference or not.
Debug Error!
Program:...\Application.exe
DAMAGE: after Normal block (#818) at 0x00ACF920.
(Press Retry to debug the application)
I have two common dialogs GetOpenFileName(&ofn), and GetSaveFileName(&ofn).
If I don't call the function, the program exit fine, but if I call them during the program execution, the above error occurred. What might be the cause of it?
The following are the functions that initiate the ofn structure, and call the function:
/** This is the general dialog generation for all load and save **/
void PopFileInitialize(HWND hwnd)
{
static TCHAR szFilter[] = TEXT ("Text Files (*.TXT)\0*.txt\0") \
TEXT ("All Files (*.*)\0*.*\0\0");
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.hInstance = NULL;
ofn.lpstrFilter = szFilter;
ofn.lpstrCustomFilter = NULL;
ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 0;
ofn.lpstrFile = NULL;
ofn.nMaxFile = 100;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 100;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = NULL;
ofn.Flags = 0;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = TEXT ("txt");
ofn.lCustData = 0L;
ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL;
}
int PopFileOpenDlg(HWND hwnd, PTSTR FileName, PTSTR TitleName)
{
TitleName = NULL;
ofn.hwndOwner = hwnd;
ofn.lpstrFile = FileName;
ofn.lpstrFileTitle = TitleName;
ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT ;
return GetOpenFileName(&ofn);
}
int PopFileSaveDlg(HWND hwnd, PTSTR FileName, PTSTR TitleName)
{
TitleName = NULL;
ofn.hwndOwner = hwnd;
ofn.lpstrFile = FileName;
ofn.lpstrFileTitle = TitleName;
ofn.Flags = OFN_OVERWRITEPROMPT;
return GetSaveFileName(&ofn);
}
I pass a string that is typecast into a (char*), I don't know if that makes a difference or not.