Results 1 to 2 of 2

Thread: Embed app

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    363

    Post

    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

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    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..
    Code:
    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
    [email protected]
    [email protected]

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