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 6174121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:41:54+00:00 2026-05-23T23:41:54+00:00

For a sample program, though this is doing all good for me. But I

  • 0

For a sample program, though this is doing all good for me. But I was wondering how is it happening.

I created a console application with “MFC” checkbox enabled while creating the project (VC2008).
It created standard _tmain implementaion with AfxWinInit calls and all. Then I wrote my custom function Main and called it from _tmain itself.

Now as soon as press F10 or F11 to START debugging, it goes into Main and not _tmain (yes, via _tmain itself) – How and Why – that’s the question.

No I didn’t set any project setting at all. this is about 32-bit Debug build.

EDIT: The interesting thing is this:

#include "stdafx.h"

void Main()
{
    printf("This is custom main");
}

int _tmain(int argc, _TCHAR* argv[])
{
    if(false) // Getting fooled, or fooling us?
        Main();

    return 0;
}

Visual Studio considers Main as entry point, and doesn’t do anything when I start debugging with F10/F11 – since false is false and doesn’t allow Main to be called!

  • 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-23T23:41:55+00:00Added an answer on May 23, 2026 at 11:41 pm

    My test shows it goes to _tmain first, before custom Main.

    enter image description here

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

Sidebar

Related Questions

I'm having trouble getting a sample program to link correctly (in this case against
I am familiar with MVC/MVP though my question is simple, I'm about to program
I wrote a sample program at http://codepad.org/ko8vVCDF that uses a template function. How do
I have written some sample program and DLL to learn the concept of DLL
Having successfully gotten a sample program working, I'm now starting to do Real Work
I want to do a sample program in PHP on Windows XP. Do I
Below I have written a sample program that I have written to learn about
I'm trying to run the sample program, which comes with Google Data API. I
I was cheating from a sample program to integrate with Flash. I able to
I have a program that returns a comma-separated string of numbers after doing some

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.