Enforcer Posted October 5, 2009 Share Posted October 5, 2009 Hi All. I made window like this one: $shirina = 520 $visota = 387 $FORM1= GUICreate("Form1", $shirina, $visota, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS),2) And right now i need to move it... By a mouse like other normal windows, i made a simple script but its still works bad and not correct, maybe someone know hot to fix this or other method to move this kind of window ?... FULL SCRIPT: expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiImageList.au3> #include <ImageListConstants.au3> #include <Misc.au3> #include <GDIPlus.au3> #include <WinAPI.au3> #Region ### START Koda GUI section ### Form=Form1.kxf $shirina = 520 $visota = 387 $FORM1= GUICreate("Form1", $shirina, $visota, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS),2) $SKIN = GUICtrlCreatePic("win.bmp", 0, 0, 520, 387) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $dll = DllOpen("user32.dll") Local $coords[4] While 1 ;ПОЛУЧАЕМ КООРДИНАТЫ ОКНА и КУРСОРА $pos = MouseGetPos() $winpos = WinGetPos($form1) ;ЕСЛИ НЕ НАЖАТА КЛАВИША И МЫ В ОКНЕ ТО ПОЛУЧАЕМ КООРДИНАТЫ НАШЕЙ МЫШКИ if not _IsPressed("01", $dll) and $pos[0] > $winpos[0] and $pos[0] < $winpos[0] + $shirina And $pos[1] > $winpos[1] and $pos[1] < $winpos[1] + $visota then $xz=$pos[0]-$winpos[0] $yz=$pos[1]-$winpos[1] ;_MouseTrap() endif ;ЕСЛИ МЫШКА НАЖАТА И ОКНО АКТИВНО И МЫ В ОКНЕ ТО РАЗРЕШИТЬ ДВИГАТЬ if _IsPressed("01", $dll) and WinActive($FORM1) and $pos[0] > $winpos[0] and $pos[0] < $winpos[0] + $shirina And $pos[1] > $winpos[1] and $pos[1] < $winpos[1] + $visota Then ; _MouseTrap($winpos[0], $winpos[1], $winpos[0] + $winpos[2], $winpos[1] + $winpos[3]) WinMove($form1, "", $pos[0]-$xz, $pos[1]-$yz) endif ;БАГ ЕСЛИ МЫ ДВИГАЕМ БЫСТРО МЫШКОЙ То ОНА ПОЛЮБОМУ ВЫСКАКИВАЕТ ЗА ОКНО, ;ДЛЯ ЭТОГО НАДО ПРОВЕРИТЬ В МОМЕНТ НАЖАТИЯ ГДЕ МЫ А ПОТОМ РАЗРЕШИТЬ ВСЁ ДЕЛАТЬ... ; KNOWN BUGS: IF WE TRYING TO MOVE WINDOW VERRY FAST SOMETIMES ITS JUST STOP MOVING... ;MAYBE SOMEONE KNOW'S BETTER WAYS TO MOVE THAT KIND OF WINDOWS CORRECT... !? $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd DllClose($dll)win.rar [RU] Zone Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 5, 2009 Moderators Share Posted October 5, 2009 Enforcer, Here you go: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiImageList.au3> #include <ImageListConstants.au3> #include <Misc.au3> #include <GDIPlus.au3> #include <WinAPI.au3> #Region ### START Koda GUI section ### Form=Form1.kxf $shirina = 520 $visota = 387 $FORM1= GUICreate("Form1", $shirina, $visota, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS),2) $SKIN = GUICtrlCreatePic("win.bmp", 0, 0, 520, 387) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;$dll = DllOpen("user32.dll") ;Local $coords[4] While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN ; <<<<<<<<<<<<<<<<<<<<<<<<<<< Added _SendMessage($FORM1, $WM_SYSCOMMAND, 0xF012, 0) ; <<< Added EndSwitch WEnd ;DllClose($dll) M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Enforcer Posted October 8, 2009 Author Share Posted October 8, 2009 Thx for reply, but I already solved this broblem, I'l post my working script later, BUT BiG THX Eny way =) [RU] Zone Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now