开发者

How to show and move mouse cursor in Powerpoint VBA?

开发者 https://www.devze.com 2023-01-02 03:21 出处:网络
I searched extensively on this and incredibly there seems to be no answer. Does anyone know how to do开发者_如何学编程 this?The show cursor part is part of PowerPoint - the move part needs to come fro

I searched extensively on this and incredibly there seems to be no answer. Does anyone know how to do开发者_如何学编程 this?


The show cursor part is part of PowerPoint - the move part needs to come from an API call. Here you go:

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
0

精彩评论

暂无评论...
验证码 换一张
取 消