CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2000
    Location
    UK
    Posts
    122

    URGENT subclassing an ImageCombo

    I have a UserControl, which I have subclassed.
    I am trying to catch when an ImageCombo dropdown is closedup

    Here is a copy of the subclass function
    Code:
    Const WM_COMMAND = &H111
    Const CBN_CLOSEUP = 7
    
    Friend Function WindowProc(ByVal hwnd As Lon, ByVal iMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    
        If (iMsg = WM_COMMAND) Then
            If (lParam <> 0) Then
                ctrlIndex = (wParam And &HFFF&) -1
                If (ctrlIndex > -1) Then
                    Set ctrl = Controls(ctrlIndex)
                    If (TypeOf ctrl Is ImageCombo) Then
                        cmdCode = (wParam And &HFFFF0000) / &H10000
                        If (cmdCode = CBN_CLOSEUP) Then
                            'Some Code Here
                        End If
                    End If
                End If
            End If
        End If
        WindowProc = CallWindowProc(GetProp(hWnd, "OldWindowProc"), hwnd, iMsg, wParam, lParam)
    End Function
    The subclassing of the UserControl works, however I am not trapping when the ImageCombo dropdown closes.
    If I replace the ImageCombo for a ComboBox and change the relevant line of code, it works.


    So I think I might not be trapping the proper messages
    All code on this page is protected by an SEP field!!!

  2. #2
    Join Date
    Sep 2000
    Location
    UK
    Posts
    122

    Re: URGENT subclassing an ImageCombo

    Ok i figured it out shoudl not subtract -1 from ctlIndex
    and should test if ctrlIndex > -1
    All code on this page is protected by an SEP field!!!

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

Featured