Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 243421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:55:11+00:00 2026-05-11T20:55:11+00:00

I really have no idea why this is happening… I created a win32 application

  • 0

I really have no idea why this is happening…
I created a win32 application in emacs, and whenever I make it and run it (not through the command prompt), a command prompt window pops up under the window. If I build a win32 application in Code::Blocks, and just run its default template, then it runs without a command prompt window. I looked all through the code of both and can’t figure out what might cause this…

I thought it was because I included some printf() statements in there, but I didn’t want them to stay there (they were for debugging), so I wrote a macro:

#define DEBUG

in main.c, and

#ifdef DEBUG
#include<stdio.h>
#define DBG printf
#else
#define DBG
#endif

in a header (included after the #define DEBUG of course).

When I undef’d DEBUG, the window still showed up… I don’t know what I am doing to make it happen, what sorts of things cause a command prompt window to show up in a win32 application? I tried using all the ****Ex() windows functions instead of just CreateWindow(), etc, but that didn’t change anything. I checked and re-checked the class definition and registration, to no avail, and made sure I didn’t forget a printf() statement (which would have caused an error even if I did, since stdio.h isn’t included unless DEBUG is defined).

This is what I included:

#include<windows.h>
#include<windowsx.h>
#include"main.h"
#include"windowproc.h"

anyone know what can cause this? I even commented out all of my stdio, DBG, printf junk, and it still showed up, and I swear there’s no difference between my code and the Code::Blocks generated code, aside from my use of HANDLE_MSG and a few extra functions to split up the code.

Update

I am using MinGW 3.4.5.
using the -mwindows switch worked, thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:55:11+00:00Added an answer on May 11, 2026 at 8:55 pm

    Try linking with the -mwindows switch.

    Your program should also have the main method read like so:

    int WINAPI WinMain(
    ....
    )
    

    as opposed to the traditional int main().

    Related threads:

    • Why does my QT4.5 app open a console window under Windows?
    • GCC / C how to hide console window?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing this because I have really no idea why this is happening.
I have really no idea why I'm asking this as this a really completely
This probably sounds really stupid but I have noo idea how to implement jquery's
I really have no idea how this is done, it should be simple but
It doesn't really have to add newlines, just something readable. Anything better than this?
Im not a high level programmer. I do not understand all this stuff really
I have this template I have been working with and I am really stuck
I have no idea why this isn't working. I've taken code from a previous
I'm not sure, if this is really a question or more an observation -
I don't know why this is happening. I have this code here . It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.