Andrey Rubshtein
Andrey Rubshtein

Reputation: 20915

How to hide a console window that opens up with my application?

I have a console window which opens up together with my application. Can I somehow find its handle and hide it or at least minimize it? Suppose I can use any language (C++,C#,Visual Basic, Batch file, etc..)

I cannot remove the console, because every Matlab compiled application has one.

Upvotes: 1

Views: 2367

Answers (2)

JimInCO
JimInCO

Reputation: 189

I'm assuming that you're talking about an application that you compiled with inside MATLAB using mcc. If that's the case there is a flag that you can use.

Here's the blurb from the MATLAB documentation.

-e Suppress MS-DOS Command Window

Suppress appearance of the MS-DOS command window when generating a standalone application. Use -e in place of the -m option. This option is available for Windows only. Use with -R option to generate error logging as such:

mcc -e -R -logfile -R 'filename' -v function_name

When I deploy applications I usually leave the window open so when others see some kind of error they can report it to me. If you want to hide it definitely use the -R as suggested above to generate an error log.

Upvotes: 1

ozoli
ozoli

Reputation: 1444

To find the handle see: How can I get a process handle by its name in C++?

Or if you are using cmd.exe to launch your program consider creating your own EXE from Visual Studio or using something like Python and www.py2exe.org to convert a Python script to an EXE.

Upvotes: 1

Related Questions