Sign in
|
Join
Search
James Steele
All things dotNet running through my veins
Home
About
RSS
Atom
Comments RSS
Recent Posts
Watch the Windows 7 Launch by Steve Ballmer (54 min Video)
Top 5 ways to get a Google Wave invite.
Try Paint.NET 3.5 Beta
Microsoft hands Commerce Server over to Cactus Commerce
.NET 3.0 (formerly WinFX) - Clearing the confusion.
Sponsors
advertise here
Tags
.NET
ASP.NET
Commerce Server
community news
google
google wave
Paint.NET
twitter
Windows 7
Navigation
Home
Blogs
Archives
October 2009 (2)
September 2009 (1)
August 2007 (1)
July 2006 (1)
June 2006 (1)
January 2006 (1)
April 2005 (1)
February 2005 (1)
December 2004 (1)
November 2004 (1)
October 2004 (3)
September 2004 (2)
August 2004 (9)
July 2004 (4)
April 2004 (4)
March 2004 (4)
December 2003 (4)
Console Application Problem.. Start minimized??
Any ideas on how (the best way) a Console Application can start ITSELF minimized? I have been trying to track this down for a while now.
Posted:
Nov 25 2004, 12:21 PM
by
JamesSteele
| with
6 comment(s)
Comments
Johnny Thomsen said:
This works for me...
ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(startInfo);
startInfo.Arguments = "www.edc.dk";
Process.Start(startInfo);
// process.WaitForExit();
#
November 25, 2004 2:04 PM
Rob Chartier
said:
When you think of it there really should be no way i can do this. What happens if the console app is started within a existing command window, or say when you boot into command prompt only?
On the other hand you can try something along the lines of:
unsafe {
string appName = System.Reflection.Assembly.GetEntryAssembly().GetName(false).Name;
testNamespace.HWND__* hwnd =testNamespace.windows.FindWindowA(null,appName);
int newwin = testNamespace.windows.SetWindowLongA(hwnd, -16, 0x20000000);
}
[DllImport(@"..\dll\user32.dll", EntryPoint="FindWindowA", CallingConvention=CallingConvention.StdCall, SetLastError=true)]
public static extern unsafe HWND__* FindWindowA(sbyte* lpClassName, sbyte* lpWindowName);
[DllImport(@"..\dll\user32.dll", EntryPoint="SetWindowLongA", CallingConvention=CallingConvention.StdCall, SetLastError=true)]
public static extern unsafe int SetWindowLongA(HWND__* hWnd, int nIndex, int dwNewLong);
Of course this is completely untested and probably wont work but at least its something to work on.
#
November 25, 2004 2:19 PM
Rolf said:
Create a win app with no ui and create a new minimized console from there?
#
November 25, 2004 2:41 PM
Rolf said:
I can't really see how a console app can actually show it's window minimized, since when the main function is entered as far as I know the console window is already created.
#
November 25, 2004 2:43 PM
Russ C.
said:
I think Rob Chartier has the closest answer,
The problem is that the WindowsState is managed by Windows, the console doesn't know about it, as far as it's concerned it's running in full-screen.
Look at www.pinvoke.net for the User32 DllImports
#
November 26, 2004 3:47 AM
TrackBack
said:
^_^,Pretty Good!
#
April 10, 2005 4:23 AM
Leave a Comment
Title
(required)
Name
(required)
Your URL
(optional
)
Comments
(required)
Remember Me?