Sign in to follow this  
Followers 0
Vindicator209

Keep on top

9 posts in this topic

err... sorry.. in a rush, homework..due..tomorrow...

how do i make a GUI stay on top? ive tried putting:

Winactivate("My Gui"

in the while loop but it makes everything go crazy... ahhh please help me! is there like some kind of directory i can use???


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites



err... sorry.. in a rush, homework..due..tomorrow...

how do i make a GUI stay on top? ive tried putting:

Winactivate("My Gui"

in the while loop but it makes everything go crazy... ahhh please help me! is there like some kind of directory i can use???

Well, while you were in the help file... did you bother to look a bit further down for "OnTop" ... specifically WinSetOnTop?

[center]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.[/center]

Share this post


Link to post
Share on other sites

uhm..err..yea..be right back.....


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

Well, while you were in the help file... did you bother to look a bit further down for "OnTop" ... specifically WinSetOnTop?

What about

$WS_EX_TOPMOST

As the extended property of your GUI?

Share this post


Link to post
Share on other sites

If you wish to change stay on top atribute while running try this:

Global Const $HWND_TOPMOST = -1
Global Const $HWND_NOTOPMOST = -2
Global Const $SWP_NOMOVE = 0x0002
Global Const $SWP_NOSIZE = 0x0001

$Form1 = GUICreate(...)

SetWindowPos($Form1, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_NOMOVE,$SWP_NOSIZE))
SetWindowPos($Form1, $HWND_NOTOPMOST, 0, 0, 0, 0, BitOR($SWP_NOMOVE,$SWP_NOSIZE))

Func SetWindowPos($hwnd, $InsertHwnd, $X, $Y, $cX, $cY, $uFlags)
    $ret = DllCall("user32.dll", "long", "SetWindowPos", "hwnd", $hwnd, "hwnd", $InsertHwnd, _
                    "int", $X, "int", $Y, "int", $cX, "int", $cY, "long", $uFlags)
    Return $ret[0]
EndFunc

Share this post


Link to post
Share on other sites

Hi mate,

I have tried this code it deosn't work for me. I don't know why? I'm looking for that script for long time I mean GUI always on the top.

#include <GuiConstants.au3>

Global Const $HWND_TOPMOST = -1

Global Const $HWND_NOTOPMOST = -2

Global Const $SWP_NOMOVE = 0x0002

Global Const $SWP_NOSIZE = 0x0001

$Form1 =GuiCreate("MyGUI", 702, 316,120, 180 )

SetWindowPos($Form1, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_NOMOVE,$SWP_NOSIZE))

SetWindowPos($Form1, $HWND_NOTOPMOST, 0, 0, 0, 0, BitOR($SWP_NOMOVE,$SWP_NOSIZE))

$Button_1 = GuiCtrlCreateButton("Button1", 30, 80, 100, 50)

$Input_2 = GuiCtrlCreateInput("Input2", 190, 80, 120, 60)

$Date_3 = GuiCtrlCreateDate("Date3", 420, 50, 260, 80)

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case Else

;;;

EndSelect

WEnd

Exit

Func SetWindowPos($hwnd, $InsertHwnd, $X, $Y, $cX, $cY, $uFlags)

$ret = DllCall("user32.dll", "long", "SetWindowPos", "hwnd", $hwnd, "hwnd", $InsertHwnd, _

"int", $X, "int", $Y, "int", $cX, "int", $cY, "long", $uFlags)

Return $ret[0]EndFunc

Share this post


Link to post
Share on other sites

Hi mate,

I have tried this code it deosn't work for me. I don't know why? I'm looking for that script for long time I mean GUI always on the top.

Hey man!!

You must call these functions:

SetWindowPos($Form1, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_NOMOVE,$SWP_NOSIZE))
SetWindowPos($Form1, $HWND_NOTOPMOST, 0, 0, 0, 0, BitOR($SWP_NOMOVE,$SWP_NOSIZE))

from some buttons or menu items, first or second one. My code was only code snippet!

If you don't understand this then it's not for you.

Share this post


Link to post
Share on other sites

Hey man!!

You must call these functions:

SetWindowPos($Form1, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_NOMOVE,$SWP_NOSIZE))
SetWindowPos($Form1, $HWND_NOTOPMOST, 0, 0, 0, 0, BitOR($SWP_NOMOVE,$SWP_NOSIZE))

from some buttons or menu items, first or second one. My code was only code snippet!

If you don't understand this then it's not for you.

Ahhhha

I got it now sorry about that. I was stupid, sorry agian

Share this post


Link to post
Share on other sites

Homework? How is AutoIt part of homework?

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