Option ExplicitPrivate Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_STYLE = (-16) Private Const WS_CHILD = &H40000000 Private Const WS_VISIBLE = &H10000000 Private Const WS_TABSTOP = &H10000 Private Sub SetParentAndMove() Dim hNotepad As Long, lRect As RECT hNotepad = FindWindow("Notepad", vbNullString) SetParent hNotepad, Me.hwnd Me.ScaleMode = vbPixels Call SetWindowPos(hNotepad, Me.hwnd, 0, 0, Me.ScaleWidth, Me.ScaleHeight, SWP_NOZORDER Or SWP_DRAWFRAME)End Sub
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const WS_CHILD = &H40000000
Private Const WS_VISIBLE = &H10000000
Private Const WS_TABSTOP = &H10000
Private Sub SetParentAndMove()
Dim hNotepad As Long, lRect As RECT
hNotepad = FindWindow("Notepad", vbNullString)
SetParent hNotepad, Me.hwnd
Me.ScaleMode = vbPixels
Call SetWindowPos(hNotepad, Me.hwnd, 0, 0, Me.ScaleWidth, Me.ScaleHeight, SWP_NOZORDER Or SWP_DRAWFRAME)End Sub