News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Hide cursor

Started by Neil, June 16, 2008, 10:16:25 AM

Previous topic - Next topic

Neil

I am using getkey in a console program & don't want a cursor flashing on screen. In my DOS days you just moved it out of sight onto another page. How do you do it in Win32?

hutch--

Neil,


invoke ShowCursor,TRUE  ; show the cursor

invoke ShowCursor,FALSE ; hide cursor


Make sure you do this correctly both ways or you can lose the cursor.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Neil

Thanks Hutch, just what I wanted  :U

Tedd

It's probably not what you wanted :P
ShowCursor shows/hides the mouse pointer, not the console cursor.

Try SetConsoleCursorPosition -- http://msdn.microsoft.com/en-us/library/ms686025.aspx
No snowflake in an avalanche feels responsible.

Neil

Tedd you're right, I still haven't found a way of doing it :(

I'll have a look at that link you posted, thanks

Neil

I've checked the link out Tedd & that's the APi the loc macro calls. I'm wondering now if it's just as simple as hiding the cursor off the bottom of the display, I'll give it a try.

Neil

No, that's not it, the display just scrolls down to where the cursor is HMMM!

Tedd

Have you tried a negative position? (Try x first, then y if that doesn't work.)

Failing that, how about moving it to the bottom-right corner, and setting it to black text on black background?
No snowflake in an avalanche feels responsible.

Neil

Just had a half hour power cut here.
I tried both of those methods Tedd & neither worked.
I've had another idea, there is a way of setting the size (vertically) of the cursor, I wonder if it's possible to reduce it to zero, I'll read up on it.

Jimg

try this:.data?
cci CONSOLE_CURSOR_INFO <>
chand dd ?
.code
invoke GetStdHandle,STD_OUTPUT_HANDLE
mov chand,eax
invoke GetConsoleCursorInfo,chand,addr cci
inkey "Press any key to hide cursor"
mov cci.bVisible,FALSE
invoke SetConsoleCursorInfo,chand,addr cci
inkey "Press any key to restore cursor"
mov cci.bVisible,TRUE
invoke SetConsoleCursorInfo,chand,addr cci
inkey "Press any key to exit..."
ret

Neil

Just had another power cut!

Thanks Jimg, that code works perfectly :U

All I have to do now is adapt it into my code