我得到了这个代码:
using System.Runtime.InteropServices;
[DllImportAttribute("User32.dll")]
private static extern int FindWindow(String ClassName, String WindowName);
[DllImport("User32")]
private static extern int ShowWindow(int hWnd, int nCmdShow);
private const int SW_HIDE = 0;
int hWnd = FindWindow(null, Microsoft Excel - Book1);
if (hWnd > 0)
{
ShowWindow(hWnd, SW_HIDE);
}
但有时我用 OpenOffice.org 打开 Book1 .. 我的问题是,我如何 SW_HIDE 不同的 Windows 标题?
如果 Microsoft Excel - Book1 标题存在
如果 Book1 - OpenOffice.org Calc 标题存在
也许可以找到 Windows 标题部分“Book1”
非常感谢!