Sign in to follow this  

Able to show a Win32 window frame, unable to successfully show its background.

Recommended Posts

Here's my problem.

I am currently testing a new technique I'm learning from So far, not really good. I have been able to successfully create a window, move/drag it around, and close it (destroy it). The only big problem is that I'm not able to make it show its background color, even though I have provided it a CreateSolidBrush() with a macro RGB() in the window class. The RGB values are 10, 50, 100, and don't know what are the values to make it completely transparent, if it even existed in the macro.

The background is completely transparent. There aren't any values that I've placed that makes it transparent, nor know how to make a transparent code. Below, I have given the project ZIP folder, containing only source codes, and a picture of what it looked like as of now.

WM_PAINT works, able to route it to GetUpdateRect() and ValidateRect(), finishing the caught message by returning 0, and still like this.


Props to those who can help fix this unusual issue I'm having. It's perfectly Win32. No DirectX or OpenGL libraries in the way.
Thanks in advance.

Share this post

Link to post
Share on other sites
You have a weird way of zipping :)

For your problem: You did specify a brush for the background, but in your WndProc you handle WM_ERASEBKGND and return 1. This tells Windows that you successfully repainted the background already.

If you comment out your WM_ERASEBKGND handler DefWindowProc handles the messages and uses the supplied brush:

return 1;*/

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this