В итоге у меня получился технический облом! #include #include Global Const $MK_LBUTTON = 0x1 Global $hGUI = GUICreate("Новая форма", @DesktopWidth-250, 500,0,250) Global $idbutton_1 = GUICtrlCreateButton("Новая Кнопка", @DesktopWidth,@DesktopHeight, 100, 50) Global $click_button = 0 Global $aPos = [0,0] GUIRegisterMsg(0x0201, "WM_LBUTTONDOWN") Global $hGUIElement Global $GUISelect GUISetState(@SW_SHOW, $hGUI)
GUIElement() GUISelect() While 1 $msg1 = GUIGetMsg() Switch $msg1 Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch WEnd
Func GUIElement() $hGUIElement = GUICreate("Графические элементы", @DesktopWidth,150, 0, 0) Local $idbutton = GUICtrlCreateButton("Кнопка", 0,0, 100, 50) GUISetState(@SW_SHOW, $hGUIElement)
While 1 $msg2 = GUIGetMsg() Switch $msg2 Case $GUI_EVENT_CLOSE GUIDelete($hGUIElement) ExitLoop Case $idbutton msgbox(0,"","кнопка нажата") ControlMove($hGUI , "", $idbutton_1 ,0 ,0, 100, 50)
EndSwitch WEnd
EndFunc
Func GUISelect() Local $GUISelect = GUICreate("Выбор элемента", 150,150, 500, 550)
GUISetState(@SW_SHOW, $GUISelect )
While 1 $msg3 = GUIGetMsg() Switch $msg3 Case $GUI_EVENT_CLOSE GUIDelete($GUISelect) ExitLoop EndSwitch WEnd
EndFunc
Func WM_LBUTTONDOWN($hWnd, $MsgId, $wParam, $lParam) If $wParam = $MK_LBUTTON Then $x= BitAND($lParam, 0xFFFF) ; _WinAPI_LoWord $y = BitShift($lParam, 16) ; _WinAPI_HiWord ControlMove($hGUI , "", $idbutton_1 ,$x, $y, 100, 50) EndIf EndFunc
|