473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How do I minimize my currently executing Console application?

GG
Is there a way to minimize my current console app?
Using this code but does not work

System.Diagnostics.Process
currentProcess=System.Diagnostics.Process.GetCurre ntProcess();

currentProcess.StartInfo.WindowStyle=System.Diagno stics.ProcessWindowSty
le.Minimized;
Thanks
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #1
2 18600
Try this test console application class, it will minimize the app, sleep two
seconds, then restore it.

using System;
using System.IO;

namespace ConsoleApplication1
{

class Class1
{

[System.Runtime.InteropServices.DllImport("user32.d ll")]
private static extern bool ShowWindow( IntPtr hWnd, int nCmdShow);
private const int SW_MINIMIZE = 6;
private const int SW_MAXIMIZE = 3;
private const int SW_RESTORE = 9;
[STAThread]
static void Main(string[] args)
{
IntPtr winHandle =
System.Diagnostics.Process.GetCurrentProcess().Mai nWindowHandle;
ShowWindow( winHandle, SW_MINIMIZE);
System.Threading.Thread.Sleep(2000);
ShowWindow( winHandle, SW_RESTORE);

}
}
}

"GG" <gg@hotmail.com> wrote in message
news:ep**************@tk2msftngp13.phx.gbl...
Is there a way to minimize my current console app?
Using this code but does not work

System.Diagnostics.Process
currentProcess=System.Diagnostics.Process.GetCurre ntProcess();

currentProcess.StartInfo.WindowStyle=System.Diagno stics.ProcessWindowSty
le.Minimized;
Thanks
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 15 '05 #2
GG
This is what I was exctaly looking for

Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Job Lot | last post by:
How can I terminate console application in Try…Catch…Finally…End Try block so that code in Finally gets executed. If I use End statement Finally does not get executed. Following is my code...
2
by: Chris | last post by:
Hi, Currently, I have a console application written in C# and an unmanaged legacy DLL written in VC++ 6.0. In the DLL's previous application, when an event occurs in the DLL, a windows message...
1
by: jam | last post by:
Dear all, I ask some question before and i got some idea, like background thread.... However, I still dun know how could i start implementing this, could someone help me on this and give me some...
9
by: savvy | last post by:
i'm trying to compile a simple console application for sending a mail, my main idea is to schedule it to a particular time for sending mails using the windows schedular task lateron. Therefore i...
2
by: Chris Newby | last post by:
Is there a static context property that will give access to the currently executing System.Web.UI.Page instance? ... doesn't seem like there would be, but thought i'd ask. TIA//
0
by: Maxwell | last post by:
Hello, I recently completed a MC++ (VS2003) DLL that wraps a non MFC C++ DLL and need to use it in a MC++ Console Application (no forms/guis of any kind just output to console). Trouble is...
2
by: tingjun.li | last post by:
http://www.functionx.com/win32/Lesson07.htm "A window can display one to three buttons: Minimize or , Maximize or , Close or . " My quesiton is : How can i change these buttons to XP...
3
by: Will Asrari | last post by:
I am working on a project now for a client that requires all managed code. I have rewritten about 60% of the code and functionality in C# and have now come to the complicated part of picking apart...
3
by: Marcel Saucier | last post by:
I have written a Console Application then created a shortcut to it on my desktop. I was able to minimize the DOS window when I click my shortcut so I dont see anymore the DOS window But, using...
0
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,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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...
0
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...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.