Как добавить визуальный эффект к щелчку мыши из окна?

30604
Jon Erickson

Я просто хочу маленькую утилиту, которая отслеживает щелчки мышью, чтобы при возникновении визуального эффекта пузыря (или чего-то подобного) происходило, подобно тому, что вы можете увидеть в скринкасте.

19

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

19
RJFalconer

Этот вариант Windows;

изображение круга мыши

Вместе со скриптом AutoHotkey, похожим на;

~LButton:: Send  return  ~LButton UP:: Send  return 

(Каждый щелчок мыши (вниз и вверх) кратковременно вызывает Ctrl)

Как отметил Паоло, вы даже можете изменить настройки мыши как часть скрипта:

DllCall("SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 1, UInt, 0) ;SPI_SETMOUSESONAR ON  OnExit, ExitSub ExitSub: DllCall("SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 0, UInt, 0) ;SPI_SETMOUSESONAR OFF ExitApp 
Я исправил предложение здесь (и спасибо, что поместили меня на AutoHotKey). Мне потребовались часы, чтобы выяснить это. Я добавил один символ (тильда `~`), который позволял проходить нормальной работе мыши. Я также изменил пример так, чтобы эффект генерировался не только щелчком мыши, но и первоначальным щелчком мыши. 12 лет назад 1
Хорошая находка! Спасибо за редактирование. RJFalconer 12 лет назад 0
Возможно автоматическое изменение настроек мыши. Смотрите эту ссылку: http://www.autohotkey.com/board/topic/77380-mouse-click-special-effects-for-presentationsdemos/ Paolo Fulgoni 9 лет назад 1
1
traycerb

Это вариант ответа RJFalconer, включающий изменения от Паоло Фулгони. Я не хотел всегда видеть мою мышь, когда была нажата кнопка CTRL, и я надеялся, что DllInfoмодификация будет динамически включать и выключать настройку, но я не мог заставить ее работать (скрипт просто завершился). Без сомнения, кто-то более искушенный в AHK мог объяснить, что я делаю не так, но я пошел дальше и создал свою собственную версию.

Он динамически включает опцию «Показывать мышь, когда нажат элемент управления» при нажатии кнопки мыши, а затем выключает ее. Он отлично работает в ограниченном тестировании, хотя иногда указатель мыши исчезает после. Если кто-то знает, как это исправить, или имеет какие-либо другие улучшения, смело прыгайте.

Это (чрезмерно) задокументировано, потому что я быстро забываю вещи, и когда мне нужно вернуться, я хочу, чтобы мои скрипты предоставляли достаточно информации, которую мне не нужно искать, чтобы найти все старые ссылки, которые я использовал в первую очередь.

;Visualize mouse clicks by showing radiating concentric circles on mouse click ;Author: traycerb ;Date/Version: 01-31-2018 ; ;Source: ;https://superuser.com/questions/106815/how-do-you-add-a-visual-effect-to-a-mouse-click-from-within-windows ;https://autohotkey.com/board/topic/77380-mouse-click-special-effects-for-presentationsdemos/  ;Dynamically switch on the Windows accessibility feature to show the mouse when the control key is pressed ;when the script is executed, then switch off afterwards ;Windows settings > Mouse > Pointer Options tab > Visibility group > Show location of pointer when I press CTRL key    ;Window's SystemParametersInfo function, retrieves or sets the value of one of the  ;system-wide parameters. AHK DllCall fxn with SystemParameterInfo parameter is used to access ;this Windows API. ;https://msdn.microsoft.com/en-us/library/windows/desktop/ms724947(v=vs.85).aspx ;BOOL WINAPI SystemParametersInfo( ; _In_ UINT uiAction, ; _In_ UINT uiParam, ; _Inout_ PVOID pvParam, ; _In_ UINT fWinIni ;);  ;uiParam [in] ;Type: UINT ; ;A parameter whose usage and format depends on the system parameter being queried or set.  ;For more information about system-wide parameters, see the uiAction parameter.  ;If not otherwise indicated, you must specify zero for this parameter.  ;pvParam [in, out] ;Type: PVOID ; ;A parameter whose usage and format depends on the system parameter being queried or set.  ;For more information about system-wide parameters, see the uiAction parameter.  ;If not otherwise indicated, you must specify NULL for this parameter.  ;For information on the PVOID datatype, see Windows Data Types.  ;fWinIni [in] ;Type: UINT ; ;If a system parameter is being set, specifies whether the user profile is to be updated,  ;and if so, whether the WM_SETTINGCHANGE message is to be broadcast to all top-level  ;windows to notify them of the change.  ;This parameter can be zero if you do not want to update the user profile  ;or broadcast the WM_SETTINGCHANGE message or it can be set to the following [...]  ;Accessibility parameter  ;S0x101D PI_SETMOUSESONAR ;Turns the Sonar accessibility feature on or off. This feature briefly  ;shows several concentric circles around the mouse pointer when the user  ;presses and releases the CTRL key.  ;The pvParam parameter specifies TRUE for on and FALSE for off.   ;Press the control button each time mouse button is pressed, showing location of mouse pointer. ~LButton:: { DllCall("user32\SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 1, UInt, 0)  Send  DllCall("user32\SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 0, UInt, 0)  return }  ~RButton:: { DllCall("user32\SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 1, UInt, 0)  Send  DllCall("user32\SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 0, UInt, 0)  return } 
Это было полезно, спасибо. Я также добавил строку #SingleInstance force, чтобы избежать раздражающего всплывающего сообщения при двойном щелчке. Phil B 5 лет назад 0