Process.MainWindowTitle プロパティ
アセンブリ: System (system.dll 内)


例外の種類 | 条件 |
---|---|
PlatformNotSupportedException | プラットフォームが Windows 98 または Windows Millennium Edition (Windows Me) です。Windows 98 や Windows Me でこのプロパティにアクセスするには、ProcessStartInfo.UseShellExecute を false に設定します。 |

プロセスに関連付けられたメイン ウィンドウがあるのは、そのプロセスにグラフィカル インターフェイスがある場合だけです。関連付けられたプロセスにメイン ウィンドウがない場合 (MainWindowHandle がゼロの場合)、MainWindowTitle は空の文字列 ("") です。プロセスを起動した直後にメイン ウィンドウのタイトルを使用する場合は、WaitForInputIdle メソッドを使用してプロセスの起動を終了し、メイン ウィンドウ ハンドルが作成されたことを確認してください。確認しない場合、例外がスローされます。
Windows 98, Windows Millennium Edition プラットフォームメモ : ProcessStartInfo.UseShellExecute に true を設定してプロセスを開始した場合、このプロパティは、このプラットフォームでは利用できません。

メモ帳のインスタンスを起動し、そのプロセスのメイン ウィンドウのキャプションを取得する例を次に示します。
Imports System Imports System.Diagnostics Class MainWindowTitleClass Public Shared Sub Main() Try ' Create an instance of process component. Dim myProcess As New Process() ' Create an instance of 'myProcessStartInfo'. Dim myProcessStartInfo As New ProcessStartInfo() myProcessStartInfo.FileName = "notepad" myProcess.StartInfo = myProcessStartInfo ' Start process. myProcess.Start() ' Allow the process to finish starting. myProcess.WaitForInputIdle() Console.Write("Main window Title : " + myProcess.MainWindowTitle) myProcess.CloseMainWindow() myProcess.Close() Catch e As Exception Console.Write(" Message : " + e.Message) End Try End Sub 'Main End Class 'MainWindowTitleClass
using System; using System.Diagnostics; class MainWindowTitleClass { public static void Main() { try { // Create an instance of process component. Process myProcess = new Process(); // Create an instance of 'myProcessStartInfo'. ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(); myProcessStartInfo.FileName = "notepad"; myProcess.StartInfo = myProcessStartInfo; // Start process. myProcess.Start(); // Allow the process to finish starting. myProcess.WaitForInputIdle(); Console.Write("Main window Title : " + myProcess.MainWindowTitle); myProcess.CloseMainWindow(); myProcess.Close(); } catch(Exception e) { Console.Write(" Message : " + e.Message); } } }
#using <System.dll> using namespace System; using namespace System::Diagnostics; int main() { try { // Create an instance of process component. Process^ myProcess = gcnew Process; // Create an instance of 'myProcessStartInfo'. ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo; myProcessStartInfo->FileName = "notepad"; myProcess->StartInfo = myProcessStartInfo; // Start process. myProcess->Start(); // Allow the process to finish starting. myProcess->WaitForInputIdle(); Console::Write( "Main window Title : {0}", myProcess->MainWindowTitle ); myProcess->CloseMainWindow(); myProcess->Close(); } catch ( Exception^ e ) { Console::Write( " Message : {0}", e->Message ); } }


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からProcess.MainWindowTitle プロパティを検索する場合は、下記のリンクをクリックしてください。

- Process.MainWindowTitle プロパティのページへのリンク