从控件上屏蔽右键
#include <IE.au3>
#include <Winapi.au3>
#include <GUIConstantsEx.au3>
Global Const $WM_RBUTTONDOWN = 0x0204
$oIE = _IECreateEmbedded()
$gui1 = GUICreate("test", 1200, 800)
GUISetState(@SW_SHOW)
$bb = GUICtrlCreateObj($oIE, 10, 10, 1000, 790)
_IENavigate($oIE, "http://www.baidu.com")
$handle = ControlGetHandle($gui1,"","Internet Explorer_Server1")
$wProcOld = GUIRegisterMsgEx($handle, "_MyWindowProc") ;控件子类化
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete($gui1)
Exit
EndSwitch
WEnd
Func GUIRegisterMsgEx($ctrID, $funcName) ;控件id,函数名
Local $wProcNew = DllCallbackRegister($funcName, "ptr", "hwnd;uint;long;ptr")
Local $wProcOld = _WinAPI_SetWindowLong($ctrID, $GWL_WNDPROC, DllCallbackGetPtr($wProcNew))
Return $wProcOld
EndFunc ;==>GUIRegisterMsgEx
Func _MyWindowProc($hWnd, $uiMsg, $wParam, $lParam)
Switch $uiMsg
Case $WM_RBUTTONDOWN
Return 1 ;屏蔽右键
EndSwitch
;向默认窗口进程传递未处理过的消息
Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $uiMsg, $wParam, $lParam)
EndFunc ;==>_MyWindowProc
|