Sign in to follow this  
Followers 0
James

"Stick" a window

13 posts in this topic

Hey all,

I am trying to make a window stick to another window.

Example, I open the run box and another program sticks directly on to it, so if I move he window on top the run box moves with it. I thought SetParent would do this, but it didn't.

Thanks,

James

Share this post


Link to post
Share on other sites



#include <guiconstants.au3>

GUICreate ("Test" , 150 , 80)
$exit = GUICtrlCreateButton ("Exit" , 20 , 30 ,100,25)
GUISetState ()
While 1
    $a = WinGetPos ("Untitled - Notepad","")
    WinMove ("Test" ,"" , $a[0],$a[1],150,80,3)
    $msg = GUIGetMsg ()
    Select
        Case $msg = $exit
            Exit
    EndSelect
WEnd

I don't know if this can help


[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites
#include <guiconstants.au3>

GUICreate ("Test" , 150 , 80)
$exit = GUICtrlCreateButton ("Exit" , 20 , 30 ,100,25)
GUISetState ()
While 1
    $a = WinGetPos ("Untitled - Notepad","")
    WinMove ("Test" ,"" , $a[0],$a[1],150,80,3)
    $msg = GUIGetMsg ()
    Select
        Case $msg = $exit
            Exit
    EndSelect
WEndoÝ÷ Øhmz0ûaÇ¥§ú®¢×zY]¢wj¸¶*'m«vßÊ«{¦¦WºÚ"µÍÚ[ÛYH  ÙÝZXÛÛÝ[Ë]LÉÝÂÌÍÙÝZLHHÕRPÜX]H
    ][ÝÙÝZLI][ÝÈMLLKLJBÌÍÙ^]HÕRPÝÜX]P]Û
    ][ÝÑ^]    ][ÝÈÌLJBÕRTÙ]Ý]H

BÌÍØHHÚ[Ù]ÜÈ
    ÌÍÙÝZLJBÌÍÙÝZLHÕRPÜX]H
    ][ÝÙÝZL][ÝÈML  ÌÍØVÌKLML   ÌÍØVÌWJBÕRTÙ]Ý]H

BÚ[HBIÌÍØHHÚ[Ù]ÜÈ
    ÌÍÙÝZLJBUÚ[[ÝH
    ÌÍÙÝZL  ][ÝÉ][ÝÈ    ÌÍØVÌKLML   ÌÍØVÌWKMLJBIÌÍÛÙÈHÕRQÙ]ÙÈ

BÙ[XÝØÙH    ÌÍÛÙÈH ÌÍÙ^]^]BPØÙH   ÌÍÛÙÈH ÌÍÑÕRWÑUSÐÓÔÑHBBQ^]Q[Ù[XÝÑ[

Share this post


Link to post
Share on other sites

Unfortunatley it can't "stick" or "clip" in realtime. I tried it this way aswell :)

Ya', I'm trying. I'm sure you'll have to use things I'm not willing to try (GUIRegisterMsg - _SendMessage). Good luck!

Share this post


Link to post
Share on other sites

How does this go??

#include <GuiconstantsEx.au3>
Global Const $WM_EXIT_SIZE_MOVE = 0x0232

$gui1 = GUICreate ("gui1" , 150 , 80, -1, -1)
$exit = GUICtrlCreateButton ("Exit" , 20 , 30 ,100,25)
GUISetState ()
$a = WinGetPos ($gui1)
$gui2 = GUICreate ("gui2" , 150 , 80, $a[0]-150, $a[1])
GUISetState ()

GUIRegisterMsg ($WM_EXIT_SIZE_MOVE, "Move")
While 1
    $msg = GUIGetMsg ()
    Select
        Case $msg = $exit
            Exit
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Func Move ($hWnd, $Msg, $wParam, $lParam)
    If $hWnd <> $gui1 Then
        $get = WinGetPos ($gui2)
        $size = WinGetClientSize ($gui2)
        $size2 = WinGetClientSize ($gui1)
        WinMove ($gui1, "", $get[0]+$size[0], $get[1])
    Else 
        $get = WinGetPos ($gui1)
        $size = WinGetClientSize ($gui1)
        $size2 = WinGetClientSize ($gui2)
        WinMove ($gui2, "", $get[0]-$size[0], $get[1])
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

How does this go??

#include <GuiconstantsEx.au3>
Global Const $WM_EXIT_SIZE_MOVE = 0x0232

$gui1 = GUICreate ("gui1" , 150 , 80, -1, -1)
$exit = GUICtrlCreateButton ("Exit" , 20 , 30 ,100,25)
GUISetState ()
$a = WinGetPos ($gui1)
$gui2 = GUICreate ("gui2" , 150 , 80, $a[0]-150, $a[1])
GUISetState ()

GUIRegisterMsg ($WM_EXIT_SIZE_MOVE, "Move")
While 1
    $msg = GUIGetMsg ()
    Select
        Case $msg = $exit
            Exit
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Func Move ($hWnd, $Msg, $wParam, $lParam)
    If $hWnd <> $gui1 Then
        $get = WinGetPos ($gui2)
        $size = WinGetClientSize ($gui2)
        $size2 = WinGetClientSize ($gui1)
        WinMove ($gui1, "", $get[0]+$size[0], $get[1])
    Else 
        $get = WinGetPos ($gui1)
        $size = WinGetClientSize ($gui1)
        $size2 = WinGetClientSize ($gui2)
        WinMove ($gui2, "", $get[0]-$size[0], $get[1])
    EndIf
EndFunc
I like how both windows eventually "stick" to one another... but,

still not real-time.

Share this post


Link to post
Share on other sites

How about...

#include <GuiconstantsEx.au3>
Global Const $WM_MOVE = 0x0003

$gui1 = GUICreate ("gui1" , 150 , 80, -1, -1)
$exit = GUICtrlCreateButton ("Exit" , 20 , 30 ,100,25)
GUISetState ()
$a = WinGetPos ($gui1)
$gui2 = GUICreate ("gui2" , 150 , 80, $a[0]-150, $a[1])
GUISetState ()

GUIRegisterMsg ($WM_MOVE, "Move")
While 1
    $msg = GUIGetMsg ()
    Select
        Case $msg = $exit
            Exit
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Func Move ($hWnd, $Msg, $wParam, $lParam)
    If $hWnd <> $gui1 Then
        $get = WinGetPos ($gui2)
        $size = WinGetClientSize ($gui2)
        $size2 = WinGetClientSize ($gui1)
        WinMove ($gui1, "", $get[0]+$size[0], $get[1])
    Else
        $get = WinGetPos ($gui1)
        $size = WinGetClientSize ($gui1)
        $size2 = WinGetClientSize ($gui2)
        WinMove ($gui2, "", $get[0]-$size[0], $get[1])
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

How about...

ooo u made it before me I was making some tea while u posted u're nice job

nice job !!!


[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

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