Jump to content



Photo

Problem while moving the popup GUI


  • Please log in to reply
1 reply to this topic

#1 MrVietA2

MrVietA2

    Adventurer

  • Active Members
  • PipPip
  • 103 posts

Posted 07 July 2012 - 04:35 AM

Hi everyone,
I have problem with this code :
AutoIt         
#include #include #include #include Opt("GUIOnEventMode", 1) Global $Width = 322, $Height = 183, $mWidth = 259, $mHeight = 106, $Title = "Main GUI" _Main() Func _Main() Global $GUI = GUICreate($Title, $Width, $Height, -1, -1, -1) Global $Show = GUICtrlCreateButton("Show multi GUI", 88, 64, 131, 57) GUISetState(@SW_SHOW) GUICtrlSetOnEvent($Show , "MultiGUI") GUISetOnEvent($GUI_EVENT_CLOSE , "Exit1") GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "On_Drag1") EndFunc Func MultiGUI() $Pos = WinGetPos($Title, "") ; If @DesktopWidth - ($Pos[0] + $Width) < $mWidth Then $mLeft = $Pos[0] - $mWidth - 40 ElseIf $Pos[0] < $mWidth Then $mLeft = $Pos[0] + $Width + 40 Else $mLeft = $Pos[0] + $Width + 40 EndIf ; GUISetState(@SW_DISABLE, $GUI) Global $mGUI = GUICreate("Multi GUI", $mWidth, $mHeight, $mLeft, $Pos[1], BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX), $WS_EX_OVERLAPPEDWINDOW, $GUI) GUISetState(@SW_SHOW, $mGUI) GUISetOnEvent($GUI_EVENT_CLOSE , "Exit2") GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "On_Drag2") EndFunc Func On_Drag1() Const $SC_DRAGMOVE = 0xF012 _SendMessage($GUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc Func On_Drag2() Const $SC_DRAGMOVE = 0xF012 _SendMessage($mGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc

When multi GUI is opened, I click anywhere on main GUI, it also move multi GUI.
I can't find the way, can you tell me the solutions? Thank you

Edited by MrVietA2, 07 July 2012 - 04:36 AM.






#2 AZJIO

AZJIO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 996 posts

Posted 07 July 2012 - 05:26 AM

Plain Text         
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> Opt("GUIOnEventMode", 1) Global $Width = 322, $Height = 183, $mWidth = 259, $mHeight = 106, $Title = "Main GUI", $hGUI1, $hGUI2, $iShow _Main() Func _Main()     $hGUI1 = GUICreate($Title, $Width, $Height)     GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")     GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "_On_Drag1")     $iShow = GUICtrlCreateButton("Show multi GUI", 88, 64, 131, 57)     GUICtrlSetOnEvent(-1, "MultiGUI")     GUISetState()     While 1         Sleep(1000)     WEnd EndFunc Func MultiGUI()     Local $mLeft, $Pos     $Pos = WinGetPos($Title)     If @DesktopWidth - ($Pos[0] + $Width) < $mWidth Then         $mLeft = $Pos[0] - $mWidth - 40     ElseIf $Pos[0] < $mWidth Then         $mLeft = $Pos[0] + $Width + 40     Else         $mLeft = $Pos[0] + $Width + 40     EndIf     GUISetState(@SW_DISABLE, $hGUI1)     $hGUI2 = GUICreate("Multi GUI", $mWidth, $mHeight, $mLeft, $Pos[1], BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX), $WS_EX_OVERLAPPEDWINDOW, $hGUI1)     GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit2")     GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "_On_Drag2")     GUISetState(@SW_SHOW, $hGUI2) EndFunc Func _On_Drag1()     Local Const $SC_DRAGMOVE = 0xF012     _SendMessage($hGUI1, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc Func _On_Drag2()     Local Const $SC_DRAGMOVE = 0xF012     _SendMessage($hGUI2, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc Func _Exit()     Exit EndFunc Func _Exit2()     GUISetState(@SW_ENABLE, $hGUI1)     GUIDelete($hGUI2) EndFunc





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users