bug in windows getsavefilename api?
- From: RemoveThis_fredgillioz@xxxxxx (Frederic Gillioz)
- Date: Sun, 30 Oct 2005 20:41:07 GMT
hi,
when i try to compile the following code and execute the program as follows,
it crashes. i tried the mingw compiler as well as ms vs .net 2003. but first
the code:
#define STRICT
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
szCmdLine, int iCmdShow)
{
OPENFILENAME FileDialogInfo;
char filterNames[] = "stuff (*.dat)\0*.dat\0";
char fileName[513];
for(int i=0; i<2; ++i)
{
ZeroMemory(&FileDialogInfo, sizeof(FileDialogInfo));
fileName[0] = '\0';
FileDialogInfo.lStructSize = sizeof(FileDialogInfo);
FileDialogInfo.hwndOwner = NULL;
FileDialogInfo.lpstrFilter = filterNames;
FileDialogInfo.nFilterIndex = 1;
FileDialogInfo.lpstrFile = fileName;
FileDialogInfo.nMaxFile = sizeof(fileName);
FileDialogInfo.Flags = OFN_PATHMUSTEXIST |
OFN_OVERWRITEPROMPT;
GetSaveFileName(&FileDialogInfo);
}
return 0;
}
and here is how i have to use it to make it crash:
1. create an arbitrary file (text or binary; content doesn't matter) and name
it 'name.dat'. two things are important here: give it the .dat extension and
save it on your desktop!
2. start the compiled program
3. now browse to your desktop when the first save file dialog appears
4. point your mousepointer over the created .dat file in the save file dialog,
so that it fades in an info box with information about type, last change and
size of that file.
5. now do what ever you want, to bring up the second dialog. at best click
cancel.
6. repeat step 3 and 4. when the info box is about to fade in again the
program crashes.
that's it. i know it sounds strange, but it crashes on my computer. i use
windows xp pro sp2. is there something wrong with my code? if it doesn't crash
on your computer, what os do you use?
thanks in advance
fred
.
- Prev by Date: Synchronization routine
- Next by Date: Re: objects vs library
- Previous by thread: Synchronization routine
- Next by thread: What is a "null loop"?
- Index(es):
Relevant Pages
|