Uten Posted September 25, 2006 Posted September 25, 2006 (edited) It should be possible to create a MDI application In AutoIt, should it not?I have spent the better part of the day to get a framework going, but I can't get all the pieces to play as I like.How do I make the child stay inside the parent window? I should be able to resize (maximize) the parent window.Any tips or thoughts?MDITest() Exit Func MDITest() ;;;Local $nStyle = BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_MAXIMIZE,$WS_CLIPCHILDREN,$WS_MINIMIZE,$WS_POPUPWINDOW,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS) Local $nStyle = BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_CLIPCHILDREN) Local $nMain = GUICreate("MDI Parent" , 500, 400,-1, -1, $nStyle ) GUISetState(@SW_SHOW) Local $nStyleChild = BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_CHILD, $WS_CLIPSIBLINGS) Local $nChild = GUICreate("MDI Child:", 150, 100, -50, -50, $nStyleChild, BitOR($WS_EX_MDICHILD,$WS_EX_WINDOWEDGE), Hwnd($nMain)) GUISetBkColor(555, Hwnd($nChild)) GUISetState(@SW_SHOW) ;NOTE: Forcing parent, child. OBS! This will "disable" parent! ;SetParent(Hwnd($nMain), Hwnd($nChild)) While GUIGetMsg() <> -3 Sleep(0) WEnd Exit EndFunc Func SetParent($hParent, $hChild) $nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hChild, "int", -20); -20 Get ExStyle $nExStyle = $nExStyle[0] DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hChild, "int", -20, "int", BitOr($nExStyle, $WS_EX_MDICHILD)) DllCall("user32.dll", "int", "SetParent", "hwnd", $hChild, "hwnd", $hParent) WinSetState($hChild, "", @SW_SHOW) EndFuncEDIT: Forgot $WS_CHILD when posting. Thanks to Valuater for pointing that one out. Edited September 25, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
Valuater Posted September 25, 2006 Posted September 25, 2006 #include <GUIConstants.au3> MDITest() Exit Func MDITest() ;;;Local $nStyle = BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_MAXIMIZE,$WS_CLIPCHILDREN,$WS_MINIMIZE,$WS_POPUPWI ;NDOW,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS) Local $nStyle = BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_CLIPCHILDREN) Local $nMain = GUICreate("MDI Parent" , 500, 400,-1, -1, $nStyle ) GUISetState(@SW_SHOW) Local $nStyleChild = BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_CHILD, $WS_CLIPSIBLINGS) Local $nChild = GUICreate("MDI Child:", 150, 100, -50, -50, $nStyleChild, BitOR($WS_EX_MDICHILD,$WS_EX_WINDOWEDGE), $nMain) GUISetBkColor(555, Hwnd($nChild)) GUISetState() Sleep(50000) EndFunc 8)
Uten Posted September 25, 2006 Author Posted September 25, 2006 Oh mie, I forgot $WS_CHILD when posting. :"> It's like walking in the woods and not see all the trees because of to much timber. But did you try to resize Valuater? Does not work on my system (w2k). Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now