Annotation of mstools/mfc/src/winmain.cpp, revision 1.1.1.2

1.1       root        1: // This is a part of the Microsoft Foundation Classes C++ library.
                      2: // Copyright (C) 1992 Microsoft Corporation
                      3: // All rights reserved.
                      4: //
                      5: // This source code is only intended as a supplement to the
                      6: // Microsoft Foundation Classes Reference and Microsoft
                      7: // QuickHelp documentation provided with the library.
                      8: // See these sources for detailed information regarding the
                      9: // Microsoft Foundation Classes product.
                     10: 
                     11: #include "afxwin.h"
                     12: #pragma hdrstop
                     13: 
                     14: #ifdef AFX_CORE_SEG
                     15: #pragma code_seg(AFX_CORE_SEG)
                     16: #endif
                     17: 
                     18: /////////////////////////////////////////////////////////////////////////////
                     19: // Standard WinMain implementation
                     20: //  Can be replaced as long as 'AfxWinInit' is called first
                     21: 
                     22: #ifndef _WINDLL
                     23: extern "C"
                     24: int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                     25:        LPSTR lpCmdLine, int nCmdShow)
                     26: {
                     27:        int nReturnCode = -1;
                     28: 
                     29:        // AFX internal initialization
                     30:        if (!AfxWinInit(hInstance, hPrevInstance, lpCmdLine, nCmdShow))
                     31:                goto InitFailure;
                     32: 
                     33:        // App global initializations (rare)
                     34:        if (hPrevInstance == NULL && !AfxGetApp()->InitApplication())
                     35:                goto InitFailure;
                     36: 
                     37:        // Perform specific initializations
                     38:        if (!AfxGetApp()->InitInstance())
                     39:                goto InitFailure;
                     40: 
                     41:        nReturnCode = AfxGetApp()->Run();
                     42: 
                     43: InitFailure:
                     44:        AfxWinTerm();
                     45:        return nReturnCode;
                     46: }
                     47: #else
                     48: // _WINDLL initialization
                     49: 
1.1.1.2 ! root       50: #ifndef _NTWIN
1.1       root       51: extern "C"
                     52: int FAR PASCAL LibMain(HINSTANCE hInstance,
                     53:        WORD wDataSegment, WORD wHeapSize, LPSTR lpszCmdLine)
                     54: {
                     55:        // Initialize DLL's instance(/module) not the app's
                     56:        if (!AfxWinInit(hInstance, NULL, lpszCmdLine, 0))
                     57:        {
                     58:                AfxWinTerm();
                     59:                return 0;       // Init Failed
                     60:        }
                     61: 
                     62:        // initialize the single instance DLL
                     63:        if (!AfxGetApp()->InitInstance())
                     64:        {
                     65:                AfxWinTerm();
                     66:                return 0;
                     67:        }
                     68: 
                     69:        // nothing to run
                     70:        return 1;   // ok
                     71: }
1.1.1.2 ! root       72: #else //_NTWIN
        !            73: 
        !            74: extern "C" BOOL WINAPI
        !            75: _CRT_INIT(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved);
        !            76: 
        !            77: extern "C" int APIENTRY
        !            78: LibMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
        !            79: {
        !            80:        // Initialize the C/C++ runtime first
        !            81:        if (!_CRT_INIT(hInstance, dwReason, lpReserved))
        !            82:        {
        !            83:                return 0;               // CRT init Failed
        !            84:        }
        !            85: 
        !            86:        // Initialize DLL's instance(/module) not the app's
        !            87:        if (!AfxWinInit(hInstance, NULL, "", 0))
        !            88:        {
        !            89:                AfxWinTerm();
        !            90:                return 0;       // Init Failed
        !            91:        }
        !            92: 
        !            93:        // initialize the single instance DLL
        !            94:        if (!AfxGetApp()->InitInstance())
        !            95:        {
        !            96:                AfxWinTerm();
        !            97:                return 0;
        !            98:        }
        !            99: 
        !           100:        // nothing to run
        !           101:        return 1;   // ok
        !           102: }
        !           103: #endif //_NTWIN
1.1       root      104: 
                    105: #endif //_WINDLL
                    106: 
                    107: /////////////////////////////////////////////////////////////////////////////

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.