SetParent Function

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. If successful, the function returns the handle of the moved window's former parent. If it fails, it will instead return 0.

hWndChild
The handle of the window to change parents of.
hWndNewParent
The handle of the window to be the new parent.
Example:
' Move a button from Framw1 to Frame2
oldhwnd = SetParent(Command1.hWnd, Frame2.hWnd)  ' button now inside Frame2
Debug.Print Frame1.hWnd; oldhwnd  ' should be the same

Related Call: GetParent
Category: Windows
Back to the index.


Back to Paul Kuliniewicz's Home Page
E-mail: Borg953@aol.com
This page is at http://members.aol.com/Borg953/api/functions/setparent.html