ControlWindow Example for Visual Basic

Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long

Private Sub CtlWin_Click()
   Dim ctlDC As Long, ctlWnd As Long, strOut As String
   strOut = "Writing to Control Window"
   ctlWnd = LEADRasImgList1.ControlWindow
   If ctlWnd <> 0 Then
      ctlDC = GetDC(ctlWnd)
      TextOut ctlDC, 10, 10, strOut, Len(strOut)
      ReleaseDC ctlWnd, ctlDC
   End If
End Sub