Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions | Private Attributes
CBrowseApp Class Reference

#include <cbrowse.h>

Collaboration diagram for CBrowseApp:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CBrowseApp ()
virtual BOOL InitInstance ()
virtual int ExitInstance ()
virtual int Run ()

Private Member Functions

BOOL InitATL ()

Private Attributes

CBrowseDlgm_pDlg
BOOL m_bATLInited

Detailed Description

Definition at line 24 of file cbrowse.h.


Constructor & Destructor Documentation

Definition at line 32 of file cbrowse.cpp.

{
       // TODO: add construction code here,
       // Place all significant initialization in InitInstance
}

Member Function Documentation

Definition at line 130 of file cbrowse.cpp.

{
       if (m_bATLInited)
       {
              _Module.RevokeClassObjects();
              _Module.Term();
              CoUninitialize();
       }
       return CWinApp::ExitInstance();
}
BOOL CBrowseApp::InitATL ( ) [private]

Definition at line 142 of file cbrowse.cpp.

{
       m_bATLInited = TRUE;

       HRESULT hRes;

#if _WIN32_WINNT >= 0x0400
       // hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
#else
       // hRes = CoInitialize(NULL);
#endif
       if (!AfxOleInit())
       {
              return FALSE;
       }


       //if (FAILED(hRes))
       //{
       //     m_bATLInited = FALSE;
       //     return FALSE;
       //}

       _Module.Init(ObjectMap, AfxGetInstanceHandle());
       _Module.dwThreadID = GetCurrentThreadId();

       LPTSTR lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT
       TCHAR szTokens[] = _T("-/");

       BOOL bRun = TRUE;
       LPCTSTR lpszToken = _Module.FindOneOf(lpCmdLine, szTokens);
       while (lpszToken != NULL)
       {
              if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
              {
                     _Module.UpdateRegistryFromResource(IDR_CBROWSE, FALSE);
                     _Module.UnregisterServer(TRUE); //TRUE means typelib is unreg'd
                     bRun = FALSE;
                     break;
              }
              if (lstrcmpi(lpszToken, _T("RegServer"))==0)
              {
                     _Module.UpdateRegistryFromResource(IDR_CBROWSE, TRUE);
                     _Module.RegisterServer(TRUE);
                     bRun = FALSE;
                     break;
              }
              lpszToken = _Module.FindOneOf(lpszToken, szTokens);
       }

       if (!bRun)
       {
              m_bATLInited = FALSE;
              _Module.Term();
              CoUninitialize();
              return FALSE;
       }

       hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, 
              REGCLS_MULTIPLEUSE);
       if (FAILED(hRes))
       {
              m_bATLInited = FALSE;
              CoUninitialize();
              return FALSE;
       }      

       return TRUE;
}

Here is the call graph for this function:

Definition at line 46 of file cbrowse.cpp.

{
       // Initialize OLE libraries
       if (!AfxOleInit())
       {
              return FALSE;
       }
//     if (!InitATL())
//            return FALSE;

       AfxEnableControlContainer();
       _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, 
              REGCLS_MULTIPLEUSE);


       // Standard initialization
       // If you are not using these features and wish to reduce the size
       //  of your final executable, you should remove from the following
       //  the specific initialization routines you do not need.

#ifdef _AFXDLL
       Enable3dControls();                // Call this when using MFC in a shared DLL
#else
       Enable3dControlsStatic();   // Call this when linking to MFC statically
#endif

       int nResponse;

       CPickerDlg pickerDlg;
       nResponse = pickerDlg.DoModal();
       if (nResponse != IDOK)
       {
              return FALSE;
       }

       m_pDlg = new CBrowseDlg;
       m_pDlg->m_clsid = pickerDlg.m_clsid;
       m_pDlg->m_bUseCustomDropTarget = pickerDlg.m_bUseCustom;
       m_pDlg->m_bUseCustomPopupMenu = pickerDlg.m_bUseCustom;
       m_pDlg->Create(IDD_CBROWSE_DIALOG);
       m_pMainWnd = m_pDlg;

       // Since the dialog has been closed, return FALSE so that we exit the
       //  application, rather than start the application's message pump.
       return TRUE;
}
int CBrowseApp::Run ( ) [virtual]

Definition at line 212 of file cbrowse.cpp.

{
    int rv = 1;
    try {
        rv = CWinApp::Run();
    }
    catch (CException *e)
    {
        ASSERT(0);
    }
    catch (...)
    {
        ASSERT(0);
    }
    return rv;
}

Member Data Documentation

Definition at line 46 of file cbrowse.h.

Definition at line 45 of file cbrowse.h.


The documentation for this class was generated from the following files: