LEADTOOLS Support
General
General Questions
Problem with using L_ScreenCaptureBitmap function for LeadTools 16.
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, November 5, 2008 11:24:23 AM(UTC)
Groups: Registered
Posts: 3
Hi, I'm having troubling using the L_ScreenCaptureBitMap function for LeadTools v16. Before I purchased LeadTools 16, my program worked with the LeadTools v15 Evaluation version....but for some reason, I get ERROR_INVALID_STRUCT_SIZE return value when calling the function. Below is a section of my code....I have been looking at this code for hours and still don't know why I'm getting this error code. It states in the LeadTools API, not to allocate the BITMAPHANDLE struct since the function does that......
int retVal;
char* file = new char[fileName.GetLength() + 1];
strcpy(file, fileName);
CDC* dcScreen = GetDC();
HDC hdcScreen = dcScreen->GetSafeHdc();
BITMAPHANDLE hBmp;
RECT rect;
rect.left = xOffset;
rect.top = yOffset;
rect.right = xOffset + graphSize.cx;
rect.bottom = yOffset + graphSize.cy;
retVal = L_ScreenCaptureBitmap(hdcScreen, &hBmp, sizeof(BITMAPHANDLE), &rect);
#2
Posted
:
Thursday, November 6, 2008 3:55:47 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
The BITMAPHANDLE structure was not being initialized to zero. You can do that in one of two ways:
BITMAPHANDLE BitmapHandle = {0}; //Qasem1 : set to zeroes
memset(&BitmapHandle, 0, sizeof(BITMAPHANDLE)); //Qasem2 : or this
You should ALWAYS initialize all structure members to zero (and also all pointers to NULL) as a good programming practice, which has no significant impact on program size or speed.
#3
Posted
:
Thursday, November 6, 2008 9:48:49 AM(UTC)
Groups: Registered
Posts: 3
Its old legacy code.....but what you suggested does not work.....I still get the same error code number...... Has there been any changes to the L_ScreenCaptureBitmap function from version 15 to version 16......since the code worked in 15.
#4
Posted
:
Friday, November 7, 2008 6:30:58 AM(UTC)
Groups: Registered
Posts: 3
I fixed the problem on my own.....but thanks for the replies anyway.......
#5
Posted
:
Saturday, May 23, 2009 10:19:25 AM(UTC)
Groups: Registered
Posts: 3
How about you fill in the other people that have the same or similar issue with how you solved your problem...
LEADTOOLS Support
General
General Questions
Problem with using L_ScreenCaptureBitmap function for LeadTools 16.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.