Archived

This topic is now archived and is closed to further replies.

Profiling error

This topic is 5116 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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:
        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]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites