Сделать указатель мыши невидимым на холостом ходу

4596
Joseph

Есть ли способ заставить указатель мыши исчезнуть, когда компьютер бездействует? Если бы решение могло работать как в Windows XP, так и в Windows 7, это было бы замечательно.

6

4 ответа на вопрос

5
Joseph

Основываясь на том, что я нашел здесь, я смог сделать следующий код AutoHotkey :

SystemCursor("Init")  SetTimer, CheckIdle, 250 return  CheckIdle: TimeIdle := A_TimeIdlePhysical // 1000 if TimeIdle >= 3 { SystemCursor("Off") } else { SystemCursor("On") } return  #Persistent OnExit, ShowCursor ; Ensure the cursor is made visible when the script exits. return  ShowCursor: SystemCursor("On") ExitApp  SystemCursor(OnOff=1) ; INIT = "I","Init"; OFF = 0,"Off"; TOGGLE = -1,"T","Toggle"; ON = others { static AndMask, XorMask, $, h_cursor ,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 ; system cursors, b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13 ; blank cursors, h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13 ; handles of default cursors if (OnOff = "Init" or OnOff = "I" or $ = "") ; init when requested or at first call { $ = h ; active default cursors VarSetCapacity( h_cursor,4444, 1 ) VarSetCapacity( AndMask, 32*4, 0xFF ) VarSetCapacity( XorMask, 32*4, 0 ) system_cursors = 32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650 StringSplit c, system_cursors, `, Loop %c0% { h_cursor := DllCall( "LoadCursor", "uint",0, "uint",c%A_Index% ) h%A_Index% := DllCall( "CopyImage", "uint",h_cursor, "uint",2, "int",0, "int",0, "uint",0 ) b%A_Index% := DllCall("CreateCursor","uint",0, "int",0, "int",0, "int",32, "int",32, "uint",&AndMask, "uint",&XorMask ) } } if (OnOff = 0 or OnOff = "Off" or $ = "h" and (OnOff < 0 or OnOff = "Toggle" or OnOff = "T")) $ = b ; use blank cursors else $ = h ; use the saved cursors  Loop %c0% { h_cursor := DllCall( "CopyImage", "uint",%$%%A_Index%, "uint",2, "int",0, "int",0, "uint",0 ) DllCall( "SetSystemCursor", "uint",h_cursor, "uint",c%A_Index% ) } } 
1
ricbax

Попробуйте это: Курсор Hider

Это то, что я ищу, но $ 20 кажется немного дороже. Joseph 14 лет назад 1
1
sYnfo

Если вы не возражаете, что небольшое кодирование, вероятно, будет необходимо, вы можете использовать AutoHotkey . Смотрите этот пост на форуме для получения дополнительной информации о том, чего вы хотите достичь.

Пост, на который вы ссылаетесь, только делает мышь невидимой в созданном приложении AutoHotkey. Вы поставили меня на правильный путь, поэтому я дам вам голос. Благодарю. Joseph 14 лет назад 0
1
micnolmad

8 лет спустя, и ответ Иосифа все еще хорош и работает в AHK! НО я сделал это еще лучше .. по моему мнению причины.

Я добавил проверку мыши, чтобы курсор снова отображался только при его перемещении. Правда, я мог бы добавить другие события мыши, такие как щелчки, но так как курсор скрыт, я думаю, что это слишком крайний случай, чтобы беспокоиться. Вы можете добавить его самостоятельно, если хотите :)

Что я изменил, так это переместился #Persistentнаверх, поскольку он является глобальным и представлен для всего сценария, независимо от того, что он есть.

Добавлено CoordMode, Mouse, Screenи MouseGetPos, ix, iyв раздел autoexec и MouseGetPos, ix, iyснова при переходе в режим ожидания. MouseGetPos, cx, cyустанавливается для каждого CheckIdleи переменные сравниваются при движении мыши с if (cx != ix or cy != iy).

#Persistent  CoordMode, Mouse, Screen MouseGetPos, ix, iy  SystemCursor("Init")  SetTimer, CheckIdle, 250 return  CheckIdle: MouseGetPos, cx, cy TimeIdle := A_TimeIdlePhysical // 1000 if (TimeIdle >= 3) { MouseGetPos, ix, iy SystemCursor("Off") } else if (cx != ix or cy != iy) { SystemCursor("On") } return  OnExit, ShowCursor ; Ensure the cursor is made visible when the script exits. return  ShowCursor: SystemCursor("On") ExitApp  SystemCursor(OnOff=1) ; INIT = "I","Init"; OFF = 0,"Off"; TOGGLE = -1,"T","Toggle"; ON = others { static AndMask, XorMask, $, h_cursor ,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 ; system cursors, b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13 ; blank cursors, h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13 ; handles of default cursors if (OnOff = "Init" or OnOff = "I" or $ = "") ; init when requested or at first call { $ = h ; active default cursors VarSetCapacity( h_cursor,4444, 1 ) VarSetCapacity( AndMask, 32*4, 0xFF ) VarSetCapacity( XorMask, 32*4, 0 ) system_cursors = 32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650 StringSplit c, system_cursors, `, Loop %c0% { h_cursor := DllCall( "LoadCursor", "uint",0, "uint",c%A_Index% ) h%A_Index% := DllCall( "CopyImage", "uint",h_cursor, "uint",2, "int",0, "int",0, "uint",0 ) b%A_Index% := DllCall("CreateCursor","uint",0, "int",0, "int",0, "int",32, "int",32, "uint",&AndMask, "uint",&XorMask ) } } if (OnOff = 0 or OnOff = "Off" or $ = "h" and (OnOff < 0 or OnOff = "Toggle" or OnOff = "T")) $ = b ; use blank cursors else $ = h ; use the saved cursors  Loop %c0% { h_cursor := DllCall( "CopyImage", "uint",%$%%A_Index%, "uint",2, "int",0, "int",0, "uint",0 ) DllCall( "SetSystemCursor", "uint",h_cursor, "uint",c%A_Index% ) } }