MrCreatoR Posted July 27, 2007 Share Posted July 27, 2007 Hi all, i am trying to make an GUI that will have ability to be moved by any place accept the controls...I founded on this forum the ultimate solution for it (Using GuiRegistrMsg with WM_NCHITTEST msg), but it seems that there is one problem - if i want to close the gui or use Menus in my Gui or even resize the gui - thats not working Here is example with this limitation:Global Const $WM_NCHITTEST = 0x0084 Global $GUI = GuiCreate("Drag using any place on GUI - Demo") $Menu = GUICtrlCreateMenu("Test Menu") GUICtrlCreateMenuItem("Item", $Menu) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 Exit Case Else EndSwitch WEnd Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If $hWnd = $GUI And $iMsg = $WM_NCHITTEST Then Return 2 EndFuncoÝ÷ Ø'£ajØj{(÷+)®åzk¬x-êÞ+-û§rX¤zØb±«¢+ÙÕ¹]5}9 !%QQMP ÀÌØí¡]¹°ÀÌØí¥5Í°ÀÌØí¥ÝAÉ´°ÀÌØí¥±AÉ´¤(%1½°ÀÌØíeA½Ìô5½ÕÍÑA½Ì Ĥ(%1½°ÀÌØí]¥¹A½Ìô]¥¹ÑA½Ì ÀÌØí¡]¹¤(%%ÀÌØí¡]¹ôÀÌØíU$¹ÀÌØí¥5ÍôÀÌØí]5}9 !%QQMP¹ÀÌØíeA½ÌÐìÀÌØí]¥¹A½ÍlÅt¬ÌÔQ¡¸IÑÕɸÈ)¹Õ¹But maybe there is more reliable way? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
ValeryVal Posted July 27, 2007 Share Posted July 27, 2007 There is more common solution of it.See script here, pleaseValery The point of world view Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 28, 2007 Author Share Posted July 28, 2007 Thanks, but i am already mentioned that... I know that i can solve this problem using the registr func like this: The WinGetClientSize() is usefull, but not for resizing And for the resizing: Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) Local $MousePos = MouseGetPos() Local $WinPos = WinGetPos($hWnd) If $hWnd = $GUI And $iMsg = 0x0084 And $MousePos[1] > $WinPos[1]+35 And $MousePos[0] > $WinPos[0]+5 And _ $MousePos[0]+5 < $WinPos[0]+$WinPos[2] And $MousePos[1]+5 < $WinPos[1]+$WinPos[3] Then Return 2 EndFunc But i am looking for more practical solution. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
martin Posted July 28, 2007 Share Posted July 28, 2007 Thanks, but i am already mentioned that... The WinGetClientSize() is usefull, but not for resizing And for the resizing: expandcollapse popupFunc WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) Local $MousePos = MouseGetPos() Local $WinPos = WinGetPos($hWnd) If $hWnd = $GUI And $iMsg = 0x0084 And $MousePos[1] > $WinPos[1]+35 And $MousePos[0] > $WinPos[0]+5 And _ $MousePos[0]+5 < $WinPos[0]+$WinPos[2] And $MousePos[1]+5 < $WinPos[1]+$WinPos[3] Then Return 2 EndFuncoÝ÷ Ø©¥¢"è®j+zÚrØj[(ëb¢êº^êÞßÛ«az»§¶'rÁ¬¡Ú"·¶0Ð!4ÄI #include <GUIConstants.au3> Opt("MouseCoordMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1d", 633, 447, 193, 115, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS)) $Menu = GUICtrlCreateMenu("Test Menu") $mit = GUICtrlCreateMenuItem("Item", $Menu) $Button1 = GUICtrlCreateButton("Button1", 216, 72, 75, 25, 0) $Label = GUICtrlCreateLabel("Button2", 256, 184, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $dragging = False $labelset = 3 Const $WM_EXITSIZEMOVE = 0x0232, $WM_ENTERSIZEMOVE = 0x0231 GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE") $stopdrag = 0 While 1 $nMsg = GUIGetMsg(1) Switch $nMsg[0] Case $GUI_EVENT_CLOSE Exit Case $mit ;something $stopdrag = 1;don't want the selction of a menu item to start dragging Case $GUI_EVENT_PRIMARYDOWN If $stopdrag = 0 Then ;ignore this button down $Info = GUIGetCursorInfo(WinGetHandle("Form1d")) If $Info[4] = 0 Then $wp1 = WinGetPos("Form1d") $mp1 = MouseGetPos() $dragging = True EndIf Else $stopdrag = 0 EndIf Case $GUI_EVENT_PRIMARYUP $dragging = False Case $Button1 ;something EndSwitch If $dragging And $stopdrag = 0 Then if $labelset <> 1 Then guictrlsetdata($label,"dragging") $labelset = 1 $mp = MouseGetPos() WinMove("Form1d", "", $wp1[0] - $mp1[0] + $mp[0], $wp1[1] - $mp1[1] + $mp[1]) Else if $labelset <> 2 then guictrlsetdata($label,"no drag") $Labelset = 2 $wp1 = WinGetPos("Form1d") $mp1 = MouseGetPos() EndIf WEnd Func wm_entersizemove() $stopdrag = 1;or else might not stop dragging EndFunc ;==>wm_entersizemove Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 28, 2007 Author Share Posted July 28, 2007 martinHere i have made such manual "draging system" (the credit is not all mine) - but i need something else (in this case i am not mind that script will paused while draging the gui ), i want use WM_NCHITTEST or something similar, that it will be practical. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
martin Posted July 29, 2007 Share Posted July 29, 2007 martin Here i have made such manual "draging system" (the credit is not all mine) - but i need something else (in this case i am not mind that script will paused while draging the gui ), i want use WM_NCHITTEST or something similar, that it will be practical. I think this might do it. Sorry it's a bit messy but just something to test. expandcollapse popupGlobal Const $WM_NCHITTEST = 0x0084 Global $GUI = GuiCreate("Drag using any place on GUI - Demo") $lab = GUICtrlCreateLabel("aaaaa",50,50,120,28) $but = GUICtrlCreateButton("nnnn",50,130,120,28) $Menu = GUICtrlCreateMenu("Test Menu") GUICtrlCreateMenuItem("Item", $Menu) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 Exit Case Else EndSwitch WEnd Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If $hWnd = $GUI And $iMsg = $WM_NCHITTEST Then $id = _API_DefWindowProc($hWnd, $iMsg, $iwParam, $ilParam) GUICtrlSetData($lab,$id) If $id = 1 Then;if it is the client handle Return 2 ;return the title handle Else Return $id;return the real handle EndIf EndIf EndFunc Func _API_DefWindowProc($hWnd, $iMsg, $iwParam, $ilParam) Local $aResult $aResult = DllCall("User32.dll", "int", "DefWindowProc", "hwnd", $hWnd, "int", $iMsg, "int", $iwParam, "int", $ilParam) Return $aResult[0] EndFunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 29, 2007 Author Share Posted July 29, 2007 Thanks martin! this is what i am talking about!Thanks a lot, this is what i needed! Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team 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