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

Problem with the compiler?

P: n/a
Hi NG
I've written this little test-program. Why does it open a console/cmd
shell and how to prevent this? Is it a problem with my compiler (Dev-C++
4.9.8.0 from Source-Forge)?

-------------CODE--------------

#include <windows.h>

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR
szCmdLine, int iCmdShow)
{
while (true){
// do nothing
}
return 0;
}

-------------------------------
Jul 22 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a

"Jan Kassens" <Ja*********@web.de> wrote in message
news:c7*************@news.t-online.com...
Hi NG
I've written this little test-program. Why does it open a console/cmd
shell and how to prevent this? Is it a problem with my compiler (Dev-C++
4.9.8.0 from Source-Forge)?

-------------CODE--------------

#include <windows.h>

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR
szCmdLine, int iCmdShow)
{
while (true){
// do nothing
}
return 0;
}


I think you'll find the following opens a console.

int main()
{
while (true)
{
}
}

john
Jul 22 '05 #2

P: n/a
John Harrison wrote:
I think you'll find the following opens a console.


Sorry u misunderstand me. I don't want to open the console. I'll have a
program without a console and without any window.

PS: i'm not a native English-speaker ;)
Jul 22 '05 #3

P: n/a
Jan Kassens wrote:

Hi NG
I've written this little test-program. Why does it open a console/cmd
shell and how to prevent this? Is it a problem with my compiler (Dev-C++
4.9.8.0 from Source-Forge)?

-------------CODE--------------

#include <windows.h>

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR
szCmdLine, int iCmdShow)
{
while (true){
// do nothing
}
return 0;
}

-------------------------------


It has to do w/ the subsystem type for the generated executable. For Windows
apps, there are several types (such as console, windows, posix).

You will need to consult your compiler documentation to see how to change the
subsystem type. Follow-ups should be directed to the appropriate Windows
programmer newsgroup(s).
Jul 22 '05 #4

P: n/a
Julie wrote:
subsystem type. Follow-ups should be directed to the appropriate Windows
programmer newsgroup(s).


Thank you.
i'll do it.
Jul 22 '05 #5

P: n/a
Jan Kassens wrote:
John Harrison wrote:
I think you'll find the following opens a console.

Sorry u misunderstand me. I don't want to open the console. I'll have a
program without a console and without any window.

PS: i'm not a native English-speaker ;)


I don't know of a way to do that. You can have a window and hide it,
but internally, it either runs os a Windows program or as a console program.

I would love to be wrong about this, though.

Jorge L.
Jul 22 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.