I'm working on a real-time application that accepts incoming sound data and plays it back async. This app is in a constant loop reading in the sound data and playing it back using Winsock to receive the data from the server. The problem is if a user mouse down on the title bar and moves the Form the playback is interrupted until user releases the mouse. After user releases the mouse the playback continues but it is now out of sync with the sending of the sound data.
I think that if I subclass the app and capture the mouse down on the title bar I can still allow the user to move his Form without interrupting the playback and getting out of sync.
Here is my subclassing code. All I need are the steps to allow Form movement and not interrupt processing
Form Code
Module Code
I think that if I subclass the app and capture the mouse down on the title bar I can still allow the user to move his Form without interrupting the playback and getting out of sync.
Here is my subclassing code. All I need are the steps to allow Form movement and not interrupt processing
Form Code
Code:
'
'
Private Sub cmdStartSubclassing_Click()
MainOldWindPoc = SetWindowLong(Me.hwnd, GWL_WNDPROC, AddressOf MainWndProc)
End Sub
Private Sub cmdStopSubclassing_Click()
SetWindowLong Me.hwnd, GWL_WNDPROC, MainOldWindPoc
End Sub
'
'
Module Code
Code:
Option Explicit
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Public Const WM_SYSCOMMAND As Long = &H112
Public MainOldWindPoc As Long
Public defWndProc As Long
Public Const GWL_WNDPROC& = (-4)
Public Function MainWndProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim handled As Long
handled = False
Select Case uMsg
Case WM_SYSCOMMAND
'
' Don't know what to do here
'
handled = False
End Select
If Not handled Then
MainWndProc = CallWindowProc(MainOldWindPoc, hwnd, uMsg, wParam, lParam)
End If
End Function