By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,206 Members | 1,035 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,206 IT Pros & Developers. It's quick & easy.

Minimizing the Console Window

P: n/a
How do I programmatically minimize the console window in a VB .NET console
application?
Oct 13 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
=?Utf-8?B?QWJlbGFyZA==?= <Ab*****@discussions.microsoft.comwrote in
news:F6**********************************@microsof t.com:
How do I programmatically minimize the console window in a VB .NET
console application?
I don't think you can - since it's not a window.

Oct 13 '06 #2

P: n/a
It is a window and can be minimized manually by clicking the minimize box.
The question is how to programmatically minimize it.

"Spam Catcher" wrote:
=?Utf-8?B?QWJlbGFyZA==?= <Ab*****@discussions.microsoft.comwrote in
news:F6**********************************@microsof t.com:
How do I programmatically minimize the console window in a VB .NET
console application?

I don't think you can - since it's not a window.

Oct 13 '06 #3

P: n/a
I think you would have to do this through the process of the "console
window" that holds ur dos app.

take a look at this link:
http://www.thescripts.com/forum/thread382333.html

Miro

"Abelard" <Ab*****@discussions.microsoft.comwrote in message
news:80**********************************@microsof t.com...
It is a window and can be minimized manually by clicking the minimize box.
The question is how to programmatically minimize it.

"Spam Catcher" wrote:
>=?Utf-8?B?QWJlbGFyZA==?= <Ab*****@discussions.microsoft.comwrote in
news:F6**********************************@microso ft.com:
How do I programmatically minimize the console window in a VB .NET
console application?

I don't think you can - since it's not a window.


Oct 13 '06 #4

P: n/a
=?Utf-8?B?QWJlbGFyZA==?= <Ab*****@discussions.microsoft.comwrote in
news:80**********************************@microsof t.com:
It is a window and can be minimized manually by clicking the minimize
box. The question is how to programmatically minimize it.
It maybe look like a Window but it is merely a container for the console
application. Unlike Winforms application console apps do not have direct
control over their windows.

You'll have to use Win32 API calls to minimize the Window:

http://www.pinvoke.net/default.aspx/...howWindow.html
Oct 13 '06 #5

P: n/a

Abelard wrote:
It is a window and can be minimized manually by clicking the minimize box.
The question is how to programmatically minimize it.
The problem is that the way you do it programatically in a Windows
Application project is by setting the Me.WindowState to Minimized. But
the WindowState property is defined in the System.Windows.Forms class
and a Console Application window is not a member of the
Systems.Windows.Forms class. To make things even worse, there is no
Console.WindowState property.

Now, I happen to agree with you, a console window is essentially a
Command Prompt window that is running a specific piece of code. And you
can minimize a Command Prompt (and a Console App) window by clicking on
the minimize button, so there should be some way to do it
programmatically, but I haven't found it. Maybe there is an API call to
do it? (Since .NET I try to avoid API calls whenever possible.)
>
"Spam Catcher" wrote:
=?Utf-8?B?QWJlbGFyZA==?= <Ab*****@discussions.microsoft.comwrote in
news:F6**********************************@microsof t.com:
How do I programmatically minimize the console window in a VB .NET
console application?
I don't think you can - since it's not a window.


Oct 13 '06 #6

P: n/a


"Miro" wrote:
I think you would have to do this through the process of the "console
window" that holds ur dos app.

take a look at this link:
http://www.thescripts.com/forum/thread382333.html

Miro

"Abelard" <Ab*****@discussions.microsoft.comwrote in message
news:80**********************************@microsof t.com...
It is a window and can be minimized manually by clicking the minimize box.
The question is how to programmatically minimize it.

"Spam Catcher" wrote:
=?Utf-8?B?QWJlbGFyZA==?= <Ab*****@discussions.microsoft.comwrote in
news:F6**********************************@microsof t.com:

How do I programmatically minimize the console window in a VB .NET
console application?

I don't think you can - since it's not a window.



Oct 13 '06 #7

P: n/a
Thanks to all of yoh for your input. The link below had exactly the answer I
needed. The console is a true window. You have to do a call to this
function with all the correct parameters to control its behavior:

Imports System.Diagnostics

Private Declare Function ShowWindow Lib "user32.dll" ( _
ByVal hWnd As IntPtr, _
ByVal nCmdShow As SHOW_WINDOW _
) As Boolean

The link Miro sent has the rest of the details. It's very nice code and a
generally
useful function.

"Miro" wrote:
I think you would have to do this through the process of the "console
window" that holds ur dos app.

take a look at this link:
http://www.thescripts.com/forum/thread382333.html

Miro

"Abelard" <Ab*****@discussions.microsoft.comwrote in message
news:80**********************************@microsof t.com...
It is a window and can be minimized manually by clicking the minimize box.
The question is how to programmatically minimize it.

"Spam Catcher" wrote:
=?Utf-8?B?QWJlbGFyZA==?= <Ab*****@discussions.microsoft.comwrote in
news:F6**********************************@microsof t.com:

How do I programmatically minimize the console window in a VB .NET
console application?

I don't think you can - since it's not a window.



Oct 13 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.