Question Hijack/replace windows color picker?

Monkeybrother

New member
Joined
Nov 20, 2015
Messages
3
Programming Experience
Beginner
Hi. I know my way around Python, JS and PHP and now I'm learning C#. My first project is a color picker/manager/library and things are going great, but there's one thing I can't google my way through: I want to replace the windows color picker with my own. That is, when a user wants to choose a color in Paint, photoshop or whatever and clicks to open the default windows color picker I want to catch it, close/hide it, and open my own. When I've chosen a color, I want to send it back to whatever program asked for the color. I know it can be done and I've found references to CCHookProc and ChooseColor, but I really don't know where to start.

I'm usually good at figuring stuff out, so I'm not asking for a complete solution, only to be pointed in the right direction. All help appreciated.

Thanks.
 
Hi. I know my way around Python, JS and PHP and now I'm learning C#. My first project is a color picker/manager/library and things are going great, but there's one thing I can't google my way through: I want to replace the windows color picker with my own. That is, when a user wants to choose a color in Paint, photoshop or whatever and clicks to open the default windows color picker I want to catch it, close/hide it, and open my own. When I've chosen a color, I want to send it back to whatever program asked for the color. I know it can be done and I've found references to CCHookProc and ChooseColor, but I really don't know where to start.

I'm usually good at figuring stuff out, so I'm not asking for a complete solution, only to be pointed in the right direction. All help appreciated.

Thanks.
One of the issues I see with this is that you're wanting to substitute something in Windows that works fine without the .Net framework installed for any program that would want to use it with something that will require the .Net Framework version your dll will be targeted for. If this is something that you'll only be using yourself then it's a very minimal thing, but if it's going to be distributed you could be opening up a bunch of support issues down the road.
The other thing is that most paint programs (all the big ones) don't even use the one that's built into Windows, they all have their own made tailored to that application. I'm pretty sure MS Paint does use windows but other programs like Paint.Net, PhotoShop, Visual Studio, etc all have their own control so even if you made your own and got Windows to provide that to applications through the Windows API I don't see how you're going to override the dialog in the programs that don't even use the API.
But what you can do is make your own dialog for this and provide it in a dll for you to use in your own programs and even distribute it as an option for other developers to use in theirs, rather than tampering with overriding something in the Windows API (of which MS is fond of changing how things like this works in their API across different versions of Windows).
 
Thanks for answering. My approach so far has been to let the program lurk in the background/tray and I would like for it to listen to calls for the windows color picker. Right now I have a third party color picker that works like that (that I bought a few years back: Jovian color picker), but it's been discontinued and I want something more future proof. It's because of Jovian that I know it can be done, but I have no idea if he used C# to do it. Someone told me in another forum that he doubted that this could be done in C#, but I'm hoping that's wrong since I'm not learning C++ to do this...
You are right about a lot of graphics software using custom color pickers, but most of them also have an option to use the standard windows color picker, opening up for this kind of thing. I'm not a "real" programmer, I'm usually a graphics/3d guy, and that's the crowd I'd be targeting.

So, any tips or snippets would be very welcome.
 
After looking up Jovian Color Picker and watching a demo on youtube of it, it looks like it's a program that hooks into the other applications (I see they have a short list of supported programs that it interfaces with) and you'll need to build in support for each individually (keep in mind it may be different between versions of the programs too). I've never done anything like that before, but this might be a good start: c# - How to hook an application? - Stack Overflow
 
The latest/last version of Jovian hooks into the standard windows color picker and works in every program that uses it (as well as a few custom pickers), but I hope that if I figure out how to do that I can figure out how to hook into custom pickers as well.

Yes, SetWinEventHook sounds like what I need. I think I'm on the right track, thanks for you help!
 
Last edited:
Back
Top Bottom