Results 1 to 3 of 3

Thread: create a moue recorder in powerpoint

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    3

    create a moue recorder in powerpoint

    Hi,

    I want to create a mouserecorder in powerpoint. But the problem is i dont have a clue how to begin ... what is the best way to create a routine/program that writes the mouscoordinates and the time of clicking in a presentation to a file ...

  2. #2
    Junior Member
    Join Date
    Aug 2000
    Location
    CA,USA
    Posts
    17
    I don't think you Powerpoint has event handling for its presentations, but you could do the task in the code snippet below. You'll have to assign an on-show macro to initiate the do loop in the code below and assign some condition to stop it. The code below uses the API to track mouse x and y positions in screen pixels after looking for a left mouse button down and up sequence. I wasn't sure how you wanted to data log, so I set up the output to the immediate window.

    Public Const VK_LBUTTON = &H1

    Public Type POINTAPI
    X As Long
    Y As Long
    End Type

    Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long '
    Public Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer

    Option Explicit

    Sub TrackMouse()

    Dim pCur As POINTAPI

    ' Begin tracking mouse
    Do

    ' Look for mouse down event
    If GetAsyncKeyState(VK_LBUTTON) <> 0 Then
    ' Now look for mouse up event
    Do Until GetAsyncKeyState(VK_LBUTTON) = 0
    DoEvents
    Loop

    ' Record left mouse click event with mouse cursor position
    GetCursorPos pCur
    Debug.Print VBA.Now & ", " & _
    "x coord:" & pCur.X & ", " & _
    "y coord:" & pCur.Y

    End If
    DoEvents
    Loop

    End Sub

  3. #3
    Addicted Member CodeRonin's Avatar
    Join Date
    Jul 2002
    Location
    Vienna, Austria
    Posts
    233

    Looks good

    You can do it this way, or just replace the loop with a timer, if you want to do other things as well (or check other input data...)

    The rest looks really good.
    Code Ronin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width