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

  • Home
  • SEARCH
  • 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 140231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:34:39+00:00 2026-05-11T07:34:39+00:00

Windows GUI applications written in C/C++ have ‘WinMain’ as an entry point (rather than

  • 0

Windows GUI applications written in C/C++ have ‘WinMain’ as an entry point (rather than ‘main’). My understanding of this is that the compiler generates a ‘main’ function to be called by the C Runtime. This ‘main’ function sets up the necessary environment for the GUI and calls into ‘WinMain’ (specifying the instance handles etc.).

In short, I believe console and GUI application startup to differ in the following way:

Console application: C Runtime –> ‘main’ function (hand-coded)

GUI application: C Runtime –> ‘main’ function (compiler-generated) –> ‘WinMain’ function (hand-coded)

I would like to both validate this understanding and find out how I can hand-code a Windows GUI with just a ‘main’ function (i.e. without having to write ‘WinMain’).

  • 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. 2026-05-11T07:34:40+00:00Added an answer on May 11, 2026 at 7:34 am

    You have an incorrect understanding. The difference between main and WinMain, apart from some differet initialization code, is the parameters passed to it.

    main looks like this:

    int main(int argc, char* argv[]); 

    While WinMain looks like this:

    int WINAPI WinMain(HINSTANCE hInstance,     HINSTANCE hPrevInstance,     LPSTR lpCmdLine,     int nCmdShow ); 

    Something has to setup those parameters and make the call, and that’s the startup code. When you compile and link a program, one of the linker parameters is the entry point, and that will be, depending on a console or GUI app, a different bit of startup code.

    You can certainly write your own startup code, just go into your visual c++ source directory and you can find the startup code, it’s called crt0.c and it’s in the VC\crt\src directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 85k
  • Answers 85k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The best way to get the right behavior is to… May 11, 2026 at 5:16 pm
  • Editorial Team
    Editorial Team added an answer In no specific order : OnTime Details: http://www.axosoft.com/products/ontime_overview.aspx?cn=ovr_email2ticket FogBugz Details:… May 11, 2026 at 5:16 pm
  • Editorial Team
    Editorial Team added an answer If you're using Visual Studio you can do the following.… May 11, 2026 at 5:16 pm

Related Questions

Windows GUI applications written in C/C++ have 'WinMain' as an entry point (rather than
I need to change the functionality of an application based on the executable name.
Background: I'm currently debugging an application written over a custom-built GUI framework in C++.
I'm interested in building a PC for a car that will boot off of
I have a windows service written in C# that acts as a proxy for

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.