Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get rid of console window

0 views
Skip to first unread message

David Prout

unread,
Apr 27, 2003, 12:38:22 PM4/27/03
to
Hi,

I've only just started using .NET and having finished my first app, I want
to make a release version where I don't want a console window. I used
Managed C++ Application to set it up but I can't work out how to stop the
console window coming up behind my Form. I'm doing no Console IO.

How do I stop the console window?

David

Larry Brasfield

unread,
Apr 27, 2003, 1:37:03 PM4/27/03
to
In article <esa7jtN...@TK2MSFTNGP12.phx.gbl>,
David Prout (d...@galadai.com) says...
> Hi,
Hi.

Cease asking for it. You have two choices:

1. Alter the linker switches so that you
have /SUBSYSTEM:WINDOWS rather than
/SUBSYSTEM:CONSOLE (or not set). This is
under Project / (YourProject) Properties, in
the Linker / System node, the item called
"SubSystem".

2. Create a new project, but this time choose
"Windows Forms Application", rather than
"Console Application (.NET)". Then copy your
code to the new project.

--
-Larry Brasfield
(address munged, s/sn/h/ to reply)

David Prout

unread,
Apr 28, 2003, 12:24:08 AM4/28/03
to
Thanks for the reply.

I had tried option 1 but I then get the following error at link time:

APModels error LNK2019: unresolved external symbol _WinMain@16 referenced in
function _WinMainCRTStartup

For Option 2, I don't have either of the new Project options that you
mention. The choice I'm given is 3 variations ATL type projects, 1 Makefile
project, 4 flavours of Managed C++ projects, 3 of MFC projects and 1 Win32
project.

FYI information I am using the Microsoft Development Environment 2002 v.
7.0.9466

David


"Larry Brasfield" <larry_b...@snotmail.com> wrote in message
news:MPG.1915b5198...@msnews.microsoft.com...

Jochen Kalmbach

unread,
Apr 28, 2003, 12:32:03 AM4/28/03
to
David Prout wrote:

> "Larry Brasfield" wrote:
>
>> 1. Alter the linker switches so that you
>> have /SUBSYSTEM:WINDOWS rather than
>> /SUBSYSTEM:CONSOLE (or not set). This is
>> under Project / (YourProject) Properties, in
>> the Linker / System node, the item called
>> "SubSystem".
>

> APModels error LNK2019: unresolved external symbol _WinMain@16
> referenced in function _WinMainCRTStartup


You have to replace the "main" function with this one:

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow);


--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/useritems/leakfinder.asp

David Prout

unread,
Apr 28, 2003, 12:47:36 AM4/28/03
to
WinMain did the trick!

Thanks,

David


"Jochen Kalmbach" <nospam-Joch...@holzma.de> wrote in message
news:Xns936B427568624Jo...@127.0.0.1...

Larry Brasfield

unread,
Apr 28, 2003, 1:06:48 AM4/28/03
to
In article <uHsyA4TD...@TK2MSFTNGP10.phx.gbl>,
David Prout (d...@galadai.com) says...
> Thanks for the reply.
You're welcome.


> I had tried option 1 but I then get the following error at link time:
>
> APModels error LNK2019: unresolved external symbol _WinMain@16 referenced in
> function _WinMainCRTStartup

I guess that means you are not trying to
create a Windows app, one that creates
one or more windows. I guessed, from
your comment that you did not want the
console window, that you had written
a Windows app. That may be incorrect.

> For Option 2, I don't have either of the new Project options that you
> mention. The choice I'm given is 3 variations ATL type projects, 1 Makefile
> project, 4 flavours of Managed C++ projects, 3 of MFC projects and 1 Win32
> project.

It would help to know what you intend
to have when this all works. Do you
want to put up UI using the managed
C++ Forms package? Or do you want
to go straight to GDI, in classic
Windows app fashion, with a message
pump? In either case, you ought to
have a WinMain() function rather
than a main(). If you are doing the
former, (managed C++), then to avoid
having a console window, you would
still provide the linker the option
/subsystem:windows
and write a WinMain().

If you are not intending to put up
window(s), then why do you wish to
eliminate the console window?

You've really got me confused. What
are you trying to do? Where is your
program's output supposed to go? How
is it supposed to get input?

> FYI information I am using the Microsoft Development Environment 2002 v.
> 7.0.9466

In the just-released 2003 version,
some application types are renamed,
a move that I suppose is meant to
avoid confusion such as you had.

David Prout

unread,
Apr 28, 2003, 3:17:44 AM4/28/03
to
I didn't want a console App, it's a pure managed Windows App.

It could be that I used the wrong project template to create the project
(Managed C++ Application) though all my Forms (windows) work fine. The
problem was that that project creates the inital .cpp with:

int _tmain(void)

and I didnt realise this effectively made it a console app. Just changing
it to WinMain worked fine.

Thanks for the help,

David

"Larry Brasfield" <larry_b...@snotmail.com> wrote in message

news:MPG.191656c5e...@msnews.microsoft.com...

0 new messages