|
-
Apr 4th, 2001, 03:42 PM
#1
Thread Starter
Addicted Member
This has been sitting here all day (different post though) with no answer, so perhaps a guru can answer?
I have a MDI application that will be launching another application (a helper wizard that I wrote).
Is there any way where I can get app # 2 to be a MDI child of app # 1 (MDI app)?
-
Apr 4th, 2001, 03:44 PM
#2
I think this was discussed a few days ago, I believe the solution was to get the handle of the window opened, then use the SetParent API to make it like a child form...
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Apr 4th, 2001, 03:48 PM
#3
PowerPoster
For example, I just did notepad, but you can use your own form, just supply caption name.
Code:
Option Explicit
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
SetParent FindWindow(vbNullString, "Untitled - Notepad"), hWnd
End Sub
Last edited by Lethal; Apr 4th, 2001 at 03:55 PM.
-
Apr 4th, 2001, 03:51 PM
#4
What a team, me and you, Lethal
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Apr 4th, 2001, 03:53 PM
#5
PowerPoster
Yep, we chew up the questions and spit them out..(Spit)...
-
Apr 4th, 2001, 04:10 PM
#6
Thread Starter
Addicted Member
Thanks guys
-
Apr 5th, 2001, 01:29 PM
#7
Thread Starter
Addicted Member
Ok - I got it to work pulling the outside app into the MDI form - here is the new problem I am having though:
If the new Child exe/window is still open when the MDI form is unloaded, the Child exe continues running in the background.
I have tried using different API calls (CloseWindow, DestroyWindow, etc) but nothing seems to do it. Perhaps I am just calling them wrong or something?
Any help?
-
Apr 5th, 2001, 02:18 PM
#8
Thread Starter
Addicted Member
Nevermind
Nevermind;
I found an old post that Lethal had answered using the SendMessage API call...
I tried this too, but evidently was passing the wrong window handle.
Code:
Option Explicit
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, _
ByVal hWndNewParent 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 SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_CLOSE = &H10
Public theID As Long
Private Sub MDIForm_Load()
Form1.Show
Shell "Wizard.exe", vbNormalFocus
theID = FindWindow(vbNullString, "Wizard")
SetParent theID, hwnd
End Sub
Private Sub MDIForm_Unload(Cancel As Integer)
Dim frm As Form
SendMessage theID, WM_CLOSE, 0, 0
For Each frm In Forms
Unload frm
Next
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|