469,898 Members | 1,488 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Console Minimize not happening for MSDE Install

I am attempting to install the MSDE (SQL 2000) as a part of our application.
This requires that you run the MSDE setup.exe program from a Console mode
application, it just hangs forever part way through if executed from a
standard application.

My question is:

How can I make my console mode install application resize it's window or
minimize. The code below is what I'm currently trying which doesn't work...
the Console BOX stays full size.

Process ThisProcess;

ProcessStartInfo SetupProcess = new ProcessStartInfo();
SetupProcess.FileName = "setup.exe";
SetupProcess.Arguments = "INSTANCENAME=\"FBSQL\" /qb";

SetupProcess.WindowStyle = ProcessWindowStyle.Minimized;

ThisProcess = Process.Start(SetupProcess);
ThisProcess.WaitForExit();
Nov 15 '05 #1
3 4095
OK, so I'm a dummy, my code below requests the new process to be minimized,
which isn't what I want. What I need to know is how do I minimize or resize
my currently executing Console mode application.

"Mike Oliszewski" <mi*************@faxback.com> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
I am attempting to install the MSDE (SQL 2000) as a part of our application. This requires that you run the MSDE setup.exe program from a Console mode
application, it just hangs forever part way through if executed from a
standard application.

My question is:

How can I make my console mode install application resize it's window or
minimize. The code below is what I'm currently trying which doesn't work... the Console BOX stays full size.

Process ThisProcess;

ProcessStartInfo SetupProcess = new ProcessStartInfo();
SetupProcess.FileName = "setup.exe";
SetupProcess.Arguments = "INSTANCENAME=\"FBSQL\" /qb";

SetupProcess.WindowStyle = ProcessWindowStyle.Minimized;

ThisProcess = Process.Start(SetupProcess);
ThisProcess.WaitForExit();

Nov 15 '05 #2

Hi Mike,

Thanks for posting in this group.
Based on my understanding, your install application is a console
application. In it, you wanted to invoke setup.exe to install MSDE.
And when invoke setup.exe, you want to minimize your install application's
console window.

Actually, you can P/invoke GetConsoleWindow() to get your console window's
handle, then you can use MoveWindow() to change its size and position.
Use ShowWindow() to minize or maximize your console window.

Sample code snippet like this:
[DllImport("user32.dll")]
public static extern bool MoveWindow(IntPtr hwnd,int x,int y,int
nWidth,int nHeight,bool bRepaint);

[DllImport("kernel32.dll")]
public static extern IntPtr GetConsoleWindow();

[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hwnd,int nCmdShow);

private const int SW_MINIMIZE=6;

//in main function
IntPtr hwnd=GetConsoleWindow();
MoveWindow(hwnd,0,0,200,200,true); //Change console window's position and
size

ShowWindow(hwnd,SW_MINIMIZE);//Minimize the console window

These all works well on my machine.
Btw: SW_MINIMIZE const can be got from VB 6.0 API viewer.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #3
Thank You!!

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:ye****************@cpmsftngxa06.phx.gbl...

Hi Mike,

Thanks for posting in this group.
Based on my understanding, your install application is a console
application. In it, you wanted to invoke setup.exe to install MSDE.
And when invoke setup.exe, you want to minimize your install application's
console window.

Actually, you can P/invoke GetConsoleWindow() to get your console window's
handle, then you can use MoveWindow() to change its size and position.
Use ShowWindow() to minize or maximize your console window.

Sample code snippet like this:
[DllImport("user32.dll")]
public static extern bool MoveWindow(IntPtr hwnd,int x,int y,int
nWidth,int nHeight,bool bRepaint);

[DllImport("kernel32.dll")]
public static extern IntPtr GetConsoleWindow();

[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hwnd,int nCmdShow);

private const int SW_MINIMIZE=6;

//in main function
IntPtr hwnd=GetConsoleWindow();
MoveWindow(hwnd,0,0,200,200,true); //Change console window's position and
size

ShowWindow(hwnd,SW_MINIMIZE);//Minimize the console window

These all works well on my machine.
Btw: SW_MINIMIZE const can be got from VB 6.0 API viewer.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Steve Bishop | last post: by
10 posts views Thread by noname | last post: by
2 posts views Thread by Rosy Moss | last post: by
1 post views Thread by Paul Aspinall | last post: by
reply views Thread by Brian Smither | last post: by
7 posts views Thread by Abelard | last post: by
5 posts views Thread by =?Utf-8?B?SmFtZXMgV29uZw==?= | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.