C# hook WndProc

Overloaded WndProc in the current window, only captures the current window WinForm message

protected override void WndProc(ref Message m)
{
    if (m.Msg == API.WM_MENUSELECT)
    {
        MessageBox.Show("选择了菜单");
    }   

    base.WndProc(ref m);
}

 

To our WinForm program, to capture all of the current messages on the PC, you have to Hook

Guess you like

Origin www.cnblogs.com/code1992/p/11647084.html