Sign in to follow this  
Followers 0
magician13134

Wow, can you not move a child window?

5 posts in this topic

Ok, I have a child window and a parent, when i move the parent, the child moves with it, but it never resizes, so I wanted to use WinMove() to take care of that, but it doesn't seem to do anything. Thanks guys...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I am no magician...

show some code

8)

EDIT

Last Seen: Today, 06:47 PM... another post - leave - don't check for responces

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

The way i did didn't have any problems. Maybe it's your GUI style. Take a look and run it

Share this post


Link to post
Share on other sites

Ok, here's some source, it's just a very simple web-browser test, you'll need cwebpage.dll, search for that if you don't have it...

#include <GUIConstants.au3>
#include <IE.au3>
#include <INet.au3>

$TempDir = DirCreate(@TempDir & "\Vanilla Browser")
$homepage = "http://www.google.com"
Dim $formatted


$title = getTitle($homepage) & " - Vanilla Browser"
$title2 = "embeddedWindow"
$DisplayWidth = 487
$DisplayHeight = 415
$DisplayX = 5
$DisplayY = 40
$GUI = GUICreate($title, 500, 500, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
$FileMenu = GUICtrlCreateMenu("File")
$EditMenu = GUICtrlCreateMenu("Edit")
$ViewMenu = GUICtrlCreateMenu("View")
$BookmarksMenu = GUICtrlCreateMenu("Bookmarks")
$ToolsMenu = GUICtrlCreateMenu("Tools")
$HelpMenu = GUICtrlCreateMenu("Help")
$BackButton = GUICtrlCreateButton("", 1, 1, 30, 30, 0x0080)
    GUICtrlSetImage(-1, "res/back.bmp")
    GUICtrlSetResizing(-1, 32+2+768)
$ForwardButton = GUICtrlCreateButton("", 36, 1, 30, 30, 0x0080)
    GUICtrlSetImage(-1, "res/forward.bmp")
    GUICtrlSetResizing(-1, 32+2+768)
$RefreshStopButton = GUICtrlCreateButton("", 71, 1, 30, 30, 0x0080)
    GUICtrlSetImage(-1, "res/refresh.bmp")
    GUICtrlSetResizing(-1, 32+2+768)
$URLEdit = GUICtrlCreateInput($homepage, 105, 10, 356, 20)
    GUICtrlSetResizing(-1, 32 + 4 + 2 + 512)
    GUICtrlSetCursor(-1, 5)
$go = GUICtrlCreateButton("Go!", 465, 10, 32, 20)
    GUICtrlSetResizing(-1, 512+256+32+4)
$display = GUICreate("test", 487, 415, 5, 40, $WS_CHILD + $WS_BORDER + $WS_EX_MDICHILD, $WS_EX_CLIENTEDGE, $GUI)
$dll = DllOpen("cwebpage.dll")
DllCall($dll, "long", "EmbedBrowserObject", "hwnd", $display)
DllCall($dll, "long", "DisplayHTMLPage", "hwnd", $display, "str", $homepage)
GUISetState(@SW_SHOW, $GUI)
GUISetState(@SW_SHOW, $display)


While 1
    $formatted = 0
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then _exit()
    If $msg = $go Then LoadURLEditPage()    
    
WEnd

Func LoadURLEditPage()
    $URL = GUICtrlRead($URLEdit)
    DllCall($dll, "long", "DisplayHTMLPage", "hwnd", $display, "str", $URL)
    winSetTitle($title, "", getTitle($URL) & " - Vanilla Browser")
    $title = getTitle($homepage) & " - Vanilla Browser"
    #cs
    $alphabet = "abcdefghijklmnopqrstuvwxyz"
    $alphabet = StringSplit($alphabet, "")
    $URL = GUICtrlRead($URLEdit)
    $count = 0
    ;If Not StringInStr($URL, "://") Then
        For $i = 1 to 26
            If StringInStr($URL, $alphabet[$i] & ":") Then
                $count = 1
            EndIf
        Next
    ;EndIf
;   If $count = 1 Then ; Local file

    If StringInStr(GUICtrlRead($URLEdit), "http://") Then ; Web address
        Ping(GUICtrlRead($URLEdit))
        If Not @error Then
            $URLEditPage = INetGet(GUICtrlRead($URLEdit), $TempDir)
            $URLEditPage = FileRead($URLEditPage)
        Else
            $URLEditPage = FileRead(@ScriptDir & "\error.html")
        EndIf
    Else
        If FileExists(GUICtrlRead($URLEdit)) Then
            $URLEditPage = FileRead(GUICtrlRead($URLEdit)) ; Local file
        Else
            $URLEditPage = FormatURL() ; Lazy user ;)
            LoadURLEditPage()
        EndIf
    EndIf
    If FileExists(GUICtrlRead($URLEdit)) Then
        If $formatted = 0 Then $URLEditPage = FileRead(GUICtrlRead($URLEdit))
    Else
        If $formatted = 0 Then $URLEditPage = FormatURL()
        LoadURLEditPage()
    EndIf
    #ce
EndFunc

Func FormatURL()
    If Not StringInStr($URL, "www.") Then $URL = "www." & $URL 
    If Not StringInStr($URL, "http://") Then $URL = "http://" & $URL
    GUICtrlSetData($URLEdit, $URL)
    Return $URL
    $formatted = 1
EndFunc

Func getTitle($url)
    $url = _INetGetSource($url)
    $url = StringSplit($url, "<title>", 1)
    If IsArray($url) and $url[0] >= 2 Then
        $url = StringSplit($url[2], "</title>", 1)
    EndIf
    $char = StringSplit('&amp;|&quot;|&nbsp;|&copy;|&reg|&lt;|&gt;', '|')
    $convert = StringSplit('&|"| |©|®|<|>', '|')
    For $i = 1 To $char[0]
        If StringInStr($url[1], $char[$i]) Then StringReplace($url[1], $char[$i], $convert[$i])
    Next
    StringReplace($url, "&amp;", "&")   
    return $url[1]
EndFunc

Func _exit()
    Exit
EndFunc

Share this post


Link to post
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
Sign in to follow this  
Followers 0