
这是签名:
[Dllimport("user32.dll",CharSet = CharSet.auto,SetLastError = false)] internal static extern IntPtr SendMessage(HandleRef hWnd,uint Msg,IntPtr wParam,IntPtr lParam); 我需要将不同的消息发送到windows资源管理器窗口吗?或者另一种方法来实现这一目标?
解决方法 另一种解决方案是使用PostMessage win API调用而不是SendMessage,下面是一个适合我的例子(我正在使用winXP sp3):[Dllimport("user32.dll",SetLastError = true)]static extern IntPtr FinDWindow(string lpClassname,string lpWindowname);[Dllimport("user32.Dll")]public static extern int PostMessage(IntPtr hWnd,UInt32 msg,int wParam,int lParam);private const UInt32 WM_CLOSE = 0x0010;... IntPtr hWnd = FinDWindow("ExploreWClass",null); if (hWnd.ToInt32()!=0) PostMessage(hWnd,WM_CLOSE,0); PostMessage和SendMessage API调用之间的差异在这里描述:http://msdn.microsoft.com/en-us/magazine/cc301431.aspx
总结以上是内存溢出为你收集整理的c# – 无法使用pinvoke将WM_CLOSE发送到Windows资源管理器窗口全部内容,希望文章能够帮你解决c# – 无法使用pinvoke将WM_CLOSE发送到Windows资源管理器窗口所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)