Jump to content
Sign in to follow this  
zFrank

WinMove and GUIcreate question

Recommended Posts

zFrank

1- how can i make my GUI non moveable?

diffrent pc's have different screen resulation so...

2- how can i move a window in centre?

3- how can i create a Gui in centre?

thanks in advance for help!


[font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php
$Life = "Happy"
If @Error Then
$Life = "Risk"

Share this post


Link to post
Share on other sites
d4rk

i don't remember exactly but maybe it's

@DesktopHeight/2

@DesktopWidth/2


[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites
d4rk

That's the answer for 2 and 3, the word CENTER

and as i said, i don't remember exactly, so search or figure it yourself


[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites
JustinMeyer

1 Not sure how to make the GUI non movable, could try making a gui and disable it then put your controls on a child gui.

2 To move a window to the center I have used "WinGetPos" to get the width and height and subtract them from @desktopwidth and @desktopheight and divide by 2

3 and to create a GUI in the center use -1 for the X and Y positions


Share this post


Link to post
Share on other sites
d4rk

1st

not a smart solution but at least it can work

$Size = WinGetPos("[active]")
$X= $size[0]
$Y= $size[1] 
While 1
Sleep(1000)
$SizeNew=WinGetPos("[active]")
if $SizeNew[0]<>$X or $SizeNew[1]<>$Y then
WinMove("[active]",$X,$Y)
endif
Wend
Edited by d4rk

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites
d3mon

Q.1,2,3 For center you can use @DesktopWidth/2 and @DesktopHeight/2

GuiCreate("GUI",500,500,@DesktopWidth/2,@DesktopHeight/2)
GuiSetState()

While 1
Sleep(10)
$pos = WinGetPos("GUI")
If $pos[0]<>@DesktopWidth/2 or $pos[1]<> @DesktopHeight/2 Then
WinMove("GUI","",@DesktopWidth/2,@DesktopHeight/2)
Endif
WendoÝ÷ Û*.q©î±íZÝZºÚ"µÍÝZPÜX]J   ][ÝÑÕRI][ÝË
L
LLKLJBÝZTÙ]Ý]J
BÚ[HBÛY
L
BÌÍÜÜÈHÚ[Ù]ÜÊ  ][ÝÑÕRI][ÝÊBY  ÌÍÜÜÖÌIÉÝËLHÜ ÌÍÜÜÖÌWIÉÝËLH[Ú[[ÝJ  ][ÝÑÕRI][ÝË    ][ÝÉ][ÝËLKLJB[YÙ[

No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE

Share this post


Link to post
Share on other sites
ProgAndy

Window not moveable:

CODE
#include <GuiConstants.au3>

#include <WindowsConstants.au3>

$hGui = GUICreate("Test", 300, 200)

; No MOVE

GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST"); 1.1) Disable Move by titlebar

Global $GLOBAL_WINPOS = WinGetPos($hGui) ; Save Variable for 2)

AdlibEnable("_SaveWinPos",100) ; 2.1) Disable Move by WinMove Or taskbar-> Move Window

; EndNo Move

GUISetState()

Do

Until GUIGetMsg() = -3

; 2.2) Disable Move by WinMove Or taskbar-> Move Window

Func _SaveWinPos()

Local $x = WinGetPos($hGui)

If $x[0] <> $GLOBAL_WINPOS[0] Or _

$x[1] <> $GLOBAL_WINPOS[1] Or _

$x[2] <> $GLOBAL_WINPOS[2] Or _

$x[3] <> $GLOBAL_WINPOS[3] Then

WinMove($hGui,"",$GLOBAL_WINPOS[0],$GLOBAL_WINPOS[1],$GLOBAL_WINPOS[2],$GLOBAL_WINPOS[3])

EndIf

EndFunc

; 1.2) Disable Move by titlebar

Func WM_NCHITTEST($hWnd, $Msg, $wParam, $lParam)

Local $iProc

$iProc = DllCall("user32.dll", "int", "DefWindowProc", "hwnd", $hWnd, "int", $Msg, "wparam", $wParam, "lparam", $lParam)

$iProc = $iProc[0]

If $iProc = $HTCAPTION Then Return 0

Return $GUI_RUNDEFMSG

EndFunc

Real center:

GuiCreate("GUI",500,500,@DesktopWidth/2,@DesktopHeight/2)
GuiSetState()

While 1
Sleep(10)
$pos = WinGetPos("GUI")
If $pos[0]<>Int((@DesktopWidth-$pos[2])/2) or $pos[1]<> Int((@DesktopHeight-$pos[3])/2) Then
WinMove("GUI","",Int((@DesktopWidth-$pos[2])/2),Int((@DesktopHeight-$pos[3])/2))
Endif
Wend
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.