0
я пишу простую программу, которая начинается еще Client.exe от пользователя:Как узнать, что запускает программа пользователя?
Console.Write("Enter your domain: ");
string domain = Console.ReadLine();
Console.Write("Enter you user name: ");
string uname = Console.ReadLine();
Console.Write("Enter your password: ");
SecureString password = new SecureString();
ConsoleKeyInfo key;
do
{
key = Console.ReadKey(true);
// Ignore any key out of range.
if (((int)key.Key) >= 33 && ((int)key.Key <= 90) && key.Key != ConsoleKey.Enter)
{
// Append the character to the password.
password.AppendChar(key.KeyChar);
Console.Write("*");
}
// Exit if Enter key is pressed.
} while (key.Key != ConsoleKey.Enter);
Console.WriteLine();
try
{
Console.WriteLine("\nTrying to launch ProcessClient using your login information...");
Process.Start("ProcessClient.exe", uname, password, domain);
}
catch (Win32Exception ex)
{
Console.WriteLine(ex.Message);
}
И это работает! Но как Client.exe знает, что пользователь выполняет эту программу?
этот, наверное,? http://stackoverflow.com/questions/1240373/how-do-i-get-the-current-username-in-net-using-c –
Возможный дубликат [Определить из кода, в котором работает мой процесс] (http://stackoverflow.com/questions/4260701/determine-from-within-code-which-user-my-process-is-running-as) –
Какую часть информации пользователя вы хотите получить именно? У вас уже есть имя пользователя ... Что вы на самом деле хотите? – Rob