有时我们希望自己的程序能做到激活一个窗体,但在.NET CF中没有函数可以激活属于另外一个进程或程序的窗体。所以,我们要调用API函数来实现:

using System.Runtime.InteropServices; 
[DllImport("coredll.Dll")] 
public static extern IntPtr FindWindow(String classname, String title); 

[DllImport("coredll.Dll")] 
public static extern void  SetForegroundWindow(IntPtr hwnd); 

然后使用下列代码即可

IntPtr hDlg; 
hDlg=FindWindow(null, "窗口标题"); 
SetForegroundWindow( hDlg ); 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-12
  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
猜你喜欢
  • 2021-05-21
  • 2022-12-23
  • 2021-11-08
  • 2021-06-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案