HwndSource.AddHook(HwndSourceHook) 方法

定義

加入接收所有視窗訊息的事件處理常式。

public:
 void AddHook(System::Windows::Interop::HwndSourceHook ^ hook);
[System.Security.SecurityCritical]
public void AddHook (System.Windows.Interop.HwndSourceHook hook);
public void AddHook (System.Windows.Interop.HwndSourceHook hook);
[<System.Security.SecurityCritical>]
member this.AddHook : System.Windows.Interop.HwndSourceHook -> unit
member this.AddHook : System.Windows.Interop.HwndSourceHook -> unit
Public Sub AddHook (hook As HwndSourceHook)

參數

hook
HwndSourceHook

接收視窗訊息的處理常式實作 (依據 HwndSourceHook 委派)。

屬性

備註

重要

這個方法無法在網際網路安全性區域中使用。

大部分到達 的 HwndSource Win32 訊息都具有近似的 WPF 對等專案。 AddHook您可以使用 來處理訊息沒有 WPF 對等的案例。

委派 HwndSourceHook 類似于 Win32 主視窗程式的參數設定檔。 父視窗主視窗接收 HwndSource 的所有視窗訊息也會轉送至 HwndSourceHook 委派。

勾點會依新增的順序呼叫。 如果訊息有任何勾點傳 handled = true 回,則呼叫順序中的攔截之後,不會針對該訊息呼叫。

適用於

另請參閱