Nevercom Posted March 22, 2009 Share Posted March 22, 2009 (edited) I wanna make a GUI in AutoIt and make it REAL child of my project window (It's not an AutoIt GUI)I searched the forum and found this on making child window:#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Main GUI", 300, 200) GUISetState(@SW_SHOW, $hGUI) $hGUI_Child = GUICreate("Child GUI", 200, 100, -1, -1, -1, $WS_EX_TOPMOST, $hGUI) GUIRegisterMsg($WM_ACTIVATE, "WM_ACTIVATE") GUISetState(@SW_SHOW, $hGUI_Child) GUISetState(@SW_DISABLE, $hGUI) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_ACTIVATE($hWnd, $Msg, $wParam, $lParam) Local $wActive = BitAND($wParam, 0x0000FFFF) Switch $hWnd Case $hGUI_Child If Not $wActive Then WinActivate($hGUI) WinActivate($hGUI_Child) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFuncIt works perfect, Now I want to use this code to make AutoIt GUI child of my project window, I tried This after some try and error:expandcollapse popup#NoTrayIcon #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> if @Compiled AND $CmdLine[0] == 0 then MsgBox(16,"Error","Missing cmd parameters!") Exit endif if @Compiled then $title = $CmdLine[1]; Get window title from CMD Else $title = "Welcome!"; only for debugging endif $Parent = WinGetHandle($title) ;GUISetState(@SW_DISABLE, $Parent) WinSetState($title,"",@SW_DISABLE) if @error Then MsgBox(48,"","Can't find window with title " & $title) exit endif #Region ### START Koda GUI section ### Form= $hGUI_Child = GUICreate("Child GUI", 200, 100, -1, -1, -1, $WS_EX_TOPMOST, $Parent) ;Label1 = GUICtrlCreateLabel("This is About Box.", 48, 24, 89, 17) ;$Button1 = GUICtrlCreateButton("Button1", 128, 50, 52, 30, 0) GUIRegisterMsg($WM_ACTIVATE, "WM_ACTIVATE") GUISetState(@SW_SHOW, $hGUI_Child) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE WinSetState($title,"",@SW_ENABLE) Func WM_ACTIVATE($hWnd, $Msg, $wParam, $lParam) Local $wActive = BitAND($wParam, 0x0000FFFF) Switch $hWnd Case $hGUI_Child If Not $wActive Then WinSetState($title,"",@SW_ENABLE) WinActivate($hGUI_Child) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFuncbut its not gonna work for me as the Original code does on AutoIt GUI (Parent).I want my Parent window to be disabled (And could not get focus) till the AutoIt GUI(Child Window) is runningCould you please help me about how to do this ?Thanks. Edited March 22, 2009 by Nevercom [left] [/left] Link to comment Share on other sites More sharing options...
Nevercom Posted March 23, 2009 Author Share Posted March 23, 2009 No hope to do this ???? [left] [/left] Link to comment Share on other sites More sharing options...
Hawkwing Posted March 25, 2009 Share Posted March 25, 2009 You can only make a child gui for a gui created in autoit, but why did you want to? There may be another way. The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted March 25, 2009 Share Posted March 25, 2009 You could make a gui with a loop that if the other window is activated that the gui pulls itself to the front. Than in your gui use winsetstate to disable the other window while your gui is active. Giggity Link to comment Share on other sites More sharing options...
Nevercom Posted March 25, 2009 Author Share Posted March 25, 2009 Thanks for reply, I don't know much about AutoIt, I'm new here. As I said, i have found that code and changed it a bit but it's not what really i want, it disables the parent window, but not completely, Parent window can get focus sometimes, what i want is to make a GUI in AutoIt and make it REALLY a child of my parent window which is not created by AutoIt, i mean parent window should be disabled till the child is closed. but i don't know how.... Thanks anyway [left] [/left] Link to comment Share on other sites More sharing options...
Hawkwing Posted March 26, 2009 Share Posted March 26, 2009 As far as I know, this is impossible. You can make a gui it close when another window closes, you can center it over another window, etc, but you cannot make it actually a child of that window. There may be a way to disable the other window while the gui exists if that is all you need, I'll try a few things. The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again. Link to comment Share on other sites More sharing options...
ResNullius Posted March 26, 2009 Share Posted March 26, 2009 i mean parent window should be disabled till the child is closed.This works for me#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $class = "[CLASS:Notepad]" If Not WinExists($class) Then $pid = Run("notepad.exe") WinWait($class) WinActivate($class) WinWaitActive($class) $hParent = WinGetHandle($class) $hChild = GUICreate("Child GUI", 200, 100, -1, -1, -1, $WS_EX_TOPMOST, $hParent) GUISetState() WinSetState($hParent, "", @SW_DISABLE) Do Sleep(10) If Not ProcessExists($pid) then GUIDelete($hChild) Exit EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE WinSetState($hParent, "", @SW_ENABLE) Link to comment Share on other sites More sharing options...
Nevercom Posted March 26, 2009 Author Share Posted March 26, 2009 Thanks ResNullius, It works like a charm !! :wink: [left] [/left] Link to comment Share on other sites More sharing options...
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