Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Ruft die Beschriftung des Hauptfensters des Prozesses ab.
Namespace: System.Diagnostics
Assembly: System (in system.dll)
Syntax
'Declaration
Public ReadOnly Property MainWindowTitle As String
'Usage
Dim instance As Process
Dim value As String
value = instance.MainWindowTitle
public string MainWindowTitle { get; }
public:
property String^ MainWindowTitle {
String^ get ();
}
/** @property */
public String get_MainWindowTitle ()
public function get MainWindowTitle () : String
Eigenschaftenwert
Der Titel des Hauptfensters des Prozesses.
Ausnahmen
| Ausnahmetyp | Bedingung |
|---|---|
Die Plattform ist Windows 98 oder Windows Millennium Edition (Windows Me). Legen Sie ProcessStartInfo.UseShellExecute auf false fest, um auf diese Eigenschaft unter Windows 98 und Windows Me zuzugreifen. |
Hinweise
Einem Prozess ist nur dann ein Hauptfenster zugeordnet, wenn er über eine grafische Oberfläche verfügt. Wenn der zugeordnete Prozess nicht über ein Hauptfenster verfügt (sodass MainWindowHandle den Wert 0 aufweist), ist MainWindowTitle eine leere Zeichenfolge (""). Wenn Sie einen Prozess gestartet haben und dessen Hauptfenstertitel verwenden möchten, empfiehlt es sich, mithilfe der WaitForInputIdle-Methode das Abschließen des Startvorgangs des Prozesses zu ermöglichen und das Erstellen des Hauptfensterhandles sicherzustellen. Andernfalls löst das System eine Ausnahme aus.
Hinweis zu Windows 98, Windows Millennium Edition: Diese Eigenschaft ist auf dieser Plattform nicht verfügbar, wenn beim Starten des Prozesses ProcessStartInfo.UseShellExecute auf true festgelegt ist.
Beispiel
Im folgenden Beispiel wird eine Instanz von Editor gestartet und der Titel des Hauptfensters des Prozesses abgerufen.
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 );
}
}
.NET Framework-Sicherheit
- SecurityPermission zum Aufrufen von Process-Membern. Anforderungswert: LinkDemand; Benannte Berechtigungssätze: FullTrust.
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0