Results 1 to 20 of 20

Thread: [VB6] - Signal spectrum

Threaded View

  1. #16
    Hyperactive Member
    Join Date
    Apr 2015
    Posts
    356

    Re: [VB6] - Signal spectrum

    Quote Originally Posted by jsvenu View Post
    Dear Trick,

    Can you provide me a way to use the following code

    Code:
    hHook = SetWindowsHookEx(WH_GETMESSAGE, AddressOf GetMsgProc, 0, hThreadToHook)

    instead of

    Code:
    m_pfnPrevProc = SetWindowLong(Me.hwnd, GWL_WNDPROC, AddressOf WindowProc)
    in InitSubclassing


    where GetMsgProc is defined as

    Code:
    Public Function GetMsgProc(ByVal uCode As Long _
        , ByVal wParam As Long _
        , ByRef lParam As MSG) As Long
        If uCode = 0 Then
            If wParam = PM_REMOVE Then
            
            
             Dim tHeader As WAVEHDR
        Dim lIndex  As Long
        
        Select Case lParam.message
        Case MM_WOM_DONE
            
            memcpy tHeader, ByVal lParam, Len(tHeader)
            
            ' // Search for free buffer
            For lIndex = 0 To UBound(m_tBuffer)
                If m_tBuffer(lIndex).tHeader.lpData = tHeader.lpData Then Exit For
            Next
            
            NeedNewData m_tBuffer(lIndex).bData()
            
            waveOutWrite m_hWaveOut, m_tBuffer(lIndex).tHeader, Len(m_tBuffer(lIndex).tHeader)
            
         Case Else
            GetMsgProc = CallNextHookEx(hHook, uCode, wParam, lParam)
        End Select
           
            End If
        
    End If
        
    End Sub
    and use UnhookWindowsHookEx in UninitializeSubclassing as follows:

    Code:
    Private Sub UninitializeSubclassing()
        
     
       If bHooked Then
            UnhookWindowsHookEx hHook
            bHooked = False
        End If
        
    End Sub
    so that I can hook to default message loop and use the following code in InitPlayback

    Code:
    lErr = waveOutOpen(m_hWaveOut, WAVE_MAPPER, tFormat, App.ThreadID, 0, CALLBACK_THREAD)
    regards,
    JSVenu
    Dear Trick,

    I am sending the project code using waveOutOpen(m_hWaveOut, WAVE_MAPPER, tFormat, App.ThreadID, 0, CALLBACK_THREAD) as attachment.
    When we compile and run the code I am getting the Play button disabled.Please clarify how to make the Play button enabled and make the code work properly.

    regards,
    JSVenu
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width