If i have a standard form with a picture box on it. I want it so when you click a button it displays a form inside the picture box, to give the effect of 'MDI'.
Printable View
If i have a standard form with a picture box on it. I want it so when you click a button it displays a form inside the picture box, to give the effect of 'MDI'.
Use the SetParent API.
Code:Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Sub Command1_Click()
SetParent Form2.hwnd, Picture1.hwnd
Form2.Show
End Sub
Better yet, use this code. It will allow multiple copies of Form2.
Code:Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Dim newForm As Form2
Private Sub Command1_Click()
Set newForm = New Form2
SetParent newForm.hwnd, Picture1.hwnd
newForm.Show
End Sub
Cheers m8, exactly what i was looking for, ace bloke
thanks that code helped me out to :)