Skip to main content
 首页 » 编程设计

c#之把话说到前面

2024年02月13日11bonelee

<分区>

我想要一个 Word 应用程序出现在前面,请看下面的代码:

string caption = wordApp.Caption; 
IntPtr handler = FindWindow(null, caption); 
SetForegroundWindow(handler); 
wordApp.Visible = true; 

我得到的错误是:

Error CS0103: The name 'FindWindow' does not exist in the current context   
Error CS0103: The name 'SetForegroundWindow' does not exist in the current context 

我想我错过了一个引用,即使编译器没有这么说。我说得对吗?