1,486
社区成员
发帖
与我相关
我的任务
分享
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Const GWL_STYLE = (-16)
Const SW_SHOW = 5
Const WS_CHILD = &H40000000
Public Sub ShowAsChild(frmParent As Form, frmChild As Form)
SetWindowLong frmChild.hWnd, GWL_STYLE, GetWindowLong(frmChild.hWnd, GWL_STYLE) Or WS_CHILD
SetParent frmChild.hWnd, frmParent.hWnd
ShowWindow frmChild.hWnd, SW_SHOW
End Sub
Public Sub ShowAsChild(frmParent As Form, frmChild As Form)
' SetWindowLong frmChild.hwnd, GWL_STYLE, GetWindowLong(frmChild.hwnd, GWL_STYLE) Or WS_CHILD
SetParent frmChild.hwnd, frmParent.hwnd
SetActiveWindow frmChild.hwnd
ShowWindow frmChild.hwnd, SW_SHOW
End Sub