Click here to Skip to main content
13,556,387 members
Rate this:
Please Sign up or sign in to vote.
See more:
I had a MFC Application, I want to integrated a code to This App. But It not true worked. When I writing the code on the Other MFC Application (A App I'm create to Testing this code). It worked !!!!! I think when start up Solution, The my 1st App is defind some header, or lib or something. Maybe It makes the program does not work properly.!
Thank and best Regards !

In Other C/C++ Project, The Function to start alway is void main(), or int main();
But in MFC, there don't having the main Function !!!!

I think the "virtual BOOL InitInstance();" in the MySolustionName.cpp
This Function's calling the Start form ?
Posted 21-Nov-13 15:30pm
Updated 21-Nov-13 15:52pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

This is called "entry point":[^].

In Windows, the conventional entry point is WinMain:[^].

In an MFC application, the entry point is hidden in the library, reportedly, in the file "Appmodule.cpp". Actually, the entry point name is defined as _tWinMain, which is a generic name for Unicode ("wide" wWinMain) and non-Unicode (WinMain) entry-point names, a way to abstract out from Unicode option.

This CodeProject article explains how it works with MFC: MFC under the hood[^].

See the section "So, what happened to good old WinMain?"… :-)


Now, some advanced background information:

We can see that different platforms based on PE files ([^]) use different names for entry-point functions, and also, for different Windows-based platforms and/or frameworks, one entry point function calls another "secondary" entry function which is the only one exposed to the framework user. We can investigate it all, but does it make much sense? Ultimately, even the very top function on the call stack, "real" entry point, does not have to have a certain standard name. This is so because that "real" entry point is found not by the name, but by the address in the header structure used for this purpose. Please see:[^].

leemanhj916 21-Nov-13 22:24pm
Thank. !
I have to view this !
SAKryukov 21-Nov-13 22:25pm
I added more background information, after [EDIT].
Will you accept my answer formally now (green "Accept" button)?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01-2016 | 2.8.180515.1 | Last Updated 21 Nov 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100