GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 17-Aug-2007, 21:50
Fromethius Fromethius is offline
New Member
 
Join Date: Aug 2007
Posts: 3
Fromethius is on a distinguished road

Microsoft Paint Simulated Mouse Click


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:

rafb.net

Thanks for any help.
  #2  
Old 23-Aug-2007, 19:03
davis
 
Posts: n/a

Re: Microsoft Paint Simulated Mouse Click


Without being able to review the code, it isn't much use. However, you will want to FindWindow, GetWindowLong and hook the WinProc of MSPaint. Trap your keydown events and on the keys that you want to trap, use SendMessage to the window with your WM_COMMAND or whatever message is required to faciliate the change you desire.

Be sure to pass untrapped keys back to MSPaint's WinProc so that it handles them properly.


:davis:
 
 

Recent GIDBlogMeeting the local Iraqis by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to detect mouse click in child window created by CHTMLEDITVIEW terr MS Visual C++ / MFC Forum 0 08-Sep-2006 13:12
Mouse Click puffamuffa C++ Forum 2 02-Apr-2006 17:09
D3D error when running fullscreen games/programs - help?! daa709 Computer Hardware Forum 4 01-Jul-2005 08:03
Detecting a mouse click outside of control arran.s MS Visual C++ / MFC Forum 1 27-Oct-2004 06:01
Microsoft users warned of serious flaw jrobbio Computer Software Forum - Windows 3 25-Mar-2003 08:52

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 03:25.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.