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 


Double Buffering Technique

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

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Sun May 16, 2010 11:57 am    Post subject: Double Buffering Technique Reply with quote

Hey guys,

So i've learned and understand how this method works, and I got it working myself. The only problem I have is the bitmap I create, it contains a black background so when I attempt to draw on my DC and display with BitBlt it shows the black background with the things I drew. So I thought maybe instead of creating a bitmap receive a bitmap to use, that way I won't have to worry about fixing this problem. But that attempt didn't work because I couldn't find any functions to receive a Bitmap from let it be a HWND, or DC.

Code:

#include <Windows.h>

void main()
{
   int Width, Height;

   Width = 300;
   Height = 300;

   HWND hWnd = FindWindowA(NULL, "Untitled - Notepad");

   HDC hDC = GetDC(hWnd);

   HDC MemDC = CreateCompatibleDC(hDC);

   HBITMAP hBitmap = CreateCompatibleBitmap(hDC, Width, Height);

   SelectObject(MemDC, hBitmap);
      
   while (1)
   {
      TextOutA(MemDC, 10, 10, "iPromise", strlen("iPromise"));

      BitBlt(hDC, 0, 0, Width, Height, MemDC, 0, 0, SRCCOPY);
   }

   DeleteDC(hDC);
   DeleteDC(MemDC);
   DeleteObject(hBitmap);
}


My question is how can I change the background color of the bitmap so its transparent?

Another question is, is BitBlt() hooked in anyway by GameGuard or Hackshield?

Thanks,

iPromise.
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun May 16, 2010 5:51 pm    Post subject: Reply with quote

If you're trying to draw over another game, don't bother. You're going to get flicker as you have no notion of synchronization with its framerate. By solving this, you'll already be at the point where you might as well just use the games own renderer.

As far transparency, I'm not sure of a nice, clean way to do it. Maybe look into using a mask for it, or you can use blit the region of the screen your window is over to your own surface to create the illusion
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