Skip to content

Commit b9f0914

Browse files
committed
Added "Information" tab with detail information about the window and its process.
1 parent 784939b commit b9f0914

File tree

13 files changed

+693
-40
lines changed

13 files changed

+693
-40
lines changed

Build/Build.cmd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
call "%VS100COMNTOOLS%\vsvars32.bat"
2-
"c:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" Build.xml
1+
REM call "%VS100COMNTOOLS%\vsvars32.bat" // use this for VS 2010
2+
REM replace the following with the path to VsDevCmd.bat on your system
3+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
4+
msbuild Build.xml

WindowTextExtractor/Extensions/ProcessExtensions.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Diagnostics;
3+
using System.Runtime.InteropServices;
34
using WindowTextExtractor.Native;
45

56
namespace WindowTextExtractor.Extensions
@@ -16,5 +17,40 @@ public static bool IsWow64Process(this Process process)
1617

1718
return false;
1819
}
20+
21+
public static Process GetParentProcess(this Process process)
22+
{
23+
var pbi = new PROCESS_BASIC_INFORMATION();
24+
int returnLength;
25+
var status = NativeMethods.NtQueryInformationProcess(process.Handle, 0, ref pbi, Marshal.SizeOf(pbi), out returnLength);
26+
if (status != 0)
27+
{
28+
return null;
29+
}
30+
31+
try
32+
{
33+
return Process.GetProcessById(pbi.InheritedFromUniqueProcessId.ToInt32());
34+
}
35+
catch
36+
{
37+
return null;
38+
}
39+
}
40+
41+
public static Priority GetProcessPriority(this Process process)
42+
{
43+
var priorityClass = NativeMethods.GetPriorityClass(process.Handle);
44+
switch (priorityClass)
45+
{
46+
case PriorityClass.REALTIME_PRIORITY_CLASS: return Priority.RealTime;
47+
case PriorityClass.HIGH_PRIORITY_CLASS: return Priority.High;
48+
case PriorityClass.ABOVE_NORMAL_PRIORITY_CLASS: return Priority.AboveNormal;
49+
case PriorityClass.NORMAL_PRIORITY_CLASS: return Priority.Normal;
50+
case PriorityClass.BELOW_NORMAL_PRIORITY_CLASS: return Priority.BelowNormal;
51+
case PriorityClass.IDLE_PRIORITY_CLASS: return Priority.Idle;
52+
default: return Priority.Normal;
53+
}
54+
}
1955
}
2056
}

WindowTextExtractor/Forms/MainForm.Designer.cs

Lines changed: 115 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)