Jump to content
  • Advertisement
Sign in to follow this  
tom_mai78101

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

This topic is 2537 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here's my problem.

I am currently testing a new technique I'm learning from Gamedev.net. 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.


Capture-3.png

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
Advertisement
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:


/*case WM_ERASEBKGND:
return 1;*/

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!