Luna
Luna
CC#
Created by Luna on 6/4/2024 in #help
✅Refactor C# code
thxxx
11 replies
CC#
Created by Luna on 6/4/2024 in #help
✅Refactor C# code
worked, i got another bug, but that is on me lol is there a way to work is CSV files? so i don't need to make manually like I am doing rn
11 replies
CC#
Created by Luna on 6/4/2024 in #help
✅Refactor C# code
okay, thx lemme try
11 replies
CC#
Created by Luna on 5/24/2024 in #help
✅ Detect the user name who started the process
using System.Management;
...
public static string? GetProcessOwner(int processId)
{
string? MethodResult = null;
try
{
string Query = $"SELECT * FROM WIN32_PROCESS WHERE ProcessId = {processId}";

ManagementObjectCollection Processes = new ManagementObjectSearcher(Query).Get();

foreach (ManagementObject Process in Processes.Cast<ManagementObject>())
{
string[] Args = ["", ""];

int ReturnCode = Convert.ToInt32(Process.InvokeMethod("GetOwner", Args));

MethodResult = ReturnCode switch
{
0 => Args[1] + "\\" + Args[0],
_ => "NONE",
};
}

}
catch (Exception ex)
{
MessageBox.Show($"Error geting process owner: \n{ex.Message}");
}
return MethodResult;
}
using System.Management;
...
public static string? GetProcessOwner(int processId)
{
string? MethodResult = null;
try
{
string Query = $"SELECT * FROM WIN32_PROCESS WHERE ProcessId = {processId}";

ManagementObjectCollection Processes = new ManagementObjectSearcher(Query).Get();

foreach (ManagementObject Process in Processes.Cast<ManagementObject>())
{
string[] Args = ["", ""];

int ReturnCode = Convert.ToInt32(Process.InvokeMethod("GetOwner", Args));

MethodResult = ReturnCode switch
{
0 => Args[1] + "\\" + Args[0],
_ => "NONE",
};
}

}
catch (Exception ex)
{
MessageBox.Show($"Error geting process owner: \n{ex.Message}");
}
return MethodResult;
}
15 replies
CC#
Created by Luna on 5/24/2024 in #help
✅ Detect the user name who started the process
Install Nuget package: System.Management
15 replies
CC#
Created by Luna on 5/24/2024 in #help
✅ Detect the user name who started the process
Found this solution:
15 replies
CC#
Created by Luna on 5/24/2024 in #help
✅ Detect the user name who started the process
Didn't make this link work
15 replies
CC#
Created by Luna on 5/24/2024 in #help
✅ Detect the user name who started the process
lemme check
15 replies
CC#
Created by Luna on 5/24/2024 in #help
✅ Detect the user name who started the process
"." on every process
15 replies
CC#
Created by Luna on 5/24/2024 in #help
✅ Detect the user name who started the process
nope, already tried that one
15 replies
CC#
Created by Luna on 5/24/2024 in #help
✅ Detect the user name who started the process
i forgot to mention the language, lol sorry
15 replies
CC#
Created by Luna on 5/24/2024 in #help
✅ Detect the user name who started the process
yes, but i wanna get this info via C# code
15 replies
CC#
Created by Luna on 7/3/2023 in #help
✅Modifying visual elements created in runtime
Sorry
12 replies
CC#
Created by Luna on 7/3/2023 in #help
✅Modifying visual elements created in runtime
Oh
12 replies
CC#
Created by Luna on 7/3/2023 in #help
✅Modifying visual elements created in runtime
i think
12 replies
CC#
Created by Luna on 7/3/2023 in #help
✅Modifying visual elements created in runtime
make sense
12 replies
CC#
Created by Luna on 7/3/2023 in #help
✅Modifying visual elements created in runtime
i have to declare this visual elements in my class, not inside the function?
12 replies
CC#
Created by Luna on 7/3/2023 in #help
✅Modifying visual elements created in runtime
i wanna change the text of this textbox in another function
12 replies
CC#
Created by Luna on 7/3/2023 in #help
✅Modifying visual elements created in runtime
for example
12 replies
CC#
Created by Luna on 6/2/2023 in #help
❔ Color of a progressBar in Windows Forms
Lemme check this one Funny that I searched on Google and didn't found this one
7 replies