Jump to content

Keep on top


 Share

Recommended Posts

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]

Link to comment
Share on other sites

  • Moderators

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?

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

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]

Link to comment
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
Link to comment
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

Link to comment
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.

Link to comment
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

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