我希望這是可行的...我使用AutoIt駐留在系統托盤中的程序。其中一個托盤項目運行一個功能,等待用戶點擊一個窗口來獲得窗口標題(它可以是任何窗口,不一定是由AutoIt製成的),這部分工作完美無缺。在嘗試使用GUISetCursor(3)時,我嘗試使用GUISetCursor(3),但是從我的理解中,這隻改變了AutoIt GUI窗口的光標。爲用戶環境更改鼠標光標,而不僅僅是用於AutoIt窗口?用AutoIt在環境中更改鼠標光標
0
A
回答
0
對Richard的評論,以及在AutoIt論壇上的回覆,它將我與AutoIt的_WinAPI_SetSystemCursor函數聯繫起來,我能夠得到這個工作。
我複製了我想從%SystemRoot%\ Cursors(特別是,我複製了cross_i.cur)的十字光標放到腳本的源目錄中。
然後,在執行程序的強力功能,我添加了以下幾行:
Func FuncName()
;backs up the user's arrow cursor
Local $hPrev = _WinAPI_CopyCursor(_WinAPI_LoadCursor(0, 32512))
;backs up the user's ibeam cursor
Local $iPrev = _WinAPI_CopyCursor(_WinAPI_LoadCursor(0, 32513))
;changes the user's arrow cursor
_WinAPI_SetSystemCursor(_WinAPI_LoadCursorFromFile(@ScriptDir & "\cross.cur"),32512)
;changes the user's ibeam cursor
_WinAPI_SetSystemCursor(_WinAPI_LoadCursorFromFile(@ScriptDir & "\cross.cur"),32513)
; Do the code you want to execute
;restores the user's default cursor
_WinAPI_SetSystemCursor($hPrev,32512)
;restores the user's ibeam cursor
_WinAPI_SetSystemCursor($iPrev,32513)
EndFunc
這讓我完成我需要的東西。
0
您可以這樣做:
#include <Misc.au3>
#include <WindowsConstants.au3>
GetTitleByClick()
Func GetTitleByClick()
Local $hCursor = GUICreate('', 48, 48, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
WinSetTrans($hCursor, '', 10)
GUISetCursor(3, 1, $hCursor)
GUISetState(@SW_SHOW, $hCursor)
; get title bar position
Local $pos
Do
$pos = MouseGetPos()
WinMove($hCursor, '', $pos[0]-24, $pos[1]-24)
Sleep(10)
Until _IsPressed('01')
GUIDelete($hCursor)
; block mouse
_MouseTrap($pos[0], $pos[1], $pos[0]+1, $pos[0]+1)
; click position - activates the window
MouseClick('left', $pos[0], $pos[1])
; unblock mouse
_MouseTrap()
; get the title of the active window
Local $sTitle = WinGetTitle('[ACTIVE]')
Return MsgBox(0, 'TITLE', $sTitle)
EndFunc
+0
我很欣賞這個輸入,但是我不認爲我最初是清楚自己想要什麼......我有算法來收集用戶在窗口上的點擊;我沒有改變光標。我通過幾個來源找到了我的答案。我已經修改了我的問題,我希望更清楚 – jparnell8839
相關問題
- 1. 在Silverlight中更改鼠標光標
- 2. 在處理中更改鼠標光標
- 3. 在Share Point中更改鼠標光標
- 4. 光標在鼠標點擊更改
- 5. 如何更改鼠標光標圖標?
- 6. C#Winforms - 更改鼠標光標圖標
- 7. 如何在鼠標左鍵關閉時更改鼠標光標?
- 8. 將鼠標光標更改爲箭頭
- 9. 更改iframe上的鼠標光標
- 10. Qt:拖動時更改鼠標光標
- 11. 鼠標拖動時更改光標
- 12. C#更改全局鼠標光標
- 13. 無法更改NSTextField的鼠標光標
- 14. 更改MacOS X鼠標光標圖片
- 15. asp:gridview在鼠標懸停時在標頭中更改光標
- 16. 在Visual Studio 2010(GUI)中更改鼠標光標圖標(.ico)
- 17. 在應用程序中更改鼠標光標圖像?
- 18. 如何更改tornado中的鼠標光標圖標Fx
- 19. 在Javascript或jQuery中更改鼠標光標
- 20. 在gWidgetsRGtk2中更改小部件的鼠標光標
- 21. 在.NET中更改全局鼠標光標
- 22. 如何在OpenGL/Glut中更改鼠標光標的位置?
- 23. 如何在java中更改鼠標光標?
- 24. 更改鼠標光標上表中,而不是在第
- 25. 如何在PythonCard中更改鼠標光標
- 26. 如何在拖放過程中更改鼠標光標?
- 27. 如何在Objective-C中更改鼠標光標
- 28. 如何在Xcode中更改鼠標的工字形光標?
- 29. 在WPF中更改鼠標拖動光標
- 30. 在NSTextView中更改光標
您可以修改此文章https://blogs.technet.microsoft.com/heyscriptingguy/2013/01/17/use-powershell-to-change-the-mouse-pointer-scheme/到AutoIt,但我認爲這將是實踐,因爲當程序退出時,更改不會自動恢復 – Richard
感謝您在正確方向上的一個點,以及AutoIt論壇中的用戶。 – jparnell8839