dotnet / dotnet/dotnet-api-docs

update of MainWindowTitle

Open
#1,074 0 comments 0 reactions 0 assignees View on GitHub
area-System.Diagnostics dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

The content of MainWindowTitle didn't changed after first access?

If i open an application and get the MainWindowTitle after 5 seconds the title contains the application name
But if i request the MainWindowTitle after a few milliseconds after opening the title is empty and will stay empty also after 5 seconds!

workaround:

var title = infologgerProcess.MainWindowTitle;
var processlist = Process.GetProcessesByName("InfoLogger");
foreach (Process process in processlist.Where(process => process.Id == infologgerProcess.Id))
{
if (!title.Equals(process.MainWindowTitle))
{
Debug.WriteLine($"change title from infologgerProcess.MainWindowTitle '{infologgerProcess.MainWindowTitle}' to process.MainWindowTitle '{process.MainWindowTitle}' );
title = process.MainWindowTitle;
}
}

resulting debug log:
change title from infologgerProcess.MainWindowTitle '' to process.MainWindowTitle 'Please wait while the application opens'
change title from infologgerProcess.MainWindowTitle '' to process.MainWindowTitle 'ServiceConnect InfoLogger'
change title from infologgerProcess.MainWindowTitle '' to process.MainWindowTitle 'InfoLogger - loading ...
change title from infologgerProcess.MainWindowTitle '' to process.MainWindowTitle 'InfoLogger - Zeus_IE_ASFB-0024_10040_07eda5ba25ad.gsr'

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: f5cb1b9d-3051-c4cc-c0a6-eaba5b7e80fe
* Version Independent ID: e9716fa8-3f4c-bc20-1ade-5f72b61c5e58
* Content: [Process.MainWindowTitle Property (System.Diagnostics)](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.process.mainwindowtitle?view=netframework-4.7.2)
* Content Source: [xml/System.Diagnostics/Process.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Diagnostics/Process.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.