Using CPalette in Modeless Dialog Box

Posted on 2001-07-23
Last Modified: 2012-06-27
I am trying to display some bitmaps in a modeless dialog box.  I only have 256 colors to work with.  Everything works fine, except when I switch to a different app that has an uncompatable palette.  I have it so that my main window works correctly all the time (I am displaying bitmaps in it as well).  Does anyone know of some sample code for updating the palette for a modeless dialog box or have any suggestion beside getting a better video card.  I have already looked at the DIBLook example, this was how I got my main app window to work correctly. Help, please.
Question by:jhurley

Accepted Solution

FengYuan earned 200 total points
ID: 6311052
Basically, you have to handle palette changing messages properly. But these messages are only passed to top-level window.

If your dialog box is not top-level window, either you program your top-level window to pass the message to it; or you pass the palette handle to the top-level window, which handles palette changing message.

You can simply use the halftone palette in the top-level window.
LVL 11

Expert Comment

ID: 6833132
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to accept "FengYuan" comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is:


Expert Comment

ID: 6853130
Per recommendation comment force/accepted by

Community Support Moderator
Experts Exchange

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

939 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

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now