Buat Modul dengan kode seperti berikut
Option Explicit Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
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
Declare Function winSetFocus Lib "user32" Alias "SetFocus" (ByVal hWnd As Long) As Long
Declare Function winGetFocus Lib "user32" Alias "GetFocus" () As Long
Public Const GWL_STYLE = (-16)
Public Const WS_CHILD = &H40000000
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOMOVE = &H2 Public Const SWP_NOZORDER = &H4 Public Const SWP_NOREDRAW = &H8 Public Const SWP_NOACTIVATE = &H10 Public Const SWP_FRAMECHANGED = &H20 Public Const SWP_SHOWWINDOW = &H40 Public Const SWP_HIDEWINDOW = &H80 Public Const SWP_NOCOPYBITS = &H100 Public Const SWP_NOOWNERZORDER = &H200
Public Const SWP_DRAWFRAME = SWP_FRAMECHANGED
Public Const SWP_NOREPOSITION = SWP_NOOWNERZORDER Public Const HWND_TOP = 0 Public Const HWND_BOTTOM = 1 Public Const HWND_TOPMOST = -1 Public Const HWND_NOTOPMOST = -2
Pada Form1 tulis kode seperti berikut
Option Explicit
Private mlF2Ptr As Long Private mlP2Ptr As Long Private mlFocus2Ptr As Long Private WithEvents oF2 As Form2 Private WithEvents oF3 As Form3
Private Sub pSetWinStyle(hWnd As Long)
End Sub
Private Function pAssignContainer(lFrmPtr As Long, lPicPtr As Long) As Long