已知进程1的ID及其窗体1的Handle,在进程2中显示一个窗体2,如何实现类似窗体2.ShowDialog(窗体1)的效果? 如题。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 [DllImport("user32.dll", EntryPoint = "FindWindowEx", SetLastError = true)]static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);[DllImport("user32.dll", EntryPoint = "ShowWindow", SetLastError = true)]static extern bool ShowWindow(IntPtr hWnd, uint nCmdShow);IntPtr h= FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null);if (h!= IntPtr.Zero){ ShowWindow(h, 0);} Form f=Form.FromHandle(handle)试试 wuyq11 的方法我试过,我是用IPC通道把进程1的Form的handle传给进程2,然后在进程1中通过共享对象在进程2中启动Form2. 补充下, 进程2是控制台程序,FORM2 是从进程2里创建。 如何使用C# listview控件显示文件夹内的文件名及路径???急求! visual studio 2008 安装失败,怎么解决? 求一个上传图片最好带进度条的例子 Window CE 中的cab安装错误 关于c#网站实现对手机发送短信的功能的问题,急啊!! AJAX级联目录示例问题 窗体抓图问题 请问用c#如何实现文件上传 动态表单问题 求C#将带汉字的字符串转化为INt 向ojlovecd提问,有啥好技术书籍推荐的没有? 跪求一个算法~~
static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
[DllImport("user32.dll", EntryPoint = "ShowWindow", SetLastError = true)]
static extern bool ShowWindow(IntPtr hWnd, uint nCmdShow);
IntPtr h= FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null);
if (h!= IntPtr.Zero)
{
ShowWindow(h, 0);
}
试试