WPF 精修篇 调用Win32Api
标签:filename form data- ram tps func ber rgs div
原文:WPF 精修篇 调用Win32Api
栗子是 调用WIn32API 让窗口最前
后台代码
-
[DllImport("user32.dll")]
-
private static extern bool SetForegroundWindow(IntPtr hWnd);
-
-
-
-
private void OPenButton_Click(object sender, RoutedEventArgs e)
-
-
-
process.StartInfo.FileName = "iexplore.exe";
-
process.StartInfo.Arguments = Text_Path.Text;
-
-
-
-
private void TOPButton_Click(object sender, RoutedEventArgs e)
-
-
-
-
var ptr = process.MainWindowHandle;
-
SetForegroundWindow(ptr);
-
-
-
-
private void FlushButton_Click(object sender, RoutedEventArgs e)
-
-
-
-
var ptr = process.MainWindowHandle;
-
SetForegroundWindow(ptr);
-
SendKeys.SendWait("{F5}");
-
-
前台
-
-
"Text_Path" HorizontalAlignment="Left" Height="25" Margin="0,34,0,0" TextWrapping="Wrap" Text="https://www.baidu.com" VerticalAlignment="Top" Width="251" />
-
-
-
-
-
SendKeys.SendWait("{F5}"); 需要引用System.Windows.Forms.dll
WPF 精修篇 调用Win32Api
标签:filename form data- ram tps func ber rgs div
原文地址:https://www.cnblogs.com/lonelyxmas/p/12075802.html
评论