|
-
Jun 6th, 2013, 04:40 PM
#1
[RESOLVED] How to move Form using Title bar without interrupting Processing
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
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
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
-
Jun 6th, 2013, 08:06 PM
#2
Re: How to move Form using Title bar without interrupting Processing
I'd rather put the processing code into an activex-dll, since that one gets its own thread from windows
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Jun 6th, 2013, 08:24 PM
#3
Re: How to move Form using Title bar without interrupting Processing
 Originally Posted by Zvoni
I'd rather put the processing code into an activex-dll, since that one gets its own thread from windows
DLLs run in-process unless you use them with a proxy (not too practical in VB6). So no, they do not "get a thread" at all but run on the calling thread.
An ActiveX EXE runs out of process, perhaps that's what you were trying to say. These are easy to create using VB6 but to make use of them for independent worker threads takes some finessing.
-
Jun 6th, 2013, 09:43 PM
#4
Re: How to move Form using Title bar without interrupting Processing
Dilettante, whooops! You're right, of course.
Sorry for the confusion.
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
-
Jun 6th, 2013, 10:50 PM
#5
Re: How to move Form using Title bar without interrupting Processing
Use Timer(s) instead of Loop(s), put a very small interval.
-
Jun 8th, 2013, 03:10 PM
#6
Re: How to move Form using Title bar without interrupting Processing
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
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
|