Thread: Reading pixels from + sending mouse clicks to another application window - how??

  1. #1
    Unregistered
    Guest

    Reading pixels from + sending mouse clicks to another application window - how??

    Hello C programming gurus!!

    I want to write a small C programme that in theory sounds simple enough, and hopefully you can let me know if its viable. I did some C programming a few years ago, so I'm not a complete newbie, but lets just say I'm a little rusty

    What the program will do:

    From a seperate windows application (not created by me), it will read pixels at specific x,y points and then mimic mouse clicks at certain x,y points.


    What I've found out so far:

    I'll need to use getpixel to read the pixels!
    I've found some info on mouse clicks.

    Setforegroundwindow or setfocus won'w work as these only work on programs under the threads control - how can I get around this??


    If I intend to have this program work on a windows application will it be hard to program if I've not done it before??

    Will the mouse click and get pixel be easy enough?

    These are kind of vague questions, but I'm still doing some research.

    I would loved to have posted a thread entitled 'Write me a C program that does...' - but I though that'd be a bit cheeky

    Any help you can offer would be great, as would any links you may have for achieving my goal.

  2. #2
    Registered User Esss's Avatar
    Join Date
    Aug 2001
    Posts
    133
    You can simulate the action of the mouse using the mouse_event function.

    You can read pixels from the screen by first getting a DC to the screen (GetDC(NULL)), then using GetPixel. Don't forget to release the DC when you're done with it.
    Ess
    Like a rat in a maze who says,
    "Watch me choose my own direction"
    Are you under the illusion
    The path is winding your way?
    - Rush

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Generating Window Procedure mouse WPARAM from Hooks
    By seaders in forum Windows Programming
    Replies: 0
    Last Post: 03-24-2009, 09:43 AM
  2. C or C++
    By AcerN30 in forum Game Programming
    Replies: 41
    Last Post: 05-30-2008, 06:57 PM
  3. Magnifier window that follows mouse - how?
    By midix in forum Windows Programming
    Replies: 9
    Last Post: 10-05-2007, 07:43 AM
  4. Window scrollbar
    By maxorator in forum Windows Programming
    Replies: 2
    Last Post: 10-07-2005, 12:31 PM
  5. my wndProc is out of scope
    By Raison in forum Windows Programming
    Replies: 35
    Last Post: 06-25-2004, 07:23 AM