Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Private Const SWP_NOSIZE = &H1 Private Const SWP_NOZORDER = &H4Private Sub Command1_Click() Form2.Show Call SetParent(Form2.hwnd, Me.Picture1.hwnd) Call SetWindowPos(Form2.hwnd, _ 0, _ 0, _ 0, _ Picture1.ScaleWidth / Screen.TwipsPerPixelX, _ Picture1.ScaleHeight / Screen.TwipsPerPixelY, _ SWP_NOZORDER) End SubPrivate Sub Form_Unload(Cancel As Integer) Dim f As Form For Each f In Forms If f.Name <> Me.Name Then Unload f Next End Sub
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOZORDER = &H4Private Sub Command1_Click()
Form2.Show
Call SetParent(Form2.hwnd, Me.Picture1.hwnd)
Call SetWindowPos(Form2.hwnd, _
0, _
0, _
0, _
Picture1.ScaleWidth / Screen.TwipsPerPixelX, _
Picture1.ScaleHeight / Screen.TwipsPerPixelY, _
SWP_NOZORDER)
End SubPrivate Sub Form_Unload(Cancel As Integer)
Dim f As Form
For Each f In Forms
If f.Name <> Me.Name Then Unload f
Next
End Sub