Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Problem with the compiler?

Reply
Thread Tools

Problem with the compiler?

 
 
Jan Kassens
Guest
Posts: n/a
 
      05-06-2004
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;
}

-------------------------------
 
Reply With Quote
 
 
 
 
John Harrison
Guest
Posts: n/a
 
      05-06-2004

"Jan Kassens" <(E-Mail Removed)> wrote in message
news:c7e045$hne$07$(E-Mail Removed)-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


 
Reply With Quote
 
 
 
 
Jan Kassens
Guest
Posts: n/a
 
      05-06-2004
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
 
Reply With Quote
 
Julie
Guest
Posts: n/a
 
      05-06-2004
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).
 
Reply With Quote
 
Jan Kassens
Guest
Posts: n/a
 
      05-06-2004
Julie wrote:
> subsystem type. Follow-ups should be directed to the appropriate Windows
> programmer newsgroup(s).


Thank you.
i'll do it.
 
Reply With Quote
 
Jorge Rivera
Guest
Posts: n/a
 
      05-07-2004
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments