-1

I want to change the cursor image in c++ in a console application. Is that possible?

And is it possible to load the cursor image from a website, for example: this

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Disembleergon
  • 187
  • 4
  • 5
  • Interesting question. C++ doesn't know what a cursor is, so you'll have to use a third party, and possibly console-specific, library. – user4581301 Nov 15 '20 at 17:57
  • if you by chance are referring to the mouse pointer, it may be possible - using some trickery https://stackoverflow.com/questions/56391615/use-wait-cursor-as-mouse-pointer-in-console-application – Sven Nilsson Nov 15 '20 at 18:10
  • 2
    [SetConsoleCursorInfo](https://learn.microsoft.com/en-us/windows/console/setconsolecursorinfo) is the only API function that allows you to modify the cursor. It takes in a [CONSOLE_CURSOR_INFO](https://learn.microsoft.com/en-us/windows/console/console-cursor-info-str) structure, that allows you to modify the height and visibility only. – IInspectable Nov 15 '20 at 18:14
  • 1
    No, you cannot change the cursor for a single console application. The cursor in Windows is a *system-wide* property, so you'd need to change it for the entire system. – Cody Gray - on strike Nov 22 '20 at 06:52

1 Answers1

0

The cursor was traditionally provided by the graphics adaptor. Function 01h of int 10h on an x86 processor would do the talking to the graphics adaptor through the bios. I dont know what brand of c you use but most have a bios.h header if it wont support the asm directive. You can set registers and do int calls using that header and the appropriate library.

https://en.wikipedia.org/wiki/INT_10H will describe the register values. This is specific to to intel x86/v86 and will not compile cross platform but I guess you wouldnt use a console on arm and you cant afford a sparc like.

Despite the above has been deleted by a moderator, it will still work on a console, albeit, I'm not sure about powershell.

The winapi provides a more limited SetConsoleCursorInfo function if you can get the handle of the console windows cout. I'd still try the old method first.

Stephen Duffy
  • 467
  • 2
  • 14