What is the WinForms equivalent to the following line of WPF code?
HwndSource.FromHwnd(_windowHandle).AddHook(HwndSourceHookHandler);
In WinForms, you'd typically override WndProc in the control/Form in question. Since every control is effectively a HWND
, you don't need the HwndSource
style of hooking.
If you want to setup a Hook in C#, you can follow the guidelines in How to set a Windows hook in Visual C# .NET.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With