I need to hide the new window started from the code below. If I run as is,
the window is visible. If I comment out the code that sets a different user,
domain, and password the window is hidden as desired. Does anyone know if
there is a known issue with hiding a process window when you run it as a
different user? Do you have any suggestions to work around this problem?
Thank you.
Process proc = new Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = "/C time /T";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.Domain = CurrentAdmin.Domain;
proc.StartInfo.UserName = CurrentAdmin.UserID;
proc.StartInfo.Password = CurrentAdmin.Password;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardInput = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();
StreamReader myOutput = proc.StandardOutput;
proc.WaitForExit();
while (myOutput.EndOfStream == false)
{
string Inline;
Inline = myOutput.ReadLine();
Response = Response + Inline + Environment.NewLine;
}
MessageBox.Show(Response); 4 3969
Bumping this one once. I really would like to get a professional opinion on
how to do this, please.
"Huey" wrote:
I need to hide the new window started from the code below. If I run as is,
the window is visible. If I comment out the code that sets a different user,
domain, and password the window is hidden as desired. Does anyone know if
there is a known issue with hiding a process window when you run it as a
different user? Do you have any suggestions to work around this problem?
Thank you.
Process proc = new Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = "/C time /T";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.Domain = CurrentAdmin.Domain;
proc.StartInfo.UserName = CurrentAdmin.UserID;
proc.StartInfo.Password = CurrentAdmin.Password;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardInput = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();
StreamReader myOutput = proc.StandardOutput;
proc.WaitForExit();
while (myOutput.EndOfStream == false)
{
string Inline;
Inline = myOutput.ReadLine();
Response = Response + Inline + Environment.NewLine;
}
MessageBox.Show(Response);
Quote from MSDN for the Process.StartInfo Property:
"If you call the Start(ProcessStartInfo) method with the
ProcessStartInfo..::.UserName and ProcessStartInfo..::.Password properties
set, the unmanaged CreateProcessWithLogonW function is called, which starts
the process in a new window even if the CreateNoWindow property value is
true or the WindowStyle property value is Hidden."
"Huey" <Hu**@discussions.microsoft.comwrote in message
news:6D**********************************@microsof t.com...
Bumping this one once. I really would like to get a professional opinion
on
how to do this, please.
"Huey" wrote:
>I need to hide the new window started from the code below. If I run as is, the window is visible. If I comment out the code that sets a different user, domain, and password the window is hidden as desired. Does anyone know if there is a known issue with hiding a process window when you run it as a different user? Do you have any suggestions to work around this problem? Thank you.
Process proc = new Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = "cmd.exe"; proc.StartInfo.Arguments = "/C time /T"; proc.StartInfo.UseShellExecute = false; proc.StartInfo.Domain = CurrentAdmin.Domain; proc.StartInfo.UserName = CurrentAdmin.UserID; proc.StartInfo.Password = CurrentAdmin.Password; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardInput = true; proc.StartInfo.RedirectStandardError = true; proc.StartInfo.CreateNoWindow = true; proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc.Start(); StreamReader myOutput = proc.StandardOutput;
proc.WaitForExit();
while (myOutput.EndOfStream == false) { string Inline; Inline = myOutput.ReadLine(); Response = Response + Inline + Environment.NewLine; } MessageBox.Show(Response);
Thanks! I feel sufficiently stupid now. :]
"Andrew" wrote:
Quote from MSDN for the Process.StartInfo Property:
"If you call the Start(ProcessStartInfo) method with the
ProcessStartInfo..::.UserName and ProcessStartInfo..::.Password properties
set, the unmanaged CreateProcessWithLogonW function is called, which starts
the process in a new window even if the CreateNoWindow property value is
true or the WindowStyle property value is Hidden."
"Huey" <Hu**@discussions.microsoft.comwrote in message
news:6D**********************************@microsof t.com...
Bumping this one once. I really would like to get a professional opinion
on
how to do this, please.
"Huey" wrote:
I need to hide the new window started from the code below. If I run as
is,
the window is visible. If I comment out the code that sets a different
user,
domain, and password the window is hidden as desired. Does anyone know
if
there is a known issue with hiding a process window when you run it as a
different user? Do you have any suggestions to work around this problem?
Thank you.
Process proc = new Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = "/C time /T";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.Domain = CurrentAdmin.Domain;
proc.StartInfo.UserName = CurrentAdmin.UserID;
proc.StartInfo.Password = CurrentAdmin.Password;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardInput = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();
StreamReader myOutput = proc.StandardOutput;
proc.WaitForExit();
while (myOutput.EndOfStream == false)
{
string Inline;
Inline = myOutput.ReadLine();
Response = Response + Inline + Environment.NewLine;
}
MessageBox.Show(Response);
No need to, I am glad I could help you.
Sometimes MSDN does it's job well :)
I thought it will say about this in the description of either the method or
structures used in the method.
"Huey" <Hu**@discussions.microsoft.comwrote in message
news:3D**********************************@microsof t.com...
Thanks! I feel sufficiently stupid now. :]
"Andrew" wrote:
>Quote from MSDN for the Process.StartInfo Property:
"If you call the Start(ProcessStartInfo) method with the ProcessStartInfo..::.UserName and ProcessStartInfo..::.Password properties set, the unmanaged CreateProcessWithLogonW function is called, which starts the process in a new window even if the CreateNoWindow property value is true or the WindowStyle property value is Hidden." "Huey" <Hu**@discussions.microsoft.comwrote in message news:6D**********************************@microso ft.com...
Bumping this one once. I really would like to get a professional
opinion
on
how to do this, please.
"Huey" wrote:
I need to hide the new window started from the code below. If I run as is, the window is visible. If I comment out the code that sets a different user, domain, and password the window is hidden as desired. Does anyone know if there is a known issue with hiding a process window when you run it as a different user? Do you have any suggestions to work around this problem? Thank you.
Process proc = new Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = "cmd.exe"; proc.StartInfo.Arguments = "/C time /T"; proc.StartInfo.UseShellExecute = false; proc.StartInfo.Domain = CurrentAdmin.Domain; proc.StartInfo.UserName = CurrentAdmin.UserID; proc.StartInfo.Password = CurrentAdmin.Password; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardInput = true; proc.StartInfo.RedirectStandardError = true; proc.StartInfo.CreateNoWindow = true; proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc.Start(); StreamReader myOutput = proc.StandardOutput;
proc.WaitForExit();
while (myOutput.EndOfStream == false) { string Inline; Inline = myOutput.ReadLine(); Response = Response + Inline + Environment.NewLine; } MessageBox.Show(Response);
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Code Monkee |
last post by:
How can the toolbar and menubar be hidden in IE?
When opening the window via javascript I can specify
'toolbar=no,menubar=no', which works fine.
However if the window already exists how can I...
|
by: Danielb |
last post by:
I want my application to run most of the time as just an notify icon
visible in the system tray, with some dialogs windows that open if the user
selects an option from the context menu on the tray...
|
by: Samantha |
last post by:
Hello ,
I am developping a program for Win98 plateform, and I am stucking with a
problem, hope you can help me.
I have a program running 2 process :
- One process running the Xcopy.exe
-...
|
by: Paul Bergson |
last post by:
I have been trying to get a process to start up and run with arguments
passed to it. I have gotten close (Thanks to help from this board) but I
there is a failure while I'm running this because...
|
by: MgGuigg |
last post by:
Hello all, This is my first time posting a question to this forum, so here is
hoping I am following protocol. I am scraping the rust off my old Basic
programming skills, and have just recently...
|
by: drodrig |
last post by:
Hi.
I am trying to close/kill all processes that show visible windows on
Windows XP. So far I've created a script that uses win32gui.EnumWindows
to iterate through all windows, check for which...
|
by: SeC |
last post by:
Hi.
Is there any way to detect if application is being killed by 'End
Process' via Task Manager ?
|
by: jan.loucka |
last post by:
Hi,
Is there any way in .NET how to capture WIN API messages that belong
to different application? We have a Windows Form app written in .NET
2.0 and from our application we're running another...
|
by: Sh4wn |
last post by:
Hi,
first, python is one of my fav languages, and i'll definitely keep
developing with it. But, there's 1 one thing what I -really- miss:
data hiding. I know member vars are private when you...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |