3
我在這方面進行了廣泛搜索,難以置信的似乎沒有答案。有誰知道如何做到這一點?如何在Powerpoint VBA中顯示和移動鼠標光標?
我在這方面進行了廣泛搜索,難以置信的似乎沒有答案。有誰知道如何做到這一點?如何在Powerpoint VBA中顯示和移動鼠標光標?
顯示光標部分是PowerPoint的一部分 - 移動部分需要來自API調用。你在這裏:
Public Declare Function SetCursorPos Lib "user32.dll" (ByVal X As Long, ByVal Y As Long) As Long
//'USE THIS IF x64: Public Declare PtrSafe Function SetCursorPos Lib "user32.dll" (ByVal X As Long, ByVal Y As Long) As LongPtr
Public Type POINTAPI
X As Long
Y As Long
End Type
Sub ShowCursorAndMove()
Dim currView As SlideShowView
Set currView = ActivePresentation.SlideShowSettings.Run.View
currView.PointerType = ppSlideShowPointerArrow
MoveMouse 400, 300
End Sub
Sub MoveMouse(X As Single, Y As Single)
Dim pt As POINTAPI
pt.X = X
pt.Y = Y
SetCursorPos pt.X, pt.Y
End Sub