Jump to content

Can't figure out why this doesn't work.


Recommended Posts

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
$size1 = 392
$size2 = 316
$i = 1
GuiCreate("MyGUI", $size1, $size2, (@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Button_1 = GuiCtrlCreateButton("Resize", 150, 120, 90, 50)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        Do
            WinMove("MyGUI", "", (@DesktopWidth-392)/2, (@DesktopHeight-316)/2, $size1 + 1, $size2 + 1)
            $i = $i + 1
        Until $i = 20
    EndSelect
WEnd
Exit

It is supposed to slowly get bigger, but stay in the same place.

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

  • Moderators

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
$size1 = 392
$size2 = 316
$i = 1
GuiCreate("MyGUI", $size1, $size2, (@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Button_1 = GuiCtrlCreateButton("Resize", 150, 120, 90, 50)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        Do
            WinMove("MyGUI", "", (@DesktopWidth-392)/2, (@DesktopHeight-316)/2, $size1 + 1, $size2 + 1)
            $i = $i + 1
        Until $i = 20
    EndSelect
WEnd
Exit

It is supposed to slowly get bigger, but stay in the same place.

Remove this line:

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

SciTe will tell you the error.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

It works, thanks.

But the function for button1 deosn't work, it is supposed to make it slowly get bigger.

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

  • Moderators

Not an exact fix... but just changed your code a tad

#include <GuiConstants.au3>
Local $size1 = 392, $size2 = 316, $i = 1
$MyGui = GuiCreate("MyGUI", $size1, $size2, (@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Button_1 = GuiCtrlCreateButton("Resize", 150, 120, 90, 50)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        Do
            WinMove($MyGui, "", (@DesktopWidth-392)/2, (@DesktopHeight-316)/2, $size1 + $i, $size2 + $i)
            Sleep(50)
            $i = $i + 1
        Until $i = 20
        $size1 = $size1 + $i
        $size2 = $size2 + $i
        $i = 1
    EndSelect
WEnd

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Hi,

works as you did it for me.

#include <GuiConstants.au3>

;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
$size1 = 392
$size2 = 316
$i = 1
GuiCreate("MyGUI", $size1, $size2, (@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Button_1 = GuiCtrlCreateButton("Resize", 150, 120, 90, 50)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        Do
            WinMove("MyGUI", "", (@DesktopWidth-392)/2, (@DesktopHeight-316)/2, $size1 + 150, $size2 + 150)
            $i = $i + 1
            ConsoleWrite($i)
        Until $i = 20
        $i=0
    EndSelect
WEnd
Exit

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Not an exact fix... but just changed your code a tad

#include <GuiConstants.au3>
Local $size1 = 392, $size2 = 316, $i = 1
$MyGui = GuiCreate("MyGUI", $size1, $size2, (@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Button_1 = GuiCtrlCreateButton("Resize", 150, 120, 90, 50)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        Do
            WinMove($MyGui, "", (@DesktopWidth-392)/2, (@DesktopHeight-316)/2, $size1 + $i, $size2 + $i)
            Sleep(50)
            $i = $i + 1
        Until $i = 20
        $size1 = $size1 + $i
        $size2 = $size2 + $i
        $i = 1
    EndSelect
WEnd
Thanks, that's what I wanted!

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

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...