コード例 #1
0
ファイル: Window.cpp プロジェクト: FujiokaNaoto/DirectX_Base
//**関数***************************************************************************
//	概要	:	デフォルトのメッセージ ループ
//*********************************************************************************
int CWindow::Run()
{
	if (!InitInstance())
		return ExitInstance();

	bool bIdle = TRUE;
	long lIdleCount = 0;
	for (;;)
	{
		while (bIdle && !::PeekMessage(&m_msgCur, NULL, NULL, NULL, PM_NOREMOVE)) 
		{
			if (!OnIdle(lIdleCount++))
				bIdle = false;
		}

		do 
		{
			if (!PumpMessage())
				return ExitInstance();
			if (IsIdleMessage(&m_msgCur))
			{
				bIdle = true;
				lIdleCount = 0;
			}

		}
		while (::PeekMessage(&m_msgCur, NULL, NULL, NULL, PM_NOREMOVE));
	}
	return -1;	// ここには来ないはず。
}
コード例 #2
0
ファイル: AccountServer.cpp プロジェクト: iceberry/flyffsf
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	//////////////////////////////////////////////////////////////////////////
	//	BEGINTEST100111	FFL_DUMP
 	ffl_dump_unexception_filter::install( ffl_dump_level_heavy );
	//	ENDTEST100111	FFL_DUMP
	//////////////////////////////////////////////////////////////////////////

	InitLanguageFromResource( hInstance );

	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_ACCOUNTSERVER, szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);

	if (!InitInstance (hInstance, nCmdShow)) 
	{
		ExitInstance();
		return FALSE;
	}

	MSG msg;
	while (GetMessage(&msg, NULL, 0, 0)) 
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	ExitInstance();

	return msg.wParam;
}
コード例 #3
0
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	//////////////////////////////////////////////////////////////////////////
	//	BEGINTEST100111	FFL_DUMP
 	ffl_dump_unexception_filter::install( ffl_dump_level_heavy );
	//	ENDTEST100111	FFL_DUMP
	//////////////////////////////////////////////////////////////////////////


// 	char szBuffer[256] = "rlawnsgudjuventus1970";
// 	char szResult[256] = "";
// 	//rlawnsgud juventus1970
// 
// 	md5( szResult, szBuffer );



	//_CrtSetBreakAlloc( 628278 );	// memory leak 탐지
	// Initialize global strings
	LoadString(hInstance, IDS_APP_TITLE, g_szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_WORLDSERVER, g_szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);

	InitLanguageFromResource( hInstance );
	if( ::GetLanguage() != LANG_KOR )
		g_eLocal.SetState( EVE_18, 1 );

	// Perform application initialization:
	if (!InitInstance (hInstance, nCmdShow))
	{
		ExitInstance();
		return FALSE;
	}

	MSG msg;
	// Main message loop:
	while (GetMessage(&msg, NULL, 0, 0)) 
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	ExitInstance();

	return msg.wParam;
}
コード例 #4
0
ファイル: winthred.cpp プロジェクト: Ukusbobra/open-watcom-v2
int CWinThread::Run()
/*******************/
{
    MSG     msg;
    LONG    lCount = 0L;
    for( ;; ) {
        while( !::PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) {
            if( OnIdle( lCount ) ) {
                lCount++;
            } else {
                ::WaitMessage();
            }
        }
        if( !PumpMessage() ) {
            break;
        }
        if( IsIdleMessage( &msg ) ) {
            if( OnIdle( lCount ) ) {
                lCount++;
            } else {
                ::WaitMessage();
            }
        } else {
            lCount = 0L;
        }
    }
    return( ExitInstance() );
}
コード例 #5
0
ファイル: proxydll.cpp プロジェクト: 679565/SkyrimOnline
BOOL APIENTRY DllMain(HMODULE hModule, DWORD fdwReason, LPVOID lpReserved)
{
	switch (fdwReason)
	{
	case DLL_PROCESS_ATTACH:
		{
			std::string strL;
			strL.resize(MAX_PATH);
			GetModuleFileName(NULL, &strL[0], MAX_PATH);

			DisableThreadLibraryCalls(hModule);

			if(strL.find("TESV.exe") != std::string::npos ||
			   strL.find("Oblivion.exe") != std::string::npos)
			{
				gl_hThisInstance = hModule;
				
				LoadOriginalDll();
			}
			
			break;
		}
	case DLL_PROCESS_DETACH:
		{
			ExitInstance();

			break;
		}
	}
	return TRUE;
}
コード例 #6
0
int CRadiantApp::Run( void ) {
	BOOL bIdle = TRUE;
	LONG lIdleCount = 0;
#if _MSC_VER >= 1300
	MSG *msg = AfxGetCurrentMessage();			// TODO Robert fix me!!
#else
	MSG *msg = &m_msgCur;
#endif
	// phase1: check to see if we can do idle work
	while( bIdle &&	!::PeekMessage( msg, NULL, NULL, NULL, PM_NOREMOVE ) ) {
		// call OnIdle while in bIdle state
		if( !OnIdle( lIdleCount++ ) ) {
			bIdle = FALSE; // assume "no idle" state
		}
	}
	// phase2: pump messages while available
	do {
		// pump message, but quit on WM_QUIT
		if( !PumpMessage() ) {
			return ExitInstance();
		}
		// reset "no idle" state after pumping "normal" message
		if( IsIdleMessage( msg ) ) {
			bIdle = TRUE;
			lIdleCount = 0;
		}
	} while( ::PeekMessage( msg, NULL, NULL, NULL, PM_NOREMOVE ) );
	return 0;
}
コード例 #7
0
ファイル: win-thread.cpp プロジェクト: sirmax1/coin
int CWinThread::RunLoop() {
	bool bIdle = true;
	LONG lIdleCount = 0;
	_AFX_THREAD_STATE* pState = AfxGetThreadState();
	while (true)
	{
#if UCFG_GUI
		while (bIdle && !::PeekMessage(&(pState->m_msgCur), 0, 0, 0, PM_NOREMOVE))
			bIdle = OnIdle(lIdleCount++);
#endif
		do
		{
			//#ifndef NO_GUI //!!!
			if (!PumpMessage())
				return ExitInstance();
			//#endif

			if (IsIdleMessage(pState->m_msgCur))
			{
				bIdle = true;
				lIdleCount = 0;
			}
		}
		while (::PeekMessage(&(pState->m_msgCur), NULL, NULL, NULL, PM_NOREMOVE));
	}
}
コード例 #8
0
ファイル: Teapot.cpp プロジェクト: 7zhang/studies
int CTeapotApp::Run()
{
    try {
        m_GameRun.reset(new SGLGameRun(new RenderTeapot(DEF_WIDTH, DEF_HEIGHT, m_pMainWnd->GetSafeHwnd(), TRUE, D3DDEVTYPE_HAL)));
    }
    catch (SGLExcept& e) {
        ERR_TRACEA("SGLExcept: what: %s, type: %s", e.what(), typeid(e).name());
        return -1;
    }

    CMainFrame* pFrmWnd = (CMainFrame*) m_pMainWnd;
    pFrmWnd->SetGameRun(m_GameRun.get());
    pFrmWnd->AdjustWindowed();
    SetPumpMsgType(PUMP_PEEK_MSG);  // 使用 PeekMessage 消息循环

    // 更新窗口显示
    m_pMainWnd->ShowWindow(m_nCmdShow);
    m_pMainWnd->UpdateWindow();

    SGL::Clock clock;

    // 消息循环
    while (m_PumpMsgFunc()) {
        float timeDelta = clock.elapseSec();
        clock.reset();
        m_GameRun->run(timeDelta);  // Game Loop
    }

    // NOTE: 按照约定应调用 ExitInstance, 重载 Run 时, 不自动调用 ExitInstance
    return ExitInstance();
}
コード例 #9
0
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
	switch (ul_reason_for_call) {
		case DLL_PROCESS_ATTACH: {
			DisableThreadLibraryCalls(hModule);
			InitializeCriticalSection(&cs_GetQueue);
			InitInstance(hModule);
			if(SUCCEEDED(PatchIat(GetModuleHandle(NULL),"kernel32.dll","GetProcAddress",(PVOID)GetProcAddress_Hooked,(PVOID *)&GetProcAddress_Original)))
			{
				DBB("GetPRocAddress hook injected");
			}
			else
			{
				DBB("GetPRocAddress hook failed");
			}

			if(SUCCEEDED(PatchIat(GetModuleHandle(NULL),"user32.dll","RegisterClassA",(PVOID)RegisterClass_Hooked,(PVOID *)&RegisterClass_Original)))
			{
				DBB("RegisterClass hook injected");
			}
			else
			{
				DBB("RegisterClass hook failed");
			}

	    case DLL_PROCESS_DETACH: ExitInstance(); break;
        
        case DLL_THREAD_ATTACH:  break;
	    case DLL_THREAD_DETACH:  break;
		}
	}
	return TRUE;
}
コード例 #10
0
ファイル: proxy.cpp プロジェクト: mabako/xchat-ingame-overlay
BOOL APIENTRY DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
{
	switch (fdwReason)
	{
	case DLL_PROCESS_ATTACH:
	{
		MH_Initialize();

		if (GetModuleHandle("dinput8.dll") == NULL)
			LoadLibrary("dinput8.dll");

		MH_CreateHook(GetProcAddress(GetModuleHandle("dinput8.dll"), "DirectInput8Create"), &DirectInput8Create_Hook, reinterpret_cast<void**>(&DirectInput8Create_fn));

		MH_EnableHook(MH_ALL_HOOKS);
	}
		break;

	case DLL_PROCESS_DETACH:
		ExitInstance();

		MH_Uninitialize();

		break;
	}
	return TRUE;
}
コード例 #11
0
ファイル: VNCHooks.cpp プロジェクト: tmbx/vnc
// The DLL's main procedure
BOOL WINAPI DllMain (HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
	// Find out why we're being called
	switch (ul_reason_for_call)
	{

	case DLL_PROCESS_ATTACH:
#ifdef _MSC_VER
		_RPT0(_CRT_WARN, "vncHooks : Hook DLL loaded\n");
#endif

		// Save the instance handle
		hInstance = (HINSTANCE)hInst;

		// Call the initialisation function
		appHookedOK = InitInstance();

		// ALWAYS return TRUE to avoid breaking unhookable applications!!!
		return TRUE;

	case DLL_PROCESS_DETACH:
#ifdef _MSC_VER
		_RPT0(_CRT_WARN, "vncHooks : Hook DLL unloaded\n");
#endif
		
		// Call the exit function
		// If the app failed to hook OK, ExitInstance will still operate OK (hopefully...)
		ExitInstance();

		return TRUE;

	default:
		return TRUE;
	}
}
コード例 #12
0
ファイル: ddwrapper.cpp プロジェクト: ToadKing/ddhack
BOOL APIENTRY DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{	
    LPVOID lpDummy = lpReserved;
    lpDummy = NULL;
    
    switch (ul_reason_for_call)
	{
	    case DLL_PROCESS_ATTACH: 
#ifdef LOG_DLL_ATTACH
			logf(this, "DllMain(%08X,%08X,%08X) DLL_PROCESS_ATTACH",hModule, ul_reason_for_call, lpReserved); 
#endif
			InitInstance(hModule); break;
	    case DLL_PROCESS_DETACH: 
#ifdef LOG_DLL_ATTACH
			logf(this, "DllMain(%08X,%08X,%08X) DLL_PROCESS_DETACH",hModule, ul_reason_for_call, lpReserved);
#endif
			ExitInstance(); break;
        
        case DLL_THREAD_ATTACH:  
#ifdef LOG_DLL_ATTACH
			logf(this, "DllMain(%08X,%08X,%08X) DLL_THREAD_ATTACH",hModule, ul_reason_for_call, lpReserved); 
#endif
			break;
	    case DLL_THREAD_DETACH:  
#ifdef LOG_DLL_ATTACH
			logf(this, "DllMain(%08X,%08X,%08X) DLL_THREAD_DETACH",hModule, ul_reason_for_call, lpReserved); 
#endif
			break;
		default:
			logf(0, "DllMain(%08X,%08X,%08X) unknown reason",hModule, ul_reason_for_call, lpReserved);
	}
    return(true);
}
コード例 #13
0
ファイル: PlayerMgr.cpp プロジェクト: LjApps/eMule-VeryCD
int CPlayerMgr::Run()
{
	// TODO: 在此添加专用代码和/或调用基类
	ASSERT_VALID(this);
#ifndef _AFXDLL 
#define _AFX_SOCK_THREAD_STATE AFX_MODULE_THREAD_STATE 
#define _afxSockThreadState AfxGetModuleThreadState() 
	_AFX_SOCK_THREAD_STATE* pState = _afxSockThreadState; 
	if (pState->m_pmapSocketHandle == NULL) 
		pState->m_pmapSocketHandle = new CMapPtrToPtr; 
	if (pState->m_pmapDeadSockets == NULL) 
		pState->m_pmapDeadSockets = new CMapPtrToPtr; 
	if (pState->m_plistSocketNotifications == NULL) 
		pState->m_plistSocketNotifications = new CPtrList; 
#endif

	if (!m_skListen.Socket(SOCK_STREAM, FD_ACCEPT))
		return false;

	srand(time(NULL));
	WORD nListenPort;
	while(true)
	{
#ifdef _DEBUG
		nListenPort = 8880;
#else
		nListenPort = 3000 + rand() % 1200;
#endif
		if(m_skListen.Bind(nListenPort))
			break;
		else
		{
			TRACE("bind error: %d\n", WSAGetLastError());
		}
	}

	m_nListenPort = nListenPort;

	m_skListen.Listen(5);

	_AFX_THREAD_STATE* pTState = AfxGetThreadState();

	while(true)
	{
		Process();
		if(::PeekMessage(&(pTState->m_msgCur), NULL, NULL, NULL, PM_NOREMOVE))
		{
			if (!PumpMessage())
				return ExitInstance();
		}
	}

	return 0;
}
コード例 #14
0
ファイル: main.c プロジェクト: RareHare/reactos
int APIENTRY wWinMain(HINSTANCE hInstance,
                      HINSTANCE hPrevInstance,
                      LPWSTR    lpCmdLine,
                      int       nCmdShow)
{
    MSG msg;
    HACCEL hAccel;

    UNREFERENCED_PARAMETER(hPrevInstance);

    if (ProcessCmdLine(lpCmdLine))
    {
        return 0;
    }

    /* Initialize global strings */
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_REGEDIT_FRAME, szFrameClass, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_REGEDIT, szChildClass, MAX_LOADSTRING);

   
    switch (GetUserDefaultUILanguage())
  {
    case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT):
      SetProcessDefaultLayout(LAYOUT_RTL);
      break;

    default:
      break;
  }
    /* Store instance handle in our global variable */
    hInst = hInstance;

    /* Perform application initialization */
    if (!InitInstance(hInstance, nCmdShow))
    {
        return 0;
    }
    hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(ID_ACCEL));

    /* Main message loop */
    while (GetMessageW(&msg, NULL, 0, 0))
    {
        if (!TranslateAcceleratorW(hFrameWnd, hAccel, &msg) &&
            !TranslateChildTabMessage(&msg))
        {
            TranslateMessage(&msg);
            DispatchMessageW(&msg);
        }
    }

    ExitInstance(hInstance);
    return (int)msg.wParam;
}
コード例 #15
0
ファイル: main.cpp プロジェクト: no1dead/ElDorito
BOOL WINAPI DllMain(HINSTANCE hModule, DWORD Reason, LPVOID Misc)
{
	switch( Reason )
	{
	case DLL_PROCESS_ATTACH: return InitInstance(hModule);
	case DLL_PROCESS_DETACH: return ExitInstance();
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
		return true;
	}

	return false;
}
コード例 #16
0
ファイル: GUI.cpp プロジェクト: Heartbroken/flash-to-directx
//---------------------------------------------------------------------
int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	int iFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
	iFlag |= _CRTDBG_LEAK_CHECK_DF;
	_CrtSetDbgFlag(iFlag);

	MSG msg;
	HACCEL hAccelTable;

	// Initialize global strings
	LoadString(hInstance, IDS_APP_TITLE, szTitle, max_loadstring);
	LoadString(hInstance, IDC_GUI, szWindowClass, max_loadstring);
	MyRegisterClass(hInstance);

	// Perform application initialization:
	if (!InitInstance(hInstance, nCmdShow))
	{
		return FALSE;
	}

	hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_GUI));

	// Main message loop:
	bool noQuit = true;
	while (noQuit)
	{
		if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);

			if (msg.message == WM_QUIT)
				noQuit = false;
		}
		else
		{
			DrawFrame();
		}
	}

	ExitInstance();
	return (int) msg.wParam;
}
コード例 #17
0
ファイル: proxydll.cpp プロジェクト: grasmanek94/CodeDump
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		DisableThreadLibraryCalls(hModule);
		break;

	case DLL_PROCESS_DETACH:
		ExitInstance();
		break;
	}

	return true;
}
コード例 #18
0
ファイル: SH2Proxy.cpp プロジェクト: 07151129/sh2proxy
BOOL APIENTRY DllMain(HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
	// to avoid compiler lvl4 warnings 
	LPVOID lpDummy = lpReserved;
	lpDummy = NULL;

	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH: InitInstance(hModule); break;
	case DLL_PROCESS_DETACH: ExitInstance(); break;

	case DLL_THREAD_ATTACH:  break;
	case DLL_THREAD_DETACH:  break;
	}
	return TRUE;
}
コード例 #19
0
ファイル: main.cpp プロジェクト: kippler/Samples
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow)
{
#ifdef _DEBUG
	//_CrtSetBreakAlloc(1081);
	_onexit(_CrtDumpMemoryLeaks);
#endif

	if (!InitInstance (hInstance)) 
		return FALSE;

	int ret = Main();

	ExitInstance();

	return ret;
}
コード例 #20
0
ファイル: Thread.cpp プロジェクト: soulic/FileZilla-Server
DWORD CThread::Run()
{
	InitInstance();
	SetEvent(m_hEventStarted);
	m_started = true;
	MSG msg;
	while (GetMessage(&msg, 0, 0, 0)) {
		// Since we do not handle keyboard events in the thread, don't translate messages.

		if (!msg.hwnd)
			OnThreadMessage(msg.message, msg.wParam, msg.lParam);
		DispatchMessage(&msg);
	}
	DWORD res = ExitInstance();
	delete this;
	return res;
}
コード例 #21
0
ファイル: PageTestExe.cpp プロジェクト: AceMood/webpagetest
// override the Run so we can put an exception handler aaround the message loop (pre-translate causes some grief)
int CPageTestExeApp::Run()
{
	// acquire and dispatch messages until a WM_QUIT message is received.
	for(;;)
	{
		__try
		{
			// pump message, but quit on WM_QUIT
			if (!PumpMessage())
				return ExitInstance();
		}
		__except(1)
		{
		}

	}
}
コード例 #22
0
ファイル: Inform.cpp プロジェクト: wyrover/Windows-Inform7
void InformApp::RunMessagePump(void)
{
  LONG count = 0;
  while (OnIdle(count++));

  MSG msg;
  while (::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
  {
    if (msg.message == WM_COMMAND)
      ::PeekMessage(&msg,NULL,0,0,PM_REMOVE);
    else if (PumpMessage() == FALSE)
      exit(ExitInstance());
  }

  if (IsWaitCursor())
    RestoreWaitCursor();
}
コード例 #23
0
ファイル: main.c プロジェクト: HBelusca/NasuTek-Odyssey
int APIENTRY wWinMain(HINSTANCE hInstance,
                      HINSTANCE hPrevInstance,
                      LPWSTR    lpCmdLine,
                      int       nCmdShow)
{
    MSG msg;
    HACCEL hAccel;

    UNREFERENCED_PARAMETER(hPrevInstance);

    if (ProcessCmdLine(lpCmdLine))
    {
        return 0;
    }

    /* Initialize global strings */
    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadString(hInstance, IDC_REGEDIT_FRAME, szFrameClass, MAX_LOADSTRING);
    LoadString(hInstance, IDC_REGEDIT, szChildClass, MAX_LOADSTRING);

    /* Store instance handle in our global variable */
    hInst = hInstance;

    /* Perform application initialization */
    if (!InitInstance(hInstance, nCmdShow))
    {
        return FALSE;
    }
    hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(ID_ACCEL));

    /* Main message loop */
    while (GetMessage(&msg, (HWND)NULL, 0, 0))
    {
        if (!TranslateAccelerator(hFrameWnd, hAccel, &msg)
                && !TranslateChildTabMessage(&msg))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    ExitInstance(hInstance);
    return (int) msg.wParam;
}
コード例 #24
0
ファイル: IperfThread.cpp プロジェクト: katakk/iperf
// やっぱオーバライドしないと動きおかしい
int CIperfThread::Run()
{
    ASSERT_VALID(this);
    _AFX_THREAD_STATE* pState = AfxGetThreadState();

    do {
        if(! OnIdle(1)) 
        {
            if(WaitForSingleObject(m_ProcessInfo.hProcess,
                INFINITE) == WAIT_OBJECT_0)
            {
                break;
            }
        }
    }   while(1);   
    
    ExitInstance();
    return 0;
}
コード例 #25
0
ファイル: main.c プロジェクト: GYGit/reactos
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    MSG msg;
//    HACCEL hAccel;
    HWND hMDIClient;

    // Initialize global strings
    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadString(hInstance, IDC_MDI_APP, szFrameClass, MAX_LOADSTRING);
    LoadString(hInstance, IDC_MDI_APP_CHILD, szChildClass, MAX_LOADSTRING);

    // Allow only one running instance
    EnumWindows(EnumWndProc, (LPARAM)szFrameClass);
    if (g_foundPrevInstance)
        return 1;

    // Store instance handle in our global variable
    hInst = hInstance;

    // Perform application initialization:
    if (!InitInstance(hInstance, nCmdShow)) {
        return FALSE;
    }
//    hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_MDI_APP);
    hMDIClient = GetWindow(hFrameWnd, GW_CHILD);

    // Main message loop:
    while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
        if (!TranslateMDISysAccel(hMDIClient, &msg) &&
            !TranslateAccelerator(hFrameWnd, hAccel, &msg)) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
    ExitInstance();
    return msg.wParam;
}
コード例 #26
0
ファイル: wmain.cpp プロジェクト: GamingAtheist/ogui
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPTSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

 	// TODO: Place code here.
	MSG msg;
	HACCEL hAccelTable;

	// Initialize global strings
	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_WIN32, szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);

	// Perform application initialization:
	if (!InitInstance (hInstance, nCmdShow))
	{
		return FALSE;
	}

	hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WIN32));

	// Main message loop:
	while (GetMessage(&msg, NULL, 0, 0))
	{
		if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}
  ExitInstance(hInstance);
	return (int) msg.wParam;
}
コード例 #27
0
ファイル: main.c プロジェクト: AlexSteel/wine
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    MSG msg;
    HACCEL hAccel;

    if (ProcessCmdLine(lpCmdLine)) {
        return 0;
    }

    /* Initialize global strings */
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle));
    LoadStringW(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueName, COUNT_OF(g_pszDefaultValueName));

    /* Store instance handle in our global variable */
    hInst = hInstance;

    /* Perform application initialization */
    if (!InitInstance(hInstance, nCmdShow)) {
        return FALSE;
    }
    hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(IDC_REGEDIT));

    /* Main message loop */
    while (GetMessageW(&msg, NULL, 0, 0)) {
        if (!TranslateAcceleratorW(hFrameWnd, hAccel, &msg)
                && !TranslateChildTabMessage(&msg)) {
            TranslateMessage(&msg);
            DispatchMessageW(&msg);
        }
    }
    ExitInstance();
    return msg.wParam;
}
コード例 #28
0
ファイル: mdispgtk.cpp プロジェクト: DayStarEngineering/CDH
MdispGtkApp::~MdispGtkApp()
   {
   ExitInstance();
   }