473,464 Members | 1,499 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 18605
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.