Re: Hide Cursor in Console Window
- Posted by jacques_desch Jul 08, 2009
- 1235 views
use win32 API call SetConsoleCursorInfo()
ref: http://msdn.microsoft.com/en-us/library/ms686019(VS.85).aspx
--code sample euphoria 3.1 include dll.e constant kernel32=open_dll("kernel32.dll") constant iGetStdHandle=define_c_func(kernel32,"GetStdHandle",{C_INT},C_INT) constant STD_INPUT_HANDLE=-10,STD_OUTPUT_HANDLE=-11,STD_ERROR_HANDLE=-12 global function GetStdHandle(integer std_handle_number) return c_func(iGetStdHandle,{std_handle_number}) end function constant iSetConsoleCursorInfo=define_c_func(kernel32,"SetConsoleCursorInfo",{C_POINTER,C_POINTER},C_UINT) constant iGetConsoleCursorInfo=define_c_func(kernel32,"GetConsoleCursorInfo",{C_POINTER,C_POINTER},C_UINT) --ShowConsoleCursor --show or hide console cursor --hScreen is handle of console output buffer returned by GetStdHandle(STD_OUTPUT_HANDLE) --visible is boolean if TRUE show cursor if FALSE hide it. global procedure ShowConsoleCursor(atom hScreen,integer visible) atom fnVal, pCursorInfo pCursorInfo=allocate(8) fnVal=c_func(iGetConsoleCursorInfo,{hScreen,pCursorInfo}) poke4(pCursorInfo+4,visible) fnVal=c_func(iSetConsoleCursorInfo,{hScreen,pCursorInfo}) free(pCursorInfo) end procedure
not tested, I'm writing this on a linux box, but should work
jacques
euphoric said...
How can I hide the cursor in a Windows console window (using euiw)?
I tried using cursor(NO_CURSOR) but that doesn't work, and I can't find the docs for cursor() in the online Manual. It didn't cause a crash so it seems to be a built-in without docs.