Jump to content

Embed a GUI within a GUI?


Recommended Posts

I want to embed a GUI within my main gui so that I can switch around by tabs. The reason I can't just build the controls or something is that I'm calling a DLL in on one of the GUI pieces.

Basically I'm putting a web browser inside the gui through the cwebpage dll. When I do that it dominates the entire gui. But I want it to be part of the gui but have other controls on it too.

Link to comment
Share on other sites

That works!  Thanks!!

Do you suppose it's possible to make it work within a tab?  So like if I wanted 4 tabs each with a web browser instance running in it?

<{POST_SNAPBACK}>

you'll have to create 4 separate web windows..aside from that i don't see why not..
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
Link to comment
Share on other sites

I did, but I couldn't figure out how to make them show up. Actually when you call the first one it causes the other tabs not to show up.

Included an example with two tabs on it:

#include <GUIConstants.au3>
$dll = DLLOpen("cwebpage.dll")

$main = GUICreate("Web GUI", 600, 600) ; will create a dialog box that when displayed is centered


$tab=GUICtrlCreateTab (10,10, 500,500)

; BROWSER #1
$tab0=GUICtrlCreateTabitem ("Google")
$tabbrowser0 = GUICreate("edit", 200, 200, 200, 200, $WS_CHILD, '', $main )
DLLCall($dll,"long","EmbedBrowserObject","hwnd",$tabbrowser0) 
DLLCall($dll,"long","DisplayHTMLPage","hwnd",$tabbrowser0,"str","http://www.google.com")
GUISetState()

; #BROWSER #2
$tab1=GUICtrlCreateTabitem ("Yahoo")
$tabbrowser1 = GUICreate("edit", 200, 200, 200, 200, $WS_CHILD, '', $main )
DLLCall($dll,"long","EmbedBrowserObject","hwnd",$tabbrowser1) 
DLLCall($dll,"long","DisplayHTMLPage","hwnd",$tabbrowser1,"str","http://www.yahoo.com")
GUISetState()



GUICtrlCreateTabitem (""); end tabitem definition
GUISetState(@SW_SHOW, $main)


; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

$ret = DLLCall($dll,"long","UnEmbedBrowserObject","edit",$browser)
DLLClose($dll)

*** You'll need the cwebpage.dll which I found on this forum if you want to test the example

Link to comment
Share on other sites

try this:

#include <GUIConstants.au3>
$dll = DllOpen("cwebpage.dll")
$main = GUICreate("Web GUI", 600, 600); will create a dialog box that when displayed is centered
$tab = GUICtrlCreateTab(10, 10, 500, 500)
; BROWSER #1
$tab0 = GUICtrlCreateTabItem("Google")
$tabbrowser0 = GUICreate("edit", 200, 200, 200, 200, $WS_CHILD, -1, $main)
DllCall($dll, "long", "EmbedBrowserObject", "hwnd", $tabbrowser0)
DllCall($dll, "long", "DisplayHTMLPage", "hwnd", $tabbrowser0, "str", "http://www.google.com")
GUISetState()
; #BROWSER #2
GUISwitch($main)
$tab1 = GUICtrlCreateTabItem("Yahoo")
$tabbrowser1 = GUICreate("edit", 200, 200, 200, 200, $WS_CHILD, -1, $main)
DllCall($dll, "long", "EmbedBrowserObject", "hwnd", $tabbrowser1)
DllCall($dll, "long", "DisplayHTMLPage", "hwnd", $tabbrowser1, "str", "http://www.yahoo.com")
GUISetState()
GUISwitch($main)
GUICtrlCreateTabItem(" "); end tabitem definition
GUISetState(@SW_SHOW, $main)
; Run the GUI until the dialog is closed
While 1
   $msg = GUIGetMsg()
   If $msg = $GUI_EVENT_CLOSE Then
      DllClose($dll)
      Exit
   EndIf
WEnd
Edited by quaizywabbit
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
Link to comment
Share on other sites

Thanks for the quick replies! Unfortunately that didn't work.

I may just have to simulate tabs with some images and then just hide and show the browser windows based on what graphic is clicked.

try this:

#include <GUIConstants.au3>
$dll = DllOpen("cwebpage.dll")
$main = GUICreate("Web GUI", 600, 600); will create a dialog box that when displayed is centered
$tab = GUICtrlCreateTab(10, 10, 500, 500)
; BROWSER #1
$tab0 = GUICtrlCreateTabItem("Google")
$tabbrowser0 = GUICreate("edit", 200, 200, 200, 200, $WS_CHILD, -1, $main)
DllCall($dll, "long", "EmbedBrowserObject", "hwnd", $tabbrowser0)
DllCall($dll, "long", "DisplayHTMLPage", "hwnd", $tabbrowser0, "str", "http://www.google.com")
GUISetState()
; #BROWSER #2
GUISwitch($main)
$tab1 = GUICtrlCreateTabItem("Yahoo")
$tabbrowser1 = GUICreate("edit", 200, 200, 200, 200, $WS_CHILD, -1, $main)
DllCall($dll, "long", "EmbedBrowserObject", "hwnd", $tabbrowser1)
DllCall($dll, "long", "DisplayHTMLPage", "hwnd", $tabbrowser1, "str", "http://www.yahoo.com")
GUISetState()
GUISwitch($main)
GUICtrlCreateTabItem(" "); end tabitem definition
GUISetState(@SW_SHOW, $main)
; Run the GUI until the dialog is closed
While 1
   $msg = GUIGetMsg()
   If $msg = $GUI_EVENT_CLOSE Then
      DllClose($dll)
      Exit
   EndIf
WEnd

<{POST_SNAPBACK}>

Link to comment
Share on other sites

did any of the tabs work? I never tried it with the dll (dont have it...I just commented those lines so i could test that the tabs showed)

you might have to initialize the dll( DllOpen() ) for each window you plan to embed, so that there are multiple instances of the dll loaded.....

Edited by quaizywabbit
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
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...