HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sat Sep 22, 2007 7:49 am Post subject: Draw Bitmap Function, precursor to my c++ SS taker |
|
|
| Code: | void CreateBit (HDC hdc, int xStart, int yStart, int xFinish, int yFinish, HBITMAP hBitmap, bool bol)
{
BITMAP bm;
HDC hMemDC;
POINT pt;
hMemDC = GetDC(0);
hBitmap = CreateCompatibleBitmap(hMemDC, xFinish, yFinish);
SelectObject (hMemDC, hBitmap);
GetObject (hBitmap, sizeof(BITMAP), &bm);
pt.x = bm.bmWidth;
pt.y = bm.bmHeight;
if(bol)
{
BitBlt(hdc, xStart, yStart, pt.x, pt.y, hMemDC, 0, 0, SRCCOPY);
}
if(!bol)
{
}
DeleteDC(hMemDC);
}
|
| Code: | LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
HBITMAP hBitmap;
HDC hdc;
PAINTSTRUCT ps;
switch(Message) {
case WM_CREATE:
break;
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps);
CreateBit (hdc, 0, 0, 500, 400, hBitmap, TRUE);
DeleteObject(hBitmap);
EndPaint(hwnd, &ps);
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
} |
if you set it to false it wont paint the bitmap (made it like that for when i use it to produce a file of the screen
i think its fairly self forward
instead of declaring all your own hdcs and freeing them, it does it for you
just a lil simple trick
Got this from the DLL section of PW 5th edi. I changed it so you dont load a bitmap, you create your own from the screen.
_________________
|
|