Thread: Black window in backgound when running app

  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    14

    Black window in backgound when running app

    Hi All,

    Just started doing a bit of GUI programming on C (Windows with MingW toolchain).

    Whenever I run any GUI app on windows, even the most basic 'hello world' app there is always a black DOS window running in the background behind the GUI app.

    Any ideas how to get rid of/ hide this??

    KD.

  2. #2

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Read this .... theForger's Win32 API Tutorial

    You have to create your programs with a different entry point than console programs and you have to link them as Windows, not Console.

    And trust me... your first excursion into windows Gui mode programming is something of an eye opener... it's C but it ain't like any C you've ever seen before.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    MinGW will always use main() as the entry point if it is available - falling back on WinMain() if main() isn't found.

    It is more common for Windows GUI apps to use WinMain() as the the entry point however.

    gg

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Codeplug View Post
    MinGW will always use main() as the entry point if it is available - falling back on WinMain() if main() isn't found.

    It is more common for Windows GUI apps to use WinMain() as the the entry point however.

    gg
    The big reason for WinMain() is the instance handle that's needed when creating windows and the show parameter that's (supposed) to be used when displaying the main window. Of course you can get that internally, but why not have it handed to you?

  6. #6
    Registered User
    Join Date
    Dec 2011
    Posts
    14
    This helped. Thanks for the quick response.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Red/black for 2D..what for 3D?
    By DerekC in forum C Programming
    Replies: 6
    Last Post: 12-09-2009, 03:18 PM
  2. Help with red black tree
    By jabajaba in forum C++ Programming
    Replies: 2
    Last Post: 11-24-2009, 12:36 AM
  3. Replies: 13
    Last Post: 12-09-2008, 11:09 AM
  4. Bringing focus to an window if app already running.
    By Unregistered in forum Windows Programming
    Replies: 2
    Last Post: 01-24-2002, 02:40 PM

Tags for this Thread