#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") Local $hGUIElement
GUISetState(@SW_SHOW, $hGUI) GUIElement() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE
ExitLoop Case $idbutton_1
EndSwitch WEnd
Func GUIElement() $hGUIElement = GUICreate("Графические элементы", @DesktopWidth,150, 0, 0) Local $idbutton = GUICtrlCreateButton("Кнопка", 0,0, 100, 50) GUISetState(@SW_SHOW, $hGUIElement)
While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($hGUIElement) ExitLoop Case $idbutton msgbox(0,"","кнопка нажата") ControlMove($hGUI , "", $idbutton_1 ,0 ,0, 100, 50)
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
|