Romanka,
Попробуйте так:
Код:
#NoTrayIcon
#include <WinAPI.au3>
#include <Misc.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Global $tStruct, $hHandle, $sClassName, $hWinMenu
$tStruct = DllStructCreate($tagPoint)
HotKeySet('{ESC}', '_Exit')
While 1
If _IsPressed('02') Then
_Get_Pos()
$hHandle = _WinAPI_WindowFromPoint($tStruct)
$sClassName = _WinAPI_GetClassName($hHandle)
If StringInStr($sClassName, 'Edit') Or StringInStr($sClassName, 'Static') Then
$hWinMenu = WinGetHandle('[CLASS:#32768]')
If $hWinMenu Then
If BitAND(WinGetState($hWinMenu), 2) Then
WinClose($hWinMenu)
EndIf
EndIf
_My_GUICreate($hHandle)
EndIf
EndIf
Sleep(10)
WEnd
Func _Get_Pos()
DllStructSetData($tStruct, 'x', MouseGetPos(0))
DllStructSetData($tStruct, 'y', MouseGetPos(1))
EndFunc ;==>_Get_Pos
Func _Exit()
Exit
EndFunc ;==>_Exit
Func _My_GUICreate($h_HWnd)
Local $h_GUI, $n_Button, $n_Msg, $i_X, $i_X_Rotate, $i_Y, $i_Y_Rotate, $i_W = 200, $i_H = 100
$i_X = MouseGetPos(0)
$i_Y = MouseGetPos(1)
If $i_X >= @DesktopWidth - $i_W Then
$i_X = @DesktopWidth - $i_W - 3
EndIf
If $i_Y >= @DesktopHeight - $i_H Then
$i_Y = @DesktopHeight - $i_H - 3
EndIf
$h_HWnd = _WinAPI_GetAncestor($h_HWnd, $GA_ROOT)
$h_GUI = GUICreate('My GUI', $i_W, $i_H, $i_X, $i_Y, $WS_POPUP)
GUISetBkColor(0x808080)
$n_Button = GUICtrlCreateButton('Click me', 50, 35, 100, 30)
GUISetState()
While 1
If Not WinExists($h_HWnd) Then ExitLoop
WinSetOnTop($h_GUI, '', 1)
$n_Msg = GUIGetMsg()
Switch $n_Msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $n_Button
MsgBox(64, 'Info', 'Button click', 5, $h_GUI)
ExitLoop
EndSwitch
WEnd
GUIDelete($h_GUI)
EndFunc ;==>_My_GUICreate
|