Skip to content

Commit 90869c4

Browse files
committed
Update Program.cs
1 parent 5d9c698 commit 90869c4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ActiveProcess/Program.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ internal class Program
2222
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
2323
static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
2424

25-
public static (IntPtr handle, uint pid, string windowTitle, string windowClass, string processName, string Filename) GetActiveProcessInfo()
25+
public static (IntPtr handle, uint pid, string windowTitle, string windowClass, string processName, string filename) GetActiveProcessInfo()
2626
{
2727
IntPtr handle = default;
2828
uint pid = 0;
29-
string windowTitle = null, windowClass = null, processName = null, Filename = null;
29+
string windowTitle = null, windowClass = null, processName = null, filename = null;
3030
try
3131
{
3232
handle = GetForegroundWindow();
@@ -61,7 +61,7 @@ public static (IntPtr handle, uint pid, string windowTitle, string windowClass,
6161
GetWindowThreadProcessId(handle, out pid);
6262
Process p = Process.GetProcessById((int)pid);
6363
processName = p.ProcessName;
64-
Filename = p.GetMainModuleFileName();
64+
filename = p.GetMainModuleFileName();
6565
}
6666
catch (Exception ex)
6767
{
@@ -73,7 +73,7 @@ public static (IntPtr handle, uint pid, string windowTitle, string windowClass,
7373
{
7474
Console.WriteLine(ex);
7575
}
76-
return (handle, pid, windowTitle, windowClass, processName, Filename);
76+
return (handle, pid, windowTitle, windowClass, processName, filename);
7777
}
7878

7979
static void Main(string[] args)
@@ -84,8 +84,8 @@ static void Main(string[] args)
8484
{
8585
Thread.Sleep(1000);
8686
loop++;
87-
(var handle, var pid, var windowTitle, var windowClass, var processName, var Filename) = GetActiveProcessInfo();
88-
var printText = $"Handle = {handle}\nPID = {pid}\nWindowTitle = \"{windowTitle ?? "null"}\"/{windowTitle?.Length}\nWindowClass = \"{windowClass ?? "null"}\"/{windowClass?.Length}\nProcessName = {processName ?? "null"}\"/{processName?.Length}\nFilename = \"{Filename ?? "null"}\"/{Filename?.Length}\n";
87+
(var handle, var pid, var windowTitle, var windowClass, var processName, var filename) = GetActiveProcessInfo();
88+
var printText = $"Handle = {handle}\nPID = {pid}\nWindowTitle = \"{windowTitle ?? "null"}\"/{windowTitle?.Length}\nWindowClass = \"{windowClass ?? "null"}\"/{windowClass?.Length}\nProcessName = {processName ?? "null"}\"/{processName?.Length}\nFilename = \"{filename ?? "null"}\"/{filename?.Length}\n";
8989
if (lastText != printText)
9090
{
9191
lastText = printText;

0 commit comments

Comments
 (0)