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 


Proper window class for a Disassembler in C++
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Sat Feb 06, 2010 6:16 am    Post subject: Reply with quote

Finally today i got my time to look into some double buffering, the idea seems pretty simple to me, however i dont seem to be able to get it to work, here is my code so far:
Code:
LRESULT CustomControl::OnPaint(){
   HDC hDC = GetDC(hWnd);
   HDC hDCMem = CreateCompatibleDC(hDC);
   RECT rect;
   GetClientRect(hWnd, &rect);
   int iHeight = rect.bottom-rect.top;
   int iWidth = rect.right-rect.left;
   HBITMAP hBM = CreateCompatibleBitmap(hDCMem, iWidth, iHeight);
   HBITMAP hOldBM = (HBITMAP)SelectObject(hDCMem, hBM);
   //Paint code here, right?, painting to the hDCMem
   BitBlt(hDC, 0, 0, iWidth, iHeight, hDCMem, 0, 0, SRCCOPY);
   SelectObject(hDCMem, hOldBM);
   DeleteObject(hBM);
   DeleteDC(hDCMem);
   ReleaseDC(hWnd, hDC);
    return 0;
}


But whatever i do to paint the hDCMem, it keeps being entirely black, what am i doing wrong? Sad, i can paint it using TextOut, then the text will show in black, and the background around the text will be gray (as any other window), but how do i make the entire hDCMem gray?, if i try to SetBkColor with anything but 0xFFFFFF, the Text wont even show, and it will stay entirely black -.-
edit: FillRect seems to solve the entire black thing, except that i can only make it white..., but SetBkColor still doesent work Sad
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
Goto page Previous  1, 2
Page 2 of 2

 
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