Problem with the compiler?

J

Jan Kassens

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;
}

-------------------------------
 
J

John Harrison

Jan Kassens said:
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
 
J

Jan Kassens

John said:
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 ;)
 
J

Julie

Jan said:
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).
 
J

Jorge Rivera

Jan said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top