私はこのコードを持っています。任意の CaptionName と一致させたいのですが、何をすべきか、正規表現やその他のものをどのように配置できるかがよくわかりません。BringToFront で使用したい CaptionName をチェックできます。メソッド..見てみましょう:
class Program
{
[DllIport("User32.dll")]
public static extern Int32 SetForegroundWindow(int hWnd);
[DllImport("user32.dll")]
public static extern int FindWindow(string lpClassName, string lpWindowName);
private static void BringToFront(string className, string CaptionName)
{
SetForegroundWindow(FindWindow(className, CaptionName));
}
static void Main(string[] args)
{
BringToFront("Notepad","#*#");
}
}