Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Draw Bitmap Function, precursor to my c++ SS taker

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sat Sep 22, 2007 7:49 am    Post subject: Draw Bitmap Function, precursor to my c++ SS taker Reply with quote

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.

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites