コード例 #1
0
ファイル: bibexe.cpp プロジェクト: huilang22/Projects
BOOL CBibexeApp::InitInstance()
{
	/* display the login dialog */
	CLoginDlg Ldlg;
	CBibDlg  *lpdlg;

        InitArborLocale();

	if (! (m_hGAL = LoadLibrary("gal.dll")))
	{
		CGuiMsg::GuiMessage( GUIMSG_GAL_DLL_LOAD_FAILED);
		return FALSE;
	}
	
	// initialize internationalized labels
	//-----gmf 24.03.00-----------------------------------------------------
	if (m_hbibResources)
        	::FreeLibrary(m_hbibResources);

    /* Look for a resource-only dll, regardless of language.
     */
   
    m_hbibResources = CArbResourceDLL::LoadResLibrary(_T("bibexe_res.dll"));
	
    if (! m_hbibResources)
	{
		AfxMessageBox(_T("Could not load application resource DLL.  Exiting..."));
		return FALSE;
	}

	AfxSetResourceHandle(m_hbibResources);
   CArborApp::InitInstance();

	//----------------------------------------------------------

 	Enable3dControls();

  CAccountData AccountData(TRUE, TRUE);

	//
	// Log in to the catalog database.
	//
	CArborCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	if( Ldlg.LoginToCatalog( AccountData, FALSE, &cmdInfo ) != ABP_SUCCESS )
		return FALSE;  // Logout done in destructor
	if (AccountData.LoginToAdmin() == FALSE)
		return FALSE;  // Logout done in destructor

	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Requires the securitytypes.h (or securityclass.h)
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//	if(!AccountData.m_lpSecurity->IsAllowed(SECURITY_BIB))
//	{
//		CGuiMsg::GuiMessage( GUIMSG_BIB_ACCESS_DENIED );
//		return FALSE; 
//	}


  LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	lpdlg = new CBibDlg ( AccountData );

	m_pMainWnd =  lpdlg;

	int nResponse = lpdlg->DoModal();
	delete lpdlg;
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	AccountData.Logout();

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
コード例 #2
0
ファイル: ticklerexe.cpp プロジェクト: huilang22/Projects
BOOL CTicklerexeApp::InitInstance()
{
	////////////////////////////////////////////////////////////////////////////
	// RSR Below is code copied from EFTEXE
	////////////////////////////////////////////////////////////////////////////
	CHidden			*TicklerDlg;
	CSystemData		*SystemData;
	HINSTANCE		hGal;
	BOOL			bFreed;
	CLoginDlg		Ldlg;

        InitArborLocale();

	// Had troubles creating dialog without this,so thought I'd try it.
	AfxEnableControlContainer();

	if (! (hGal = LoadLibrary("gal.dll")))
	{
		CGuiMsg::GuiMessage( GUIMSG_GAL_DLL_LOAD_FAILED);
		return FALSE;
	}

	SystemData = new CSystemData (TRUE, TRUE );

	Enable3dControls();

	//-----gmf 24.03.00-----------------------------------------------------
	if (m_hticklerResources)
        	::FreeLibrary(m_hticklerResources);

    /* Look for a resource-only dll, regardless of language.
     */
   
    m_hticklerResources = CArbResourceDLL::LoadResLibrary(_T("tickler_res.dll"));
	
    if (! m_hticklerResources)
	{
		AfxMessageBox(_T("Could not load application resource DLL.  Exiting..."));
		return FALSE;
	}

	AfxSetResourceHandle(m_hticklerResources);
   CArborApp::InitInstance();

	//----------------------------------------------------------

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	//
    // verify user to login is valid
    //
	CArborCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

  if ( Ldlg.LoginToCatalog( *SystemData, FALSE, &cmdInfo ) != ABP_SUCCESS )
	{
	   bFreed = FreeLibrary( hGal );
	   if( !bFreed )
	   {
		   DWORD dLastError;
		   char szErrorMsg[ 128 ];
		   dLastError = GetLastError();
		   sprintf( szErrorMsg, "FreeLibrary call to free gal.dll failed!!!\nLast Error: %d", dLastError );
		    GuiError(__FILE__, __LINE__, szErrorMsg );
	   }
		delete SystemData;
		return FALSE;
	   //exit( 1 );
	}

	if ((SystemData->LoginToAdmin()) == FALSE)
	{
		FreeLibrary(hGal);
		delete SystemData;
		return FALSE;
	}

	TicklerDlg = new CHidden(*SystemData, AfxGetMainWnd());
	int nResponse = TicklerDlg->DoModal();
	
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	} 

	FreeLibrary(hGal);
	FreeLibrary(m_hticklerResources);

	delete TicklerDlg;
	delete SystemData;

	// Since the dialog has been closed, return FALSE so that we exit the
	// application, rather than start the application's message pump.
	return FALSE;// Logout done in destructor

}
コード例 #3
0
ファイル: groupsexe.cpp プロジェクト: huilang22/Projects
BOOL CGroupsexeApp::InitInstance()
{
	// DLL Handles
	HINSTANCE hGAL;	

	int ReturnValue = ABP_FAILURE;

	// initialize internationalized labels
    InitArborLocale();

	//CSystemData cSystemData( TRUE, TRUE );

	if (! (hGAL = LoadLibrary("gal.dll")))
	{
		CGuiMsg::GuiMessage( GUIMSG_GAL_DLL_LOAD_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	Enable3dControls();			// Call this when using MFC in a shared DLL
  
	// initialize internationalized labels
	//-----gmf 24.03.00-----------------------------------------------------
	if (m_hGroupsResources)
        	::FreeLibrary(m_hGroupsResources);

    /* Look for a resource-only dll for Groups, regardless of language.
     */
   
    m_hGroupsResources = CArbResourceDLL::LoadResLibrary(_T("groupsexe_res.dll"));
	
    if (! m_hGroupsResources)
	{
		AfxMessageBox(_T("Could not load application resource DLL. Exiting..."));
		return FALSE;
	}

	AfxSetResourceHandle(m_hGroupsResources);
   CArborApp::InitInstance();

	//----------------------------------------------------------

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)

	/* display the login dialog */
	CLoginDlg Ldlg;
	// account data that needs passed to the dll...
	/*CAMqa66118*/
	m_lpAccountData = new CAccountData(TRUE, TRUE);
	/* verify user to login is valid */	

	CArborCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	if( (ReturnValue = Ldlg.LoginToCatalog( *m_lpAccountData, FALSE, &cmdInfo )) != ABP_SUCCESS )
	{
		DWORD dLastError;
		char szErrorMsg[ 128 ];

		dLastError = GetLastError();
		if( dLastError != 0 )
		{
			sprintf( szErrorMsg, GetIntlString(IDS_LOGIN_CATALOG_FAILED), "%d", dLastError );
		    AfxMessageBox( szErrorMsg );
		}
		DropLibraries( hGAL );
		return FALSE;
	}
	
	//Display Groups Dialog Box.
	CGroupsDlg *lpGroupsDlg;
	lpGroupsDlg = new CGroupsDlg( *m_lpAccountData );

	int nResponse = lpGroupsDlg->DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	// deallocate the memory space taken by the dlg new call
	delete lpGroupsDlg;
	DropLibraries( hGAL );
	FreeLibrary(m_hGroupsResources);

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}