Hello everyone

I'm trying to write a program in native c++ code that will do this:

When drawing in MS Paint and I press the P key on the keyboard, the Pencil tool will become the current tool.

I really want to stay away from installing drivers, injecting dlls, reverse engineering, and many other complex things to do such an easy task.

Normally, this would be easy but the Pencil tool in MS Paint is not a window. All those tools are inside a toolbox, and the toolbox is a window.

I could get the coords of the toolbox and then simulate a mouse event on the coords + the offset of the pencil tool but you can get rid of the toolbox and then it has no coords and thus, the program fails.

Really, I'm looking for a way to run the code that is run when you click the pencil tool in MS Paint. I want the Pencil tool to become the current tool when I press P on my keyboard.

Also, I plan on distributing this application so I can't apply changes on my computer to get this to work.

Here is my code so far. The comment is where I need to insert the code that changes the current tool to the pencil tool:

http://rafb.net/p/Nfb2lT78.html

Thanks for any help.

Recommended Answers

All 3 Replies

Member Avatar for iamthwee

>I really want to stay away from installing drivers, injecting dlls, reverse engineering, and many other complex things to do such an easy task.


I think this is unavoidable. You need to find out how to access the api calls for paint. If such things exist. How, I don't know.

I thought there might be an option to add a paint com library with vb express 2005, but I couldn't see it. Hmm.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.