Chromiumframe the entry function in Main.cpp, open main.cpp.
Contains 3 classes and _tWinMain functions.
_tWinMain is the entry function we're looking for. I made a partial comment:
1 intapientry _tWinMain (hinstance hinstance,2 hinstance hPrevInstance,3 LPTSTR lpCmdLine,4 intncmdshow)5 {6 //1. Support OLE, exit management mechanism, GDIPlus initialization, local resource management (new)7HRESULT hres =OleInitialize (NULL);8 Base:: Atexitmanager exit_manager;9 Gfx::gdiplusinitializer Gdiplus_initializer;Ten Gdiplus_initializer. Init (); OneResourcebundle::initsharedinstance (Base:: FilePath ()); AResourcebundle::getsharedinstance (). Setidconveter (NewAppidconveter ()); - - //2. Create window (including WNDCLASS registration) the View::acceleratorhandler handler; - Messageloop Loop (messageloop::type_ui); -MainwindowdelegateDelegate; -View::window::createnativewindow (NULL, Gfx::rect (), &Delegate); + Delegate. window ()->setwindowbounds (Gfx::rect (0,0, -, -), NULL); - Delegate. Window ()Show (); + A //3. Start the message loop atMessageloopforui::current ()->run (&handler); - - //4. Exit processing (new) - resourcebundle::cleanupsharedinstance (); - Gdiplus_initializer. UnInit (); - oleuninitialize (); in}
Refer to the note, found here is only more than 1.1 mentioned Win32 typical program WinMain more support OLE, exit management mechanism, GDIPlus initialization, local resource management.
1.1 Mentioned in article 1. WNDCLASS Registration 2. Creation of Windows 3. The start message loop is also wrapped and is called here. The skeleton is unchanged, just wrapping up the ornate message framework.
Register WNDCLASS and create the window here:
1 View::window::createnativewindow (NULL, Gfx::rect (), &delegate);
The message loop is here:
1 messageloopforui::current ()->run (&handler);
3 classes are Mainview/mainwindowdelegate/appidconveter, respectively.
1. The most important is the Mainwindowdelegate class, Mainwindowdelegate inherits from Windowdelegate,windowdelegate is the window Class A delegate class, The behavior of the control window is achieved by overloading the virtual function in the mainwindowdelegate. It should be mentioned that Google is completely object-oriented, rather than using the Set method in MFC for setting the behavior of a window. Such a way is ubiquitous in chromium. Don't be so dizzy as to be confused.
2. The Appidconveter class is just an auxiliary class for resource ID conversions.
3. Mainview controls the behavior of the view in the window, which simply tells the size of the view. In Mainwindowdelegate, the window's containing view is Mainview, and the size of the Windows follows the size of the containing view. (The relationship is not so simple, but it can be understood for the time being)
The next step is to learn about the view framework from _tWinMain.
1.2. Chromium source code Analysis-Chromiumframe-entry function