当前位置: 首页>>代码示例>>C++>>正文


C++ CWinApp::InitApplication方法代码示例

本文整理汇总了C++中CWinApp::InitApplication方法的典型用法代码示例。如果您正苦于以下问题:C++ CWinApp::InitApplication方法的具体用法?C++ CWinApp::InitApplication怎么用?C++ CWinApp::InitApplication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CWinApp的用法示例。


在下文中一共展示了CWinApp::InitApplication方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DoInit

BOOL DoInit()
{
	HINSTANCE hInstance = g_Instance;
	int nReturnCode = -1;
	CWinThread* pThread = AfxGetThread();
	CWinApp* pApp = AfxGetApp();

	// AFX internal initialization
	if (!AfxWinInit(hInstance, NULL, TEXT(""), SW_SHOW))
		return DoExit();

	// App global initializations (rare)
	if (pApp != NULL && !pApp->InitApplication())
		return DoExit();

	// Perform specific initializations
	if (!pThread->InitInstance())
	{
		if (pThread->m_pMainWnd != NULL)
		{
			TRACE(traceAppMsg, 0, "Warning: Destroying non-NULL m_pMainWnd\n");
			pThread->m_pMainWnd->DestroyWindow();
		}
		nReturnCode = pThread->ExitInstance();
		return DoExit();
	}

	return TRUE;
}
开发者ID:YOlodfssdf,项目名称:evolution3d,代码行数:29,代码来源:DllInterface.cpp

示例2: main

//------------------------------------------------------------------
// main
//------------------------------------------------------------------
void main()
{

    CWinApp* pApp = AfxGetApp();

    pApp->InitApplication();
    pApp->InitInstance();
    pApp->Run();

    CMyDoc* pMyDoc = new CMyDoc;
    CMyView* pMyView = new CMyView;
    CFrameWnd* pMyFrame = (CFrameWnd*)pApp->m_pMainWnd;

    // output Message Map construction
    AFX_MSGMAP* pMessageMap = pMyView->GetMessageMap();
    cout << endl << "CMyView Message Map : " << endl;
    MsgMapPrinting(pMessageMap);

    pMessageMap = pMyDoc->GetMessageMap();
    cout << endl << "CMyDoc Message Map : " << endl;
    MsgMapPrinting(pMessageMap);

    pMessageMap = pMyFrame->GetMessageMap();
    cout << endl << "CMyFrameWnd Message Map : " << endl;
    MsgMapPrinting(pMessageMap);

    pMessageMap = pApp->GetMessageMap();
    cout << endl << "CMyWinApp Message Map : " << endl;
    MsgMapPrinting(pMessageMap);
}
开发者ID:alannet,项目名称:example,代码行数:33,代码来源:MY.CPP

示例3: main

int main(void)
{
	CWinApp* pApp = AfxGetApp();

	pApp->InitApplication();
	pApp->InitInstance();
	pApp->Run();


	CMyDoc* pMyDoc = new CMyDoc;
	CMyView* pMyView = new CMyView;
	CFrameWnd* pMyFrame = (CFrameWnd*)pApp->m_pMainWnd;
	pMyFrame->m_pViewActive = pMyView;
	pMyView->m_pDocument = pMyDoc;


	std::cout << std::endl << "pMyFrame received a WM_CREATE, routing path : " << std::endl;
	AfxWndProc(0, WM_CREATE, 0, 0, pMyFrame);

	std::cout << std::endl << "pMyView received a WM_COMMAND, routing path : " << std::endl;
	AfxWndProc(0, WM_COMMAND, 0, 0, pMyView);

	std::cout << std::endl << "pMyFrame received a WM_COMMAND, routing path : " << std::endl;
	AfxWndProc(0, WM_COMMAND, 0, 0, pMyFrame);


	system("pause");
	return 0;
}
开发者ID:chengguixing,项目名称:iArt,代码行数:29,代码来源:MY.cpp

示例4: AfxWinMain

int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
	LPTSTR lpCmdLine, int nCmdShow)
{
	ASSERT(hPrevInstance == NULL);

	int nReturnCode = -1;
	__try
	{
	CWinThread* pThread = AfxGetThread();
	CWinApp* pApp = AfxGetApp();

	// AFX internal initialization
	if (!AfxWinInit(hInstance, hPrevInstance, lpCmdLine, nCmdShow))
		goto InitFailure;

	// App global initializations (rare)
	if (pApp != NULL && !pApp->InitApplication())
		goto InitFailure;

	// Perform specific initializations
	if (!pThread->InitInstance())
	{
		if (pThread->m_pMainWnd != NULL)
		{
			TRACE(traceAppMsg, 0, "Warning: Destroying non-NULL m_pMainWnd\n");
			pThread->m_pMainWnd->DestroyWindow();
		}
		nReturnCode = pThread->ExitInstance();
		goto InitFailure;
	}
	nReturnCode = pThread->Run();

InitFailure:
#ifdef _DEBUG
	// Check for missing AfxLockTempMap calls
	if (AfxGetModuleThreadState()->m_nTempMapLock != 0)
	{
		TRACE(traceAppMsg, 0, "Warning: Temp map lock count non-zero (%ld).\n",
			AfxGetModuleThreadState()->m_nTempMapLock);
	}
	AfxLockTempMaps();
	AfxUnlockTempMaps(-1);
#else
	;
#endif
	}
	__except(RecordExceptionInfo(GetExceptionInformation()))
	{
	}

	// must call AfxWinTerm after handling exception or we'll crash
	// again trying to destroy the tooltip window

	AfxWinTerm();

	return nReturnCode;
}
开发者ID:danieljennings,项目名称:p4win,代码行数:57,代码来源:ExceptionAttacher.cpp

示例5: main

void main()
{
	CWinApp *pApp = AfxGetApp();

	pApp->InitApplication();
	pApp->InitInstance();
	pApp->Run();

	PrintAllClasses();
}
开发者ID:dinodragon,项目名称:mygooglecode,代码行数:10,代码来源:MY.cpp

示例6: main

int main()
{
	cout << "main 開始執行" << endl;
	
	CWinApp* pApp = AfxGetApp();
	pApp->InitApplication();  //CWinApp::InitApplication
	pApp->InitInstance();     //CMyWinApp::InitInstance --> CMyFrameWnd
	pApp->Run();              //CwinApp::Run

	cout << "main 結束執行" << endl;
	return 0;
}
开发者ID:dwatow,项目名称:DissectingMFC2,代码行数:12,代码来源:my.cpp

示例7: ASSERT

extern "C" int WINAPI
#endif
WinMain(
    HINSTANCE   hInstance,
    HINSTANCE   hPrevInstance,
    LPSTR       lpCmdLine,
    int         nCmdShow
    )
{
        ASSERT(hPrevInstance == NULL);
        lpCmdLine;

        int nReturnCode = -1;
        CWinApp* pApp = AfxGetApp();

        // AFX internal initialization
        LPTSTR p = GetCommandLine();
        while (*p && (*p != _T(' '))) p++;
        if (*p) p++;

        if (!AfxWinInit(hInstance, hPrevInstance, p, nCmdShow))
                goto InitFailure;

        // App global initializations (rare)
        ASSERT_VALID(pApp);
        if (!pApp->InitApplication())
                goto InitFailure;
        ASSERT_VALID(pApp);

        // Perform specific initializations
        if (!pApp->InitInstance())
        {
                if (pApp->m_pMainWnd != NULL)
                {
                        TRACE0("Warning: Destroying non-NULL m_pMainWnd\n");
                        pApp->m_pMainWnd->DestroyWindow();
                }
                nReturnCode = pApp->ExitInstance();
                goto InitFailure;
        }
        ASSERT_VALID(pApp);

        nReturnCode = pApp->Run();
        ASSERT_VALID(pApp);

InitFailure:
        AfxWinTerm();
        return nReturnCode;
}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:49,代码来源:winmain.cpp

示例8: AfxWinMain

