栗子是 调用WIn32API 让窗口最前 后台代码 [DllImport("user32.dll")] private static extern bool SetForegroundWindow(IntPtr hWnd); // Process process = null; private void OPenButton_Click(object sender, RoutedEventArgs e) { process = new Process(); process.StartInfo.FileName = "iexplore.exe"...
在WPF当中,如果我们要调用Win32API(这里以keybd_event为例): 1 2 [DllImport("user32.dll", EntryPoint ="keybd_event", SetLastError = true)] publicstaticexternvoidkeybd_event(bytebVk,bytebScan,uintdwFlags,uintdwExtraInfo); 上述代码的意思也显而易见,DllImport是一个attribute标签。值得注意的是下面的...