c# 使form窗体在系统中获得焦点
2021-05-28 04:01
                         标签:返回   win   run   imp   tsp   time   orm   window   焦点    [System.Runtime.InteropServices.DllImport("user32.dll", CharSet =System.Runtime.InteropServices.CharSet.Auto, ExactSpelling =true)]   c# 使form窗体在系统中获得焦点 标签:返回   win   run   imp   tsp   time   orm   window   焦点    原文地址:https://www.cnblogs.com/wzihan/p/14756028.html
  public static extern IntPtrGetForegroundWindow();   //获得当前活动窗体的句柄
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint= "SetForegroundWindow")]
  public static extern boolSetForegroundWindow(IntPtr hWnd);//设置此窗体句柄的窗体为活动窗体
GetForegroundWindow(),此函数返回一个当前活动窗体的句柄
SetForegroundWindow(this. Handle  )设置自己为活动窗体
上一篇:C#端口连接热敏打印机发送指令
下一篇:C#:LINQ中的SUM子句