c#钩子做了个程序怎么不能处理消息 10
下面代码有问题吗?截取不到WM_PAINT消息还有要处理键盘消息应该怎么写privateintmyhookproc(intcode,IntPtrwparam,refCWP...
下面代码有问题吗?截取不到WM_PAINT消息
还有要处理键盘消息应该怎么写
private int myhookproc(int code, IntPtr wparam, ref CWPSTRUCT cwp)
{
//下面三行能执行到
// Graphics ggp;
// ggp = Graphics.FromHwnd(hwnd);
//ggp.DrawString("jj", new Font("宋体", 10), new SolidBrush(Color.Gray), new Point(30, 30));
switch(code)
{
case 0:
switch(cwp.message)
{
case WM_PAINT://0x0000F:WM_PAINT,拦截
//do something
Graphics gp;
gp = Graphics.FromHwnd(hwnd);
gp.DrawString("jj", new Font("宋体", 10), new SolidBrush(Color.Gray), new Point(30, 30));
break;
case (int)MouseButtons.Left :
{
MessageBox.Show("JJ");
break;
}
}
break;
}
return CallNextHookEx(hookHandle,code,wparam, ref cwp);
} 展开
还有要处理键盘消息应该怎么写
private int myhookproc(int code, IntPtr wparam, ref CWPSTRUCT cwp)
{
//下面三行能执行到
// Graphics ggp;
// ggp = Graphics.FromHwnd(hwnd);
//ggp.DrawString("jj", new Font("宋体", 10), new SolidBrush(Color.Gray), new Point(30, 30));
switch(code)
{
case 0:
switch(cwp.message)
{
case WM_PAINT://0x0000F:WM_PAINT,拦截
//do something
Graphics gp;
gp = Graphics.FromHwnd(hwnd);
gp.DrawString("jj", new Font("宋体", 10), new SolidBrush(Color.Gray), new Point(30, 30));
break;
case (int)MouseButtons.Left :
{
MessageBox.Show("JJ");
break;
}
}
break;
}
return CallNextHookEx(hookHandle,code,wparam, ref cwp);
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询