Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC MFC/C++
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
Edited 21-Nov-13 15:52pm
v3

1 solution

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

Solution 2

This is called "entry point": http://en.wikipedia.org/wiki/Entry_point[^].
 
In Windows, the conventional entry point is WinMain: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633559%28v=vs.85%29.aspx[^].
 
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?"… Smile | :)
 
[EDIT]
 
Now, some advanced background information:
 
We can see that different platforms based on PE files (http://en.wikipedia.org/wiki/Portable_Executable[^]) 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:
http://en.wikibooks.org/wiki/X86_Disassembly/Windows_Executable_Files#PE_Optional_Header[^].
 
—SA
  Permalink  
v5
Comments
Mạnh Lê at 21-Nov-13 22:24pm
   
Thank. !
I have to view this !
Sergey Alexandrovich Kryukov at 21-Nov-13 22:25pm
   
I added more background information, after [EDIT].
Will you accept my answer formally now (green "Accept" button)?
—SA

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

  Print Answers RSS
0 OriginalGriff 371
1 Sergey Alexandrovich Kryukov 286
2 RyanDev 75
3 PhilLenoir 70
4 Pheonyx 50
0 Sergey Alexandrovich Kryukov 6,676
1 OriginalGriff 6,056
2 CPallini 2,473
3 Richard MacCutchan 1,697
4 Abhinav S 1,560


Advertise | Privacy | Mobile
Web02 | 2.8.140821.2 | Last Updated 21 Nov 2013
Copyright © CodeProject, 1999-2014
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