batch file

T

Tam

i have an app that also uses java services.

this it does at present by starting the java process going by calling a
batch file to set the PATH environment variable.

how on earth can i minimize the dos window that opens? at present i have
this.

ProcessStartInfo info = new ProcessStartInfo();
info.FileName=("startserver.bat");
info.UseShellExecute=false;
p1 = Process.Start(info);

and use
SendMessage(p1.Handle, 0x112,0xF020,0);

which should minimize it. any clues? Ive tried setting

info.Arguments = "/MIN /WAIT";
 
M

Matt Burland

Have you tried:

info.WindowStyle = ProcessWindowStyle.Minimized; ?

You might also like to note that:

info.CreateNoWindow = true;

will stop it from creating a window at all.
 
T

Tam

worked a treat (used CreateNoWindow)

thankyou.

Matt Burland said:
Have you tried:

info.WindowStyle = ProcessWindowStyle.Minimized; ?

You might also like to note that:

info.CreateNoWindow = true;

will stop it from creating a window at all.
 
C

cemal eroglu

Hi,
I don't use CreateNoWindow=True since I would like to see this application on the task manager (as an application) and I should be able to end the task (and its child processes etc). So I used
process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized

However my dos window is still maximized. Here is the code
-----------------------
process = new Process()
process.StartInfo.UseShellExecute = false
process.StartInfo.RedirectStandardOutput = true
process.StartInfo.RedirectStandardInput = true
process.StartInfo.RedirectStandardError = true
process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized
process.StartInfo.FileName = cmd
process.StartInfo.Arguments = Arguments
process.StartInfo.WorkingDirectory = WorkingDirectory
process.Start()

--------------------

Any idea why this dos window is not minimized? I also used Hidden but it did not work either

Thx
Cemal
 
C

cemal eroglu

UPDATE: Somehow DOS window created is not minimized/hidden. However, I worked around this by calling win32 library functions (SendMessage) with SW_HIDE after starting the process. That worked well. However since the process is not a message loop (not UI) WaitForInputIdle does not work to wait for to get the window handle. Instead, used Thread.Sleep until the dos window is ready to give hWND other than 0. But this seems nasty to me

However, if someone has any other idea, that would be appreciated

Cemal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top