Friday, August 27, 2021

WinMain() in MFC application

WinMain() in MFC application

  1. In a typical MFC application we never write WinMain() function so how is it possible to compile and link a windows program with out WinMain()?
  2. In a typical MFC application we never write WinMain() function so how is it possible to compile and link a windows program with out WinMain()?

  3. MFC under the hood
  4. it has an example to be a template.

    Explains the basic MFC program flow including where WinMain and the message loop are hidden.

  5. what's start function in MFC application?
  6. 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 ?

    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[^].

  7. x86 Disassembly/Windows Executable Files
  8. PE Optional Header The "PE Optional Header" is not "optional" per se, because it is required in Executable files, but not in COFF object files. There are two different versions of the optional header depending on whether or not the file is 64 bit or 32 bit. The Optional header includes lots and lots of information that can be used to pick apart the file structure, and obtain some useful information about it.

    The PE Optional Header occurs directly after the COFF header, and some sources even show the two headers as being part of the same structure. This wikibook separates them out for convenience.

    Here is the 64 bit PE Optional Header presented as a C data structure:

  9. where is main in MFC application?
  10. where is main in MFC application.

  11. In MFC, how can WinMain function find user application object's address value?
  12. Greeting, I'm novice in MFC area.

    I have a question about process of starting MFC application.

    I learned that unlike SDK program, I don't have to write WinMain. Because It is supplied by the class library and is called when the application starts up.* (See reference here : https://msdn.microsoft.com/en-us/library/akdx0603.aspx)

    And my curious part is here: *Then CWinApp calls member functions of the application object to initialize and run the application.

    That sentence indicates that CWinApp already know address value of application object which is made by a programmer.

    However, even though application object is defined as global variable, how can WinMain function find application object's address value?

  13. CWinApp: The Application Class
  14. The main application class in MFC encapsulates the initialization, running, and termination of an application for the Windows operating system. An application built on the framework must have one and only one object of a class derived from CWinApp. This object is constructed before windows are created..

    Win32 application

  15. WinMain: The Application Entry Point
  16. Every Windows program includes an entry-point function that is named either WinMain or wWinMain. Here is the signature for wWinMain..

  17. Module 1. Your First Windows Program
  18. In this module, we will write a minimal Windows desktop program. All it does is create and show a blank window. This first program contains about 50 lines of code, not counting blank lines and comments. It will be our starting point; later we'll add graphics, text, user input, and other features.

  19. VC++ Tool: MFC under the hood, WinMain, VC++ Programmer
  20. Explains the basic MFC program flow including where WinMain and the message loop are hidden .

No comments:

Post a Comment