PC Review


Reply
Thread Tools Rate Thread

Howto hide a console app window and don't show it in the taskbar

 
 
klwizzard
Guest
Posts: n/a
 
      9th Jun 2008
Hello at all,

I want to use an console application as an host.
In one other component I want to implement an tray Icon.
For this case I want to hide the consoleapp window after starting dthe
application.
Also I don't want that console app window will shown in the taskbar.

Here are my questions:
1. : How can I find a sample or further information about hiding the window
after application start?
2. : How can I find a sample or further information about to avoid that the
console app window will shohn in the task bar?

Thanks for your time and your help.

Best regards
Detlev


 
Reply With Quote
 
 
 
 
Marc Gravell
Guest
Posts: n/a
 
      9th Jun 2008
Just don't build it as a console exe; build it as a windows exe and
there will be no console.
The console is an OS-level flag in the PE header; disabling it at
runtime is tricky at best...

Marc
 
Reply With Quote
 
 
 
 
klwizzard
Guest
Posts: n/a
 
      9th Jun 2008
Hello Marc,

thanks a lot for your fast help.
I' afraid that this will simpliest the solution for my problem.
I will take this way for my solution.
I'm not a experianced framework developer, what means the PE header?

Best regards
Detlev

"Marc Gravell" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> Just don't build it as a console exe; build it as a windows exe and there
> will be no console.
> The console is an OS-level flag in the PE header; disabling it at runtime
> is tricky at best...
>
> Marc



 
Reply With Quote
 
Marc Gravell
Guest
Posts: n/a
 
      9th Jun 2008
PE means Portable Executable; it is the file format that windows "exe"
files use (and in fact "dll"s too).

At the start of this file is the header, which has some flags to tell
the OS what to do with it. One of these flags indicates whether that
process will need a console.

So basically - when you compile, it sets this flag depending on whether
you have chosen your project as a windows exe or a console exe. Just
change it to a windows exe.

Marc
 
Reply With Quote
 
klwizzard
Guest
Posts: n/a
 
      9th Jun 2008
Hello Marc,

thanks a lot for your fast and detailed help.
I will later more learn about PE and the using of it.

Best regrads
Detlev

"Marc Gravell" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> PE means Portable Executable; it is the file format that windows "exe"
> files use (and in fact "dll"s too).
>
> At the start of this file is the header, which has some flags to tell the
> OS what to do with it. One of these flags indicates whether that process
> will need a console.
>
> So basically - when you compile, it sets this flag depending on whether
> you have chosen your project as a windows exe or a console exe. Just
> change it to a windows exe.
>
> Marc



 
Reply With Quote
 
klwizzard
Guest
Posts: n/a
 
      13th Jun 2008
Hello Mike,

many thanks for the snippet.
Sorry for my late answer, I've checked this thread not for a while.

Best regards
Detlev

"Michael D. Ober" <obermd.@.alum.mit.edu.nospam.> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> "klwizzard" <(E-Mail Removed)> wrote in message
> news:uhN$(E-Mail Removed)...
>> Hello at all,
>>
>> I want to use an console application as an host.
>> In one other component I want to implement an tray Icon.
>> For this case I want to hide the consoleapp window after starting dthe
>> application.
>> Also I don't want that console app window will shown in the taskbar.
>>
>> Here are my questions:
>> 1. : How can I find a sample or further information about hiding the
>> window after application start?
>> 2. : How can I find a sample or further information about to avoid that
>> the console app window will shohn in the task bar?
>>
>> Thanks for your time and your help.
>>
>> Best regards
>> Detlev

>
> Here's the code in VB
>
> ' Windows API to minimize the console window after initialization
> Private Declare Function GetConsoleWindow Lib "kernel32.dll" () As IntPtr
> Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As
> IntPtr, ByVal nCmdShow As Int32) As Int32
> Private Const SW_SHOWMINNOACTIVE As Int32 = 7
> Private Const SW_SHOWNORMAL As Int32 = 1
> Private Const SW_HIDE as Int32 = 0
>
> ' In the code
> ShowWindow(GetConsoleWindow(), SW_HIDE)
>
> Mike.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RDP vs Console - Need to run app over RDP, need to report Console to App. DrewYK Windows XP Work Remotely 2 22nd Jun 2007 05:19 PM
Service App, Form App, or Console App? Chris S Microsoft C# .NET 2 5th Jun 2006 02:07 PM
What makes a console app a console app? Everyman Microsoft C# .NET 4 29th Jan 2006 08:12 AM
howto make a console app start with window minimized Paul Microsoft VB .NET 5 19th Jan 2006 09:54 PM
Help with app that is EITHER console app OR Windows app Fred Iannon Microsoft Dot NET 1 29th Oct 2004 07:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:54 PM.