Declare Function SetParent Lib "user32.dll" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
SetParent moves a window from having one parent window to another. If needed, the window itself moves so it can be "inside" its new parent. The child window can also become independent by making it a child of the desktop.
If an error occured, the function returns 0 (use GetLastError to get the error code). If successful, the function returns a handle to the child window's former parent window.
None.
' This code is licensed according to the terms and conditions listed here.
' Move button Command1, which is a child window, from its old
' parent window of Form1 to its new parent window of Form2.
Dim oldhwnd As Long ' receives handle of button's former parent
oldhwnd = SetParent(Command1.hWnd, Form2.hWnd) ' button is now in window Form2.
Go back to the alphabetical Function listing.
Go back to the Reference section index.
Last Modified: August 1, 1999
This page is copyright © 1999 Paul Kuliniewicz.
Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/s/setparent.html