fi3ldy Posted February 22, 2010 Share Posted February 22, 2010 (edited) Hi, I'm attempting to get a Child GUI to sit inside the PARENT GUI and when the parent GUI is moved, the Child GUI to stay relative to this and move in position at the same time, so the windows are basically locked together. (i dont want the user to really experience the child gui is another window.) The reason for this, is I have a transparent GUI .png so the PARENT GUI is transparent with no toolbar, however when embedding an IE object it doesn't work without making a child gui to create the ie object inside (it used to work fine until I've added the Icons.au3 to allow me to use a transparent .png as the gui background). Heres my code: expandcollapse popup#include <GUIConstants.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> #Include <Icons.au3> #Include <WinAPIEx.au3> #NoTrayIcon ;;;;;;;;;;;;;;;;;PRE-SETTINGS;;;;;;;;;;;;;;;;;;;;; Opt("OnExitFunc", "Quit") Opt("GuiOnEventMode", 1) Opt("GUICloseOnESC", 0) Global $fileTitle = "Herb (v1.1 Beta)" ;;;;;;;;;;;;;LIMIT MULTIPLE WINDOWS;;;;;;;;;;;;;;; If WinExists($fileTitle) Then Exit EndIf ;;;;;;;;;;;;;;;;;;;;;;VARS;;;;;;;;;;;;;;;;;;;;;;;; Global $exitItem, $trayIcon, $backGround, $mainGUI, $hBitmap, $object, $objectCtrl, $msg ;;;;;;;;;;;;;;INSTALL NEEDED FILES;;;;;;;;;;;;;;; Global $trayIcon = @SystemDir & "\herbie.ico" FileInstall("herbie.ico", @SystemDir, 1) FileSetAttrib($trayIcon, "+H") Global $backGround = @SystemDir & "\herbie_bg.png" FileInstall("herbie_bg.png", $backGround, 1) FileSetAttrib($backGround, "+H") ;;;;;;;;;;;;;;;;;;TRAY MENU;;;;;;;;;;;;;;;;;;;;; Global $exitItem = TrayCreateItem("Exit") TraySetIcon(@SystemDir & "\herbie.ico") TraySetToolTip($fileTitle) Opt("TrayMenuMode", 1) opt("TrayIconHide", 0) TraySetState() ;;;;;;;;;;;;;;;;;;CREATE MAIN GUI;;;;;;;;;;;;;;;;;;; AutoItWinSetTitle($fileTitle) $mainGUI = GUICreate($fileTitle, 282, 290, ((@DesktopWidth-282)/2), ((@DesktopHeight-290)/2), $WS_POPUP+$WS_CLIPCHILDREN+$WS_CLIPSIBLINGS, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) $hBitmap = _Icons_Bitmap_Load(@ScriptDir & '\herbie_bg.png') GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") _SetBitmap($mainGUI, $hBitmap, 255) GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") GUICtrlCreateLabel("Drag", 118, 0, 164, 160, '', $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUISetState(@SW_SHOW, $mainGUI) ;;;;;;;;;;;;;;;;;;CREATE CHILD GUI;;;;;;;;;;;;;;;;;; $childGUI = GUICreate("", 230, 120, ((@DesktopWidth-282)/2), ((@DesktopHeight-290)/2), $WS_EX_MDICHILD) $object = _IECreateEmbedded() $objectCtrl = GUICtrlCreateObj($object, 0, 0, 230, 120) _IENavigate($object, "http://www.google.co.uk") $object.document.body.scroll = "no" $object.document.body.style.border = 0 GUISetState(@SW_SHOW, $childGUI) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop $tmsg = TrayGetMsg() If $tmsg = $exitItem Then ExitLoop Wend ;;;;;;;;;;;;;;;;;;FUNCTIONS;;;;;;;;;;;;;;;;;;;;;;; Func Quit() Exit EndFunc ;==>Quit Func _SetBitmap($hWnd, $hBitmap, $iOpacity) Local $hDC, $hMemDC, $tBlend, $tSize, $tSource $hDC = _WinAPI_GetDC($hWnd) $hMemDC = _WinAPI_CreateCompatibleDC($hDC) _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = _WinAPI_GetBitmapDimension($hBitmap) $tSource = DllStructCreate($tagPOINT) $tBlend = DllStructCreate($tagBLENDFUNCTION) DllStructSetData($tBlend, 'Alpha', $iOpacity) DllStructSetData($tBlend, 'Format', 1) _WinAPI_UpdateLayeredWindow($hWnd, $hDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC($hWnd, $hDC) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>_SetBitmap Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $mainGUI Return $HTCAPTION EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NCHITTEST I've attached the required image & icon so you can run the script to see for yourself! I'm really pulling my hair out so a solution to this would be excellent. Kind regards, Dannyherbie.ico Edited February 22, 2010 by fi3ldy Link to comment Share on other sites More sharing options...
fi3ldy Posted February 23, 2010 Author Share Posted February 23, 2010 Any help on this would be appreciated. Link to comment Share on other sites More sharing options...
kaotkbliss Posted February 23, 2010 Share Posted February 23, 2010 (edited) as per the helpfile GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] ) when you create your child gui, where the , parent option is you need to add the gui that the child would be attached to. in your case $mainGUI $childGUI = GUICreate("", 230, 120, ((@DesktopWidth-282)/2), ((@DesktopHeight-290)/2), $WS_EX_MDICHILD,-1,$mainGUI) Edited February 23, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 23, 2010 Moderators Share Posted February 23, 2010 kaotkbliss,You need to get the styles in the right order: $childGUI = GUICreate("", 230, 120, ((@DesktopWidth-282)/2), ((@DesktopHeight-290)/2), -1, $WS_EX_MDICHILD, $mainGUI)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kaotkbliss Posted February 23, 2010 Share Posted February 23, 2010 kaotkbliss,You need to get the styles in the right order: $childGUI = GUICreate("", 230, 120, ((@DesktopWidth-282)/2), ((@DesktopHeight-290)/2), -1, $WS_EX_MDICHILD, $mainGUI)M23woops.that would help 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
fi3ldy Posted February 23, 2010 Author Share Posted February 23, 2010 (edited) $childGUI = GUICreate("", 230, 120, ((@DesktopWidth-282)/2), ((@DesktopHeight-290)/2), -1, $WS_EX_MDICHILD, $mainGUI) Sorted it 100% - thanks a lot for your help guys really appreciate it. I tried for hours, seems as though I was missing the $WS_EX_MDICHILD with linking to it's PARENT. I tried both individually numerous times Hehe, thanks again. Quick question whilst im here, can't seem to find an documentation or results on removing the border from creating an IE embedded object? Here's my object: $object = _IECreateEmbedded() $objectCtrl = GUICtrlCreateObj($object, 0, 0, 266, 115) _IENavigate($object, "http://www.google.co.uk") $object.document.body.scroll = "no" $object.document.body.style.border = 0 Kind regards, Danny Edited February 23, 2010 by fi3ldy 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