PDA

Click to See Complete Forum and Search --> : Embed app


WadeD
Nov 15th, 1999, 03:49 AM
I've posted on numerous boards, and no one has an answer, so I'm really hoping you guys can help.

I'm writing a vb6 app that will integrate a number of other apps, using an OLE container. One external app (solomon) doesn't support in-place activation, so it loads in a separate window instead of in the ole container, which looks pretty bad to the user.

In vb6, can I embed the app in an OLE container even if it doesn't support in-place activation...maybe using an api? Or do I have other options for keeping the app inside of mine (with something other than an OLE container)?

Eternally grateful,
Wade

Aaron Young
Nov 15th, 1999, 03:55 AM
You could try using the SetParent API to Force the App's Window to be a Child Window of you Application, eg.

Add a Large Picturebox to a Form, then..

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 Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Private Sub Form_Load()
Dim lHwnd As Long
Call Shell("Notepad", vbHide)
lHwnd = FindWindow("Notepad", vbNullString)
Call SetParent(lHwnd, Picture1.hwnd)
Call ShowWindow(lHwnd, 3)
End Sub

Of course you'll need to know the Window Handle of the Application Window.

------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net