int red = 0;
HANLDE file = NULL;
file = CreateFile(filename,FILE_ALL_ACCESS,0,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (file == NULL)
{
ErrorBox(NULL,"cant create file");
return FAILURE;
}
ReadFile(file,&bmfh,sizeof(BITMAPFILEHEADER),&red,NULL);
if (bmfh.bfType != 19778) // not a bitmap
{
ShowError();
ErrorBox(NULL,"not a bitmap");
CloseHandle(file);
return FAILURE;
}
Should I change the CreateFile parameters or what?
[edited by - Atm97fin on December 14, 2003 10:30:51 AM]
[edited by - Atm97fin on December 14, 2003 10:31:58 AM]
Profiling error
When I try to profile my program I get Invalid handle error from windows ReadFile function. Creating the file succeeds. I try to open the file from my bitmap handling object. Excluding the object won't help.
Here's the code:
It seems that the CreateFile function doesn''t accept my filenames. Ex: "directory\\file.bmp"
What could be the reason for this. They work fine when i''m not profiling.
What could be the reason for this. They work fine when i''m not profiling.
Possibly the profiler causes it to run from a different path? ie if you''ve got relative paths to your resources they might not be valid
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement