Just something I threw together in a couple of minutes; it seems to do what you want though
// Libraries
#constant user32 1
load dll "user32.dll", user32
startBlue "user", "key"
mainWin = createGadgetFromWindow(mainWindow())
// Create random window and try to child it to the main window
hChildWindow = createWin(0, 0, 400, 400, -2147483648) // NO_BORDER style
setParent(hChildWindow, windowHandle(mainWin))
while not quit
getEvent
select eventType()
case 0x10
if eventSource() = mainWin then quit = 1
endcase
endselect
endwhile
end
// Creates a window and returns its HWND (I'm using BlueGUI to create the window here for simplicity, but any other way should probably work)
function createWin(x, y, width, height, style)
win = createWindow(x, y, width, height, "Text", (style || 0x40000000), 0, 1, 0) // Add the WS_CHILD style
// Also, let's add some components to the window so as to make it clearly discernable
lbl = createLabel(0, 0, gadgetClientWidth(win), gadgetClientHeight(win), "I am a label belonging to the child window", win)
hwnd = windowHandle(win)
endfunction hwnd
// Wraps the user32.dll function SetParent
function setParent(hChild as dword, hParent as dword)
call dll user32, "SetParent", hChild, hParent
endfunction
Edit: any chance to get a copy of / link to that plugin by the way? It sounds handy
"Why do programmers get Halloween and Christmas mixed up?" Because Oct(31) = Dec(25)