C# SendMessage发送右键事件时,无法弹出菜单栏,如何解决

mfc198666_002 2011-04-14 04:38:02
如题:

代码

[DllImport("user32.dll", EntryPoint = "SendMessage", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern IntPtr SendMessage(IntPtr hWnd, uint wMsg, int wParam, string lParam);

public const int WM_RBUTTONDOWN = 0x204;
public const int WM_RBUTTONUP = 0x205;


IntPtr msg = new IntPtr(0x209FA);
SetForegroundWindow(msg);
SendMessage(msg, WM_RBUTTONDOWN, 0, (45 << 16) + 50);
SendMessage(msg, WM_RBUTTONUP, 0, (45 << 16) + 50);

无法响应右键菜单?
...全文
186 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
julor 2012-02-17
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 mfc198666_002 的回复:]

问题已解决
[/Quote]
如何解决的呢?我遇到的问题是可以正常得到按钮的句柄,但按钮发送事件没有响应,可以用鼠标左键按下来可以看到焦点在按钮上。
mfc198666_002 2011-04-19
  • 打赏
  • 举报
回复
问题已解决
余山水 2011-04-14
  • 打赏
  • 举报
回复
先相应右键时间,在发送消息

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