Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

button color change

Posted on 1999-07-24
3
Medium Priority
?
322 Views
Last Modified: 2013-12-03
I use Button class to create a window.
I get the hwnd and I wnat to change the color of the button when I get the message WM_LBUTTIONDOWN.
How can I change the color?
Please in c++
Any comments will be helpful,thanks
Babyworship:)
0
Comment
Question by:Babyworship
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:Babyworship
ID: 1403649
Edited text of question.
0
 
LVL 2

Accepted Solution

by:
r parkinson earned 100 total points
ID: 1403650
You need to process the WM_CTLCOLORBTN message.  This is quite well documented, but basically you just return the handle of the brush that you want to paint the background with. You program has to destroy the brush later though (e.g. when you destroy the window) otherwise you get a memory leek.
0
 

Author Comment

by:Babyworship
ID: 1403651
Thanks.
So,I need sendmessage()?

switch(uMsg)
   {case WM_LBUTTONDOWN:
 
HDC hdc=GetDC(hwnd);
sendmessage(hwnd,WM_CTLCOLORBTN,hdc,hwnd);

I don't know what shuld I do next,how to change the color?



0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question