int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
	LPTSTR lpCmdLine, int nCmdShow)
{
	ASSERT(hPrevInstance == NULL);

	int nReturnCode = -1;
	CWinThread* pThread = AfxGetThread();
	CWinApp* pApp = AfxGetApp();

	// AFX internal initialization
	bool InitSuccess = AfxWinInit(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
    // App global initializations (rare)
	if (pApp != NULL)
      InitSuccess = InitSuccess && pApp->InitApplication();

	// Perform specific initializations
	InitSuccess = InitSuccess && pThread->InitInstance();

    // Run the BCI2000 core module.
    if( InitSuccess )
    {
      CoreModuleMFC coreModule;
      nReturnCode = ( coreModule.Run( __argc, __argv ) ? 0 : -1 );
    }
    else
    {
		if (pThread->m_pMainWnd != NULL)
		{
			TRACE0("Warning: Destroying non-NULL m_pMainWnd\n");
			pThread->m_pMainWnd->DestroyWindow();
		}
	}
    pThread->ExitInstance();

#ifdef _DEBUG
	// Check for missing AfxLockTempMap calls
	if (AfxGetModuleThreadState()->m_nTempMapLock != 0)
	{
		TRACE1("Warning: Temp map lock count non-zero (%ld).\n",
			AfxGetModuleThreadState()->m_nTempMapLock);
	}
	AfxLockTempMaps();
	AfxUnlockTempMaps(-1);
#endif

	AfxWinTerm();
	return nReturnCode;
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:48,代码来源:WINMAIN.CPP

示例9: RadiantInit

/*
=================
RadiantInit

This is also called when you 'quit' in doom
=================
*/
void RadiantInit( void ) {

	// make sure the renderer is initialized
	if ( !renderSystem->IsOpenGLRunning() ) {
		common->Printf( "no OpenGL running\n" );
		return;
	}

	g_editorAlive = true;

	// allocate a renderWorld and a soundWorld
	if ( g_qeglobals.rw == NULL ) {
		g_qeglobals.rw = renderSystem->AllocRenderWorld();
		g_qeglobals.rw->InitFromMap( NULL );
	}
	if ( g_qeglobals.sw == NULL ) {
		g_qeglobals.sw = soundSystem->AllocSoundWorld( g_qeglobals.rw );
	}

	if ( g_DoomInstance ) {
		if ( ::IsWindowVisible( win32.hWnd ) ) {
			::ShowWindow( win32.hWnd, SW_HIDE );
			g_pParentWnd->ShowWindow( SW_SHOW );
			g_pParentWnd->SetFocus();
		}
	} else {
		Sys_GrabMouseCursor( false );

		g_DoomInstance = win32.hInstance;
		CWinApp* pApp = AfxGetApp();
		CWinThread *pThread = AfxGetThread();

		InitAfx();

		// App global initializations (rare)
		pApp->InitApplication();

		// Perform specific initializations
		pThread->InitInstance();

		qglFinish();
		//qwglMakeCurrent(0, 0);
		qwglMakeCurrent(win32.hDC, win32.hGLRC);

		// hide the doom window by default
		::ShowWindow( win32.hWnd, SW_HIDE );
	}
}
开发者ID:tankorsmash,项目名称:quadcow,代码行数:55,代码来源:Radiant.cpp

示例10: RadiantInit

/*
=================
RadiantInit

This is also called when you 'quit' in doom
=================
*/
void RadiantInit( void ) {

	// make sure the renderer is initialized
	if ( !renderSystem->IsOpenGLRunning() ) {
		common->Printf( "no OpenGL running\n" );
		return;
	}

	g_editorAlive = true;

	// allocate a renderWorld and a soundWorld
	if ( g_qeglobals.rw == NULL ) {
// jmarshall
	//	g_qeglobals.defaultEditorMaterial = declManager->FindMaterial( "_editordefault" );
		RadiantInitTestWindow();
// jmarshall end
		g_qeglobals.rw = renderSystem->AllocRenderWorld();
		g_qeglobals.rw->InitFromMap( NULL );
	}
	if ( g_qeglobals.sw == NULL ) {
		g_qeglobals.sw = soundSystem->AllocSoundWorld( g_qeglobals.rw );
	}

	if ( g_DoomInstance ) {
		if ( ::IsWindowVisible( win32.hWnd ) ) {
			::ShowWindow( win32.hWnd, SW_HIDE );
			g_pParentWnd->ShowWindow( SW_SHOW );
			g_pParentWnd->SetFocus();
		}
	} else {
		sys->GrabMouseCursor( false );

		g_DoomInstance = win32.hInstance;
		CWinApp* pApp = AfxGetApp();
		CWinThread *pThread = AfxGetThread();

		InitAfx();

		

		// App global initializations (rare)
		pApp->InitApplication();

		// Perform specific initializations
		pThread->InitInstance();

	

		qglFinish();
		//qwglMakeCurrent(0, 0);
		renderDevice->BindDeviceToWindow(win32.hDC);

		// hide the doom window by default
		::ShowWindow( win32.hWnd, SW_HIDE );

// jmarshall
		
		toolInterfaceLocal.ShowDebugConsole();
// jmarshall end
	}
}
开发者ID:Deepfreeze32,项目名称:idtech4cdk,代码行数:68,代码来源:Radiant.cpp

示例11: AfxWinMain

int AFXAPI AfxWinMain(HINSTANCE hInstance, 
					  HINSTANCE hPrevInstance,	
					  LPTSTR lpCmdLine, 
					  int nCmdShow)
{
	char szLogFileName[_MAX_DIR];
	if (GetRecommandLogFileName(szLogFileName) == false) 
		return FALSE;

	InitLog(MLOGSTYLE_DEBUGSTRING|MLOGSTYLE_FILE, szLogFileName);

	// Wrap WinMain in a structured exception handler (different from C++
	// exception handling) in order to make sure that all access violations
	// and other exceptions are displayed - regardless of when they happen.
	// This should be done for each thread, if at all possible, so that exceptions
	// will be reliably caught, even inside the debugger.
#ifdef SUPPORT_EXCEPTIONHANDLING
	char szDumpFileName[_MAX_DIR]; 
	strcpy(szDumpFileName, szLogFileName);
	strcat(szDumpFileName, ".dmp");
	__try {
#endif
		// The code inside the __try block is the MFC version of AfxWinMain(),
		// copied verbatim from the MFC source code.
		ASSERT(hPrevInstance == NULL);

		int nReturnCode = -1;
		CWinApp* pApp = AfxGetApp();

		// AFX internal initialization
		if (!AfxWinInit(hInstance, hPrevInstance, lpCmdLine, nCmdShow))
			goto InitFailure;

		// App global initializations (rare)
		ASSERT_VALID(pApp);
		if (!pApp->InitApplication())
			goto InitFailure;
		ASSERT_VALID(pApp);

		// Perform specific initializations
		if (!pApp->InitInstance())
		{
			if (pApp->m_pMainWnd != NULL)
			{
				TRACE(_T("Warning: Destroying non-NULL m_pMainWnd\n"));
				pApp->m_pMainWnd->DestroyWindow();
			}
			nReturnCode = pApp->ExitInstance();
			goto InitFailure;
		}
		ASSERT_VALID(pApp);

		nReturnCode = pApp->Run();
		ASSERT_VALID(pApp);

InitFailure:
#ifdef _DEBUG
		// Check for missing AfxLockTempMap calls
		if (AfxGetModuleThreadState()->m_nTempMapLock != 0)
		{
			TRACE(_T("Warning: Temp map lock count non-zero (%ld).\n"),
				AfxGetModuleThreadState()->m_nTempMapLock);
		}
		AfxLockTempMaps();
		AfxUnlockTempMaps(-1);
#endif

		AfxWinTerm();
		return nReturnCode;

#ifdef SUPPORT_EXCEPTIONHANDLING
	}
//	__except(MFilterException(GetExceptionInformation())){
	__except(CrashExceptionDump(GetExceptionInformation(), szDumpFileName)){
		
//		char szFileName[_MAX_DIR];
//		GetModuleFileName(NULL, szFileName, _MAX_DIR);
//		WinExec(szFileName, SW_SHOW);	// Launch again
		//MMatchServer::GetInstance()->CheckMemoryTest();
		//MGetServerStatusSingleton()->Dump();
	}
#endif
	return 0;
}
开发者ID:roseon,项目名称:life-marvelous,代码行数:84,代码来源:ExceptionAttacher.cpp

示例12: AfxWinMain

int AFXAPI AfxWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
	LPTSTR lpCmdLine, int nCmdShow)
{
#ifdef DISPLAYCONSOLE 

  // Redirection of standard output to console
  int hCrt;  BOOL rep;  FILE *hf;
  _SYSTEM_INFO lps;
  GetSystemInfo(&lps);
  rep = AllocConsole();
  hCrt = _open_osfhandle((intptr_t) GetStdHandle(STD_OUTPUT_HANDLE),_O_TEXT);
  hf = _fdopen( hCrt, "w" );
  *stdout = *hf;
  // stop the buffer on stdout
//  int i = setvbuf( stdout, NULL, _IONBF, 0 );
//  filebuf ff(hCrt);
//  cout = &ff;
  cout<<"This Debug Window is defined in WinMain.cpp and will disappear in release mode"<<endl;

#endif //  DISPLAYCONSOLE  // By Matra

  // create log file for all OCC messages
//  Message::DefaultMessenger()->AddPrinter (new Message_PrinterOStream ("OCCSampleRun.log", Standard_False));

  ASSERT(hPrevInstance == NULL);

  int nReturnCode = -1;
  CWinApp* pApp = AfxGetApp();

// new in 2.0 CAS.CADE uses the standard C++ exception mechanism
/*#ifdef _DEBUG  // By Matra
  // _Function declaratiob here because you can jump to InitFailure
  Standard_ErrorHandler _Function;  
#endif //  _DEBUG  // By Matra
*/
	// AFX internal initialization
	if (!AfxWinInit(hInstance, hPrevInstance, lpCmdLine, nCmdShow))
		goto InitFailure;

	// App global initializations (rare)
	ASSERT_VALID(pApp);
	if (!pApp->InitApplication())
		goto InitFailure;
	ASSERT_VALID(pApp);

	// Perform specific initializations
	if (!pApp->InitInstance())
	{
		if (pApp->m_pMainWnd != NULL)
		{
			TRACE0("Warning: Destroying non-NULL m_pMainWnd\n");
			pApp->m_pMainWnd->DestroyWindow();
		}
		nReturnCode = pApp->ExitInstance();
		goto InitFailure;
	}
	ASSERT_VALID(pApp);


#ifdef _DEBUG  // By Matra
Application:

// new in 2.0 CAS.CADE uses the standard C++ exception mechanism

 // if(DoesNotAbort(_Function))
	try
    {
	  nReturnCode = pApp->Run();
    }
//  if(_Function.Catches(STANDARD_TYPE(Standard_Failure)))
	catch(Standard_Failure)
    {
      Standard_SStream ostr;
      ostr<<Standard_Failure::Caught()<<"\n\0";
      CString aMsg = ostr.str().c_str();
      MessageBoxW (NULL, aMsg, L"CasCade Error", MB_ICONERROR);
      goto Application; // restart application loop
    }
#else // _DEBUG  // By Matra
	nReturnCode = pApp->Run();
#endif // _DEBUG  // By Matra


	ASSERT_VALID(pApp);

InitFailure:
#ifdef _DEBUG
	// Check for missing AfxLockTempMap calls
	if (AfxGetModuleThreadState()->m_nTempMapLock != 0)
	{
		TRACE1("Warning: Temp map lock count non-zero (%ld).\n",
			AfxGetModuleThreadState()->m_nTempMapLock);
	}

	AfxLockTempMaps();
	AfxUnlockTempMaps();
#endif

	AfxWinTerm();

//.........这里部分代码省略.........
开发者ID:SimVascular,项目名称:OpenCASCADE,代码行数:101,代码来源:Winmain.cpp


注:本文中的CWinApp::InitApplication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。