Thread: Screen coordinates and mouse pointer manipulation

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    367

    Screen coordinates and mouse pointer manipulation

    Each point on the screen can be assigned to a certain coordinate. If my screen has the resolution 800x600, then the point in the middle would have the coordinate (400, 300). Does that mean that there can be no further colour variation within the (400, 300) coordinate? Then our desktop and running programs would be made up of 480000 different colour fields (800*600 = 480000) when screen resolution is set to 800x600. My tests seem to point to this being true, since changing my resolution from 800x600 to 1024x768 seems to give more space for windows etc. But I am not sure about this, so my first question is: can that (400, 300) coordinate only have one colour?

    My second question. Since the screen can be disassembled into coordinates, is it possible to write a program that, for example, finds the coordinate (365, 531) and then makes the mouse pointer move there automatically to click on that coordinate? I think I recognise related areas in programming. If this is possible, then what area of programming should I read up on to learn more about this?

    Don't ask me why I'm asking . Hope I have been clear enough . I would really appreciate your help


    Thanks - Zewu
    Last edited by Zewu; 03-25-2005 at 05:26 PM.

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Yes each pixel can have one color. In 256 color mode it is one byte in 16 bit color mode it is 2 bytes and in 32 bit color mode it is 4 bytes.
    As for your second question use
    Code:
    SetCursorPos(x, y);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get relative mouse coordinates when GLUT return absolute
    By joeprogrammer in forum Game Programming
    Replies: 14
    Last Post: 02-10-2009, 06:35 PM
  2. Replies: 2
    Last Post: 02-18-2008, 04:53 AM
  3. Retrieving mouse coordinates behind a window.
    By Kurisu33 in forum Windows Programming
    Replies: 3
    Last Post: 10-04-2006, 02:11 PM
  4. Mouse Coordinates are Off
    By Morgul in forum Game Programming
    Replies: 5
    Last Post: 08-20-2006, 11:25 AM
  5. Mouse in 800x600 24Bit Mode?
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 11-11-2001, 01:38 AM