.Parent 不对.
试试:
UserControl.hWnd
  

解决方案 »

  1.   

    Sub ControlProcessor(MyControl As Control)
       If TypeOf MyControl Is CommandButton Then
          Debug.Print "You passed in a " & TypeName(MyControl)
       ElseIf TypeOf MyControl Is CheckBox Then
          Debug.Print "You passed in a " & TypeName(MyControl)
       ElseIf TypeOf MyControl Is TextBox Then
          Debug.Print "You passed in a " & TypeName(MyControl)
       End If
    End Sub
      

  2.   

    要想得到usercontrol的容器的句柄,如果容器没有这个属性,直接用属性得不到,需要用API.
    GetParent Declare Function GetParent Lib "user32" Alias "GetParent" (ByVal hwnd As Long) As Long Private  parentHWnd  As  Long
      
    Private  Sub  UserControl_Show()
              parentHWnd  =  GetParent UserControl.hwnd
    end sub
      

  3.   

    '忘了括号.
    Private Sub UserControl_Show()
        parentHWnd =GetParent (UserControl.hwnd)
    end  sub
      

  4.   

    如果你想得到UserControl的容器的句柄。可用下面这一句试试:
    lHwnd=UserControl.ContainerHWnd