Как вывести ГУЙ окошко со своей кнопкой, при нажатии правой кнопки мышки в тексте? Подскажите, пожалуйста.
Хорошо еще, что ГУЙ, а не...
:)
ну это то да, а вопрос открытым остался, я что только не перепробывал, не получается, помогите пожалуйста.
madmasles
14-07-2011, 10:43
при нажатии правой кнопки мышки в тексте »В каком тексте? Где этот текст находится?
Любой текст, просто когда в любом месте окна нажмем правой кнопкой мышки. Так скажем сделать своё меню )
madmasles
14-07-2011, 15:25
Romanka,
Попробуйте так:#NoTrayIcon (http://www.autoitscript.com/autoit3/docs/keywords.htm##notrayicon)
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <WinAPI.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <Misc.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <GuiConstantsEx.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <WindowsConstants.au3>
Opt (http://www.autoitscript.com/autoit3/docs/functions/Opt.htm)('MustDeclareVars', 1)
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) $tStruct, $hHandle, $sClassName, $hWinMenu
$tStruct = DllStructCreate (http://www.autoitscript.com/autoit3/docs/functions/DllStructCreate.htm)($tagPoint)
HotKeySet (http://www.autoitscript.com/autoit3/docs/functions/HotKeySet.htm)('{ESC}', '_Exit')
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) _IsPressed (http://dundats.mvps.org/help/html/libfunctions/_ispressed.htm)('02') Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
_Get_Pos()
$hHandle = _WinAPI_WindowFromPoint (http://dundats.mvps.org/help/html/libfunctions/_winapi_windowfrompoint.htm)($tStruct)
$sClassName = _WinAPI_GetClassName (http://dundats.mvps.org/help/html/libfunctions/_winapi_getclassname.htm)($hHandle)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) StringInStr (http://www.autoitscript.com/autoit3/docs/functions/StringInStr.htm)($sClassName, 'Edit') Or (http://www.autoitscript.com/autoit3/docs/keywords.htm#Or) StringInStr (http://www.autoitscript.com/autoit3/docs/functions/StringInStr.htm)($sClassName, 'Static') Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$hWinMenu = WinGetHandle (http://www.autoitscript.com/autoit3/docs/functions/WinGetHandle.htm)('[CLASS:#32768]')
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $hWinMenu Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) BitAND (http://www.autoitscript.com/autoit3/docs/functions/BitAND.htm)(WinGetState (http://www.autoitscript.com/autoit3/docs/functions/WinGetState.htm)($hWinMenu), 2) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
WinClose (http://www.autoitscript.com/autoit3/docs/functions/WinClose.htm)($hWinMenu)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
_My_GUICreate($hHandle)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Sleep (http://www.autoitscript.com/autoit3/docs/functions/Sleep.htm)(10)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) _Get_Pos()
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($tStruct, 'x', MouseGetPos (http://www.autoitscript.com/autoit3/docs/functions/MouseGetPos.htm)(0))
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($tStruct, 'y', MouseGetPos (http://www.autoitscript.com/autoit3/docs/functions/MouseGetPos.htm)(1))
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc) ;==>_Get_Pos
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) _Exit()
Exit (http://www.autoitscript.com/autoit3/docs/keywords.htm#Exit)
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc) ;==>_Exit
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) _My_GUICreate($h_HWnd)
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#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 (http://www.autoitscript.com/autoit3/docs/functions/MouseGetPos.htm)(0)
$i_Y = MouseGetPos (http://www.autoitscript.com/autoit3/docs/functions/MouseGetPos.htm)(1)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $i_X >= @DesktopWidth (http://www.autoitscript.com/autoit3/docs/macros.htm#@desktopwidth) - $i_W Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$i_X = @DesktopWidth (http://www.autoitscript.com/autoit3/docs/macros.htm#@desktopwidth) - $i_W - 3
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $i_Y >= @DesktopHeight (http://www.autoitscript.com/autoit3/docs/macros.htm#@desktopheight) - $i_H Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$i_Y = @DesktopHeight (http://www.autoitscript.com/autoit3/docs/macros.htm#@desktopheight) - $i_H - 3
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
$h_HWnd = _WinAPI_GetAncestor (http://dundats.mvps.org/help/html/libfunctions/_winapi_getancestor.htm)($h_HWnd, $GA_ROOT)
$h_GUI = GUICreate (http://www.autoitscript.com/autoit3/docs/functions/GUICreate.htm)('My GUI', $i_W, $i_H, $i_X, $i_Y, $WS_POPUP)
GUISetBkColor (http://www.autoitscript.com/autoit3/docs/functions/GUISetBkColor.htm)(0x808080)
$n_Button = GUICtrlCreateButton (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateButton.htm)('Click me', 50, 35, 100, 30)
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)()
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) Not (http://www.autoitscript.com/autoit3/docs/keywords.htm#Not) WinExists (http://www.autoitscript.com/autoit3/docs/functions/WinExists.htm)($h_HWnd) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) ExitLoop (http://www.autoitscript.com/autoit3/docs/keywords.htm#ExitLoop)
WinSetOnTop (http://www.autoitscript.com/autoit3/docs/functions/WinSetOnTop.htm)($h_GUI, '', 1)
$n_Msg = GUIGetMsg (http://www.autoitscript.com/autoit3/docs/functions/GUIGetMsg.htm)()
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) $n_Msg
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $GUI_EVENT_CLOSE
ExitLoop (http://www.autoitscript.com/autoit3/docs/keywords.htm#ExitLoop)
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $n_Button
MsgBox (http://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm)(64, 'Info', 'Button click', 5, $h_GUI)
ExitLoop (http://www.autoitscript.com/autoit3/docs/keywords.htm#ExitLoop)
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
GUIDelete (http://www.autoitscript.com/autoit3/docs/functions/GUIDelete.htm)($h_GUI)
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc) ;==>_My_GUICreate
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.
Available in ZeroNet 1osznRoVratMCN3bFoFpR2pSV5c9z6sTC