Jump to content

MDI (multiple-document interface) Applications


Uten
 Share

Recommended Posts

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)    
EndFunc

EDIT: Forgot $WS_CHILD when posting. Thanks to Valuater for pointing that one out.

Edited by Uten
Link to comment
Share on other sites

#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)

NEWHeader1.png

Link to comment
Share on other sites

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). :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...