Thread: Program to control Cursor movement in C

  1. #1
    Registered User
    Join Date
    Nov 2002

    Question Program to control Cursor movement in C

    I'm thinking of writing a game program... HUm... but the very problem I came across is how to control the movement of the cursor... pathetic... I also would like to change the cursor type from _, \, |, /, _ in a contineous motion so that it looks like it is spinng... just to make it little fancy and more interesting...
    To control the cursor movement, i would like to use the arrow keys as normal...
    Any help would be highly appreicaed!


  2. #2
    Registered User
    Join Date
    May 2011
    Around 8.3 light-minutes from the Sun
    What OS are you programming for?

    GotoXY windows console tutorial

    Using Arrow Keys Tutorial

    As for the cursor, I don't believe you can change it's shape but you can turn it off and then write want you want to the screen and that would have the same effect. For windows this is done:

    #include <windows.h>
    int main()
        HANDLE hOut;
        hOut = GetStdHandle(STD_OUTPUT_HANDLE);
        SetConsoleTitle("No Cursor");
        ConCurInf.dwSize = 10;
        ConCurInf.bVisible = FALSE;
        return 0;
    EDIT: My bad I didn't read the OP start date.
    Last edited by AndrewHunter; 06-25-2011 at 10:42 AM.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Well I'll keep your reply AndrewHunter, but the horrible 16-bit hackery is gone.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. (Multiline) Edit Control Limit
    By P4R4N01D in forum Windows Programming
    Replies: 9
    Last Post: 05-17-2008, 11:56 AM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 07:55 AM
  4. Edit Control problem
    By Malek in forum Windows Programming
    Replies: 3
    Last Post: 06-16-2002, 01:12 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM