VBA - change left mouse click behavior

K

Kenny McCarty

I was wondering if anyone knew of a way to change the default behavior
of the left mouse button in a powerpoint slide presentation.
Basically I want to allow the user to use the left mouse button to
perform some other action instead of moving on to the next slide.

Currently I am using a mouse hook that watches the mouse events. If a
left click is detected I call another function defined below.
bContextMenu is a bool I set to tell if the user has right-clicked to
open the context menu. If this is the case I want to process the left
click normally, otherwise I want to ignore this click.

Private Sub DiscardMouseMessages(ByVal hWnd As Long)
Dim Message As msg

Do While PeekMessage(Message, hWnd, WM_MOUSEFIRST, WM_MOUSELAST,
PM_REMOVE)
' continue to loop until there are no more mouse messages
If (Message.Message = WM_LBUTTONDOWN Or Message.Message =
WM_LBUTTONUP) And Not bContextMenu Then
'Do Nothing
Else
TranslateMessage Message
DispatchMessage Message
'Exit Do
End If
Loop
End Sub


I can't seem to get anything to work for this...it is extremely
unstable...most of the time when I left-click it just hangs for a
while and then it may or may not allow me to proceed.

If anyone has any idea how to do this I would GREATLY appreciate it.
Thanks in advance for any help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top