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 


Transparent bitmap on button control

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Tue Jan 25, 2011 9:22 pm    Post subject: Transparent bitmap on button control Reply with quote

I want to put a transparent bitmap on a button. So far I have been able to put a transparent bitmap on the main window using BitBlt but if I do that on the button I need to repaint it every time it updates.. I also thought of sending a BM_SETIMAGE message to the button but I don't know how to get a HBITMAP of the transparent bitmap.

Here's my code that shows a transparent bitmap in the main window:
Code:

HDC       hdcOut, hdcMem;
BITMAP    bmInfo;
HBITMAP   hbmOld;

hdcOut = GetDC(hWnd);
hdcMem = CreateCompatibleDC(hdcOut);
hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmTraxMask);

GetObject(g_hbmTrax, sizeof(BITMAP), &bmInfo);

BitBlt(hdcOut, 0, 0, bmInfo.bmWidth, bmInfo.bmHeight, hdcMem, 0, 0, SRCAND);
SelectObject(hdcMem, g_hbmTrax);
BitBlt(hdcOut, 0, 0, bmInfo.bmWidth, bmInfo.bmHeight, hdcMem, 0, 0, SRCPAINT);

SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
ReleaseDC(hWnd, hdcOut);
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Jan 25, 2011 10:09 pm    Post subject: Reply with quote

hmm.

try creating a bitmap with CreateCompatableBitmap(), then SelectObject() said bitmap into your memory dc (created with CreateCompatableDC()) and then blit into your memory DC or something something fuck
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Wed Jan 26, 2011 5:00 pm    Post subject: Reply with quote

If you care to dig into layered windows you can do transparency fairly easy at the cost of some more in depth code and lack of support from Microsoft.

Here's a project I made using UpdateLayeredWindow:
http://67.210.99.128/patchlib/Release/patchLibv3.1.7z

Which results in things like:


If you plan to stick to using Bitblt and so on, check out owner drawn controls:
http://www.codeproject.com/KB/buttons/nativewin32xpthemes.aspx

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Thu Jan 27, 2011 1:54 pm    Post subject: Reply with quote

Thanks for the help, owner drawn did exactly what I wanted. (Y)
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