I learned Something Today Since I Have Been Playing With Voice (TextAloud) Program And Make Small Mp3 Files For Command buttons "Back", "Next" etc...
Trying To Figure Out How To Detect When The Mouse Was Over The Command button. Where The MouseMove Would Normally Only Detect Once You Move The Mouse Away From The Button. This Sample Works Perfectly
Declare
Option Explicit
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function GetCapture Lib "user32" () As Long
To Detect That A Mouse Is Over A Command Button In This Case "Back(0)"
Private Sub Back_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If (X < 0) Or (Y < 0) Or (X > Back(0).Width) Or (Y > Back(0).Height) Then
ReleaseCapture ' the mouse is no longer over the button
ElseIf GetCapture() <> Back(0).hwnd Then
SetCapture Back(0).hwnd ' the mouse is over the button
PlayMediaFile Back(0).Caption
End If
End Sub
Play A Sound Using The Media Player
Private Sub PlayMediaFile(MP3FileName As String)
On Error Resume Next
WindowsMediaPlayer1.URL = App.Path & "\Mp3\" & MP3FileName & ".mp3"
End Sub