|
-
Mar 29th, 2003, 08:09 AM
#1
Thread Starter
New Member
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 ...
-
Apr 22nd, 2003, 03:29 PM
#2
Junior Member
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
-
May 10th, 2003, 11:21 AM
#3
Addicted Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|