If you read the MSDN docs about Process.StartInfo you would assume: nothing is wrong, excellent in controlling the startup of a new process. But how about this line of code:
if(Process.GetCurrentProcess().StartInfo.WindowStyle == ProcessWindowStyle.Minimized) { ... // do special things here}
if
It will never evaluate to true! The reason is simple: the StartInfo is not populated with the settings of the current running process. So if the documentation states: "Gets or sets the properties to pass to the Start method of the Process" it does not mean: the current process. As long as we have to live with DOT.NET 1.1 the only workaround is to interop with the common API function GetStartupInfo() and corrsponding parameter structure to get the infos we want. But I really like the code above, the more intuitive and managed way. Any MS folks listening?
© Copyright 2002-2009, Torsten Rendelmann Page rendered at Thursday, January 08, 2009 9:51:38 PM (W. Europe Standard Time, UTC+01:00)
Like RSS Bandit? Make a donation to help support its development and maintenance. As little as 1€ will help.
SUBSCRIBE RSS GeoURL
newtelligence dasBlog 2.1.8102.813
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.