问题描述
比如在VB里是这样写的PostMessagehWnd1,WM_LBUTTONDOWN,0,(x+Y*65536)PostMessagehWnd1,WM_LBUTTONUP,0,(x+Y*65536)请用一下在C#怎么引用和怎么去写呢谢谢
解决方案
本帖最后由 linyu622 于 2012-05-26 07:50:36 编辑
解决方案二:
已获取窗口句柄,,向窗口里的按钮发消息
解决方案三:
[DllImport("User32.dll")]publicstaticIntPtrPostMessage(IntPtrhWnd,uintMsg,IntPtrwParam,IntPtrlParam);PostMessage(hWnd1,WM_LBUTTONDOWN,IntPtr.Zero,newIntPtr(x+Y*65536));PostMessage(hWnd1,WM_LBUTTONUP,IntPtr.Zero,newIntPtr(x+Y*65536));
解决方案四:
WM_LBUTTONDOWN和WM_LBUTTONUP怎么去定义
解决方案五:
WM_LBUTTONDOWN=0x201WM_LBUTTONUP=0x202
解决方案六:
http://www.pinvoke.net/上面有详细介绍
解决方案七:
publicconstintWM_LBUTTONDOWN=0x0201;publicconstintWM_LBUTTONUP=0x0202;[DllImport("user32.dll",SetLastError=true)]publicstaticexternboolPostMessage(IntPtrhWnd,uintMsg,longwParam,intlParam);privatestringReplaceStr(Matchm){returnm.Groups["rvalue"].Value+".html";}//捕获消息protectedoverridevoidWndProc(refMessagem){if(m.Msg==WM_LBUTTONDOWN||m.Msg==WM_LBUTTONUP){MessageBox.Show("ok");}base.WndProc(refm);}调用PostMessage(this.Handle,WM_LBUTTONDOWN,0,100);PostMessage(this.Handle,WM_LBUTTONUP,0,100);