Thread: hiding the cursor

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    16

    hiding the cursor

    How do you hide the cursor in C using dos

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    19
    One method is to make a few inline ASM calls. You'll just have to port these to the appropriate compiler:

    Deactivate cursor:
    mov cx,1900h
    xor bh,bh
    mov ah,1
    int 10h

    Activate cursor:
    mov cx,607h
    xor bh,bh
    mov ah,1
    int 10h

    There are probably other methods, but this is the one that i'm familiar with. the common directive is _asm ... . just consult the FAQ section.

    Peter Kimberley
    [email protected]

  3. #3
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    Location
    Budapest
    Posts
    463
    Through direct VGA-port programming (not using BIOS)
    ---------------
    // hiding cursor
    push ax
    push dx
    mov dx,03d4h ;/*CRTC*/
    mov al,0ah ;/*cursor-start VGA reg*/
    out dx,al
    inc dx
    in al,dx
    or al,0010000b ;/*cursor off*/
    out dx,al
    pop dx
    pop ax
    --------------
    // show it again
    push ax
    push dx
    mov dx,003d4h ;/*CRTC*/
    mov al,0ah ;/*cursor-start VGA reg*/
    out dx,al
    inc dx
    in al,dx
    and al,11011111b ;/*cursor on*/
    out dx,al
    pop dx
    pop ax

    Assembly rules!!!!
    Have fun & enjoy!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Custom Animated Cursor
    By willc0de4food in forum Windows Programming
    Replies: 3
    Last Post: 05-13-2005, 10:05 PM
  2. Hiding the Console Cursor
    By XSquared in forum C Programming
    Replies: 1
    Last Post: 08-29-2003, 12:52 AM
  3. Context Menu cursor problem
    By dWorkVan in forum Windows Programming
    Replies: 4
    Last Post: 07-14-2003, 11:42 AM
  4. cursor remains in openGL fullscreen
    By Ken Fitlike in forum Game Programming
    Replies: 5
    Last Post: 03-14-2002, 08:52 PM
  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