[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 !
Re: External app's window inside VB control ?
If control is a container (like picturebox) then you can do that using SetParent api. There are plenty of samples so simple search will get you the answers.
Re: External app's window inside VB control ?
Yep, thanks, I found it ..... works great ...
VB Code:
Private Declare Function ShowWindow Lib "user32" _
(ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetParent Lib "user32" _
(ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Sub Command1_Click()
Dim lHwnd As Long
Dim sTitle$
'sTitle = "Untitled - Notepad"
sTitle = "c:\winnt\system32\cmd.exe"
lHwnd = FindWindow(vbNullString, sTitle)
Call SetParent(lHwnd, Picture1.hwnd)
Call ShowWindow(lHwnd, 3)
End Sub
:wave: Happy New Year !
Re: [RESOLVED] External app's window inside VB control ?