Results 1 to 4 of 4

Thread: [RESOLVED] External app's window inside VB control ?

  1. #1

    Thread Starter
    Addicted Member tcurrier's Avatar
    Join Date
    May 1999
    Location
    Northeastern Pa./USA
    Posts
    255

    Resolved [RESOLVED] External app's window inside VB control ?

    I've seen this done before, but I can't remember where I saw it ...

    Can I put an external application's window inside a control on a VB form ?

    For example, if can I get the HWND to a DOS window, can I somehow assign it to the HWND of a control on the VB form? Say, for example, a picture box, with an DOS window inside of it ?

    (I can get the HWND's, but it tells me that they're read/only properties.)

    Thanks for any help !
    VB6 Enterprise SP4

  2. #2

  3. #3

    Thread Starter
    Addicted Member tcurrier's Avatar
    Join Date
    May 1999
    Location
    Northeastern Pa./USA
    Posts
    255

    Re: External app's window inside VB control ?

    Yep, thanks, I found it ..... works great ...


    VB Code:
    1. Private Declare Function ShowWindow Lib "user32" _
    2.     (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    3. Private Declare Function FindWindow Lib "user32" _
    4.     Alias "FindWindowA" _
    5.     (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    6. Private Declare Function SetParent Lib "user32" _
    7.     (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    8. Private Sub Command1_Click()
    9. Dim lHwnd As Long
    10. Dim sTitle$
    11.     'sTitle = "Untitled - Notepad"
    12.     sTitle = "c:\winnt\system32\cmd.exe"
    13.     lHwnd = FindWindow(vbNullString, sTitle)
    14.     Call SetParent(lHwnd, Picture1.hwnd)
    15.     Call ShowWindow(lHwnd, 3)
    16. End Sub

    Happy New Year !
    VB6 Enterprise SP4

  4. #4

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