Quote (infinitesimal @ 10 Nov 2009 20:57)
Quit bitching and use another API.
I don't believe this thread was named "General Chat," take it else where.
If you have something to contribute other than worthless opinions that are off-topic, post.
Code
BITMAP bmpOrig;
GetObject(hBmp, sizeof(BITMAP), &bmpOrig);
int sizeOrig = bmpOrig.bmWidthBytes * bmpOrig.bmHeight;
BYTE* pDataOrig = new BYTE[sizeOrig];
GetBitmapBits(hBmp, sizeOrig, pDataOrig);
SelectObject(hDc, hBmp);
char ImagePixel[500] = {'\0'};
sprintf(ImagePixel, "Image size: %d\n", sizeOrig);
WriteConsole(outHandle, ImagePixel, strlen(ImagePixel), NULL, NULL);
for (int x = 0; x < sizeOrig; x++) {
sprintf(ImagePixel, "pDataOrig[%d]: %d\n", x, pDataOrig[x]);
WriteConsole(outHandle, ImagePixel, strlen(ImagePixel), NULL, NULL);
}
Does absolutely nothing. There's 399 empty (value of 0) bytes in the array pDataOrig.
BITMAP structure:http://msdn.microsoft.com/en-us/library/dd183371(VS.85).aspx
Quote
typedef struct tagBITMAP {
LONG bmType;
LONG bmWidth;
LONG bmHeight;
LONG bmWidthBytes;
WORD bmPlanes;
WORD bmBitsPixel;
LPVOID bmBits;
}BITMAP, *PBITMAP;
That does me no good, because how it's capturing the image from the screen (device context *) is using a "BITMAP HANDLER" HBITMAP.
If I wanted to, I suppose I could save the image that's being captured to the harddrive (.../temp.bmp), then compare it with another *.bmp.
This shows the structure of a bitmap image:
http://msdn.microsoft.com/en-us/library/dd183391(VS.85).aspx which would simplify a lot.
'Side from all that, I still don't know how to load an image from the harddrive. There's only examples that I've seen that load it from a resource file, and that's just not acceptable.
That'd cause an extremely large *.exe file and lose the ability of viewing/editing/adding images to a folder, which is a complete no-no for what I'm aiming for here.
"Memory Device Contexts" - MSDN -http://msdn.microsoft.com/en-us/library/dd145049(VS.85).aspx
Quote
The memory DC stores bitmap images for a particular device. An application can create a memory DC by calling the CreateCompatibleDC function.
The original bitmap in a memory DC is simply a placeholder. Its dimensions are one pixel by one pixel. Before an application can begin drawing, it must select a bitmap with the appropriate width and height into the DC by calling the SelectObject function. To create a bitmap of the appropriate dimensions, use the CreateBitmap, CreateBitmapIndirect, or CreateCompatibleBitmap function. After the bitmap is selected into the memory DC, the system replaces the single-bit array with an array large enough to store color information for the specified rectangle of pixels.
This post was edited by Muted on Nov 10 2009 11:27pm