Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,
I must modify the Windows default CColorDialog. I want to put a combobox instead of "define custom colors" pushbutton. I found some explanations, but I did not understand how to use the color.dlg template and CHOOSECOLOR structure.
Someone could help me?
Thanks
Posted

You should add the color.dlg resource to your project's resource file and add or modify the controls to meet your own requirements. Then add a callback function to handle messages raised by the new controls. The dialog operates much the same as a user defined dialog but with the additional standard functionality provided by Microsoft. For further information see here[^] and the linked example.
 
Share this answer
 
Comments
Sandeep Mewara 7-Sep-10 8:13am    
Comment posted by OP:
Thanks Richard,
just two questions.

- I'm using MFC, I've to add the callback function even in this case?
- How can I create LPCHOOSECOLOR lpcc?

Thanks a lot
Sandeep Mewara 7-Sep-10 8:14am    
Oops! Caching probably. Now I can see you knew and responded to it! Sorry for posting it again as a comment to you.
I know what's a pointer, but I doubt this is the right way to use:
CHOOSECOLOR *lpcc = new CHOOSECOLOR;
ChooseColor(lpcc);
Anyway, the callback function is also for MFC?
 
Share this answer
 
Comments
Richard MacCutchan 7-Sep-10 10:21am    
Well I guess there is something of a gap in your understanding of pointers. Creating a pointer and pointing it to some empty piece of memory as you have shown above will merely get you an access violation. I suggest you go back to the documentation and follow the notes on how to initialize the structure before calling the ChooseColor function. As to whether this is the same in MFC, I am not sure, you need to check the documentation for a comparable MFC class.
symreds 7-Sep-10 10:26am    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900