What is the WinForms equivalent to the following line of WPF code?
HwndSource.FromHwnd(_windowHandle).AddHook(HwndSourceHookHandler);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In WinForms, you’d typically override WndProc in the control/Form in question. Since every control is effectively a
HWND, you don’t need theHwndSourcestyle 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.