Пример #1
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

	switch (message) 
	{
		case WM_COMMAND:
			wmId    = LOWORD(wParam); 
			wmEvent = HIWORD(wParam); 
			// Parse the menu selections:
			switch (wmId)
			{
				case IDM_ABOUT:
				   break;
				case IDM_EXIT:
				   DestroyWindow(hWnd);
				   break;
				default:
				   return DefWindowProc(hWnd, message, wParam, lParam);
			}
			break;
		case WM_TIMER:
			{
				OnTimer( wParam ); // wTimerID = wParam 
				break;
			}
		case WM_PAINT:
			hdc = BeginPaint(hWnd, &ps);
//			RECT rt;
//			GetClientRect(hWnd, &rt);
			g_MyTrace.Paint( hdc );
			EndPaint(hWnd, &ps);
			break;
		case WM_DESTROY:
			KillTimer( hMainWnd, TIMER_ID_DEFAULT );
#if !defined(__INTERNALSERVER)
			KillTimer( hMainWnd, TIMER_ID_WANTED );
#endif
#ifdef __EVENT0913
			KillTimer( hMainWnd, TIMER_ID_EVENT0913 );
#endif	// __EVENT0913
#ifdef __EVENT1206
			KillTimer( hMainWnd, TIMER_ID_EVENT1206 );
#endif	// __EVENT1206
			KillTimer( hMainWnd, TIMER_ID_EVENT );
			PostQuitMessage(0);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}
Пример #2
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

	switch (message) 
	{
		case WM_COMMAND:
			wmId    = LOWORD(wParam); 
			wmEvent = HIWORD(wParam); 
			// Parse the menu selections:
			switch (wmId)
			{
				case IDM_EXIT:
				   DestroyWindow(hWnd);
				   break;
				default:
				   return DefWindowProc(hWnd, message, wParam, lParam);
			}
			break;
#ifdef __PL_0917
		case WM_LBUTTONDOWN:
			CPacketLog::Instance()->Print();
			break;
		case WM_RBUTTONDOWN:
			CPacketLog::Instance()->Reset();
			break;
#endif	// __PL_0917
		case WM_TIMER:
			{
				switch( wParam )
				{
					case 3:
#ifdef __CRASH_0404
						CCrashStatus::GetInstance()->SetMainThreadTask( 1 );
#endif	// __CRASH_0404
						CPlayerMng::Instance()->DestroyGarbage();
#ifdef __CRASH_0404
						CCrashStatus::GetInstance()->SetMainThreadTask( 0 );
#endif	// __CRASH_0404

						break;
				}
				break;
			}
		case WM_PAINT:
			hdc = BeginPaint(hWnd, &ps);
//			RECT rt;
//			GetClientRect(hWnd, &rt);
			g_MyTrace.Paint( hdc );
			EndPaint(hWnd, &ps);
			break;
		case WM_DESTROY:
			KillTimer( hMainWnd, 3 );
			PostQuitMessage(0);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}
Пример #3
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

#ifdef __BILLING0712
	// 빌링에 관련된 윈도우 메세지가 처리되게 한다.
	if( GetBillingMgr()->PreTranslateMessage( hWnd, message, wParam, lParam ) )
		return 0;
#endif

	switch (message) 
	{
		case WM_TIMER:
			{
				switch( wParam )
				{
				case IDT_SENDPLAYERCOUNT:
					g_dpDbSrvr.SendPlayerCount();
					break;
				case IDT_PREVENT_EXCESS:
					g_AccountMng.PreventExcess();	
					break;
				case IDT_TIME_CHECKADDR:
					{
						if( g_dpSrvr.m_bCheckAddr && g_AccountMng.IsTimeCheckAddr() )
						{
							HMENU hMenu		= GetMenu( hWnd );
							CheckMenuItem( hMenu, IDM_OPT_EXTERNAL, MF_CHECKED );
							EnableMenuItem( hMenu, IDM_OPT_EXTERNAL, MF_DISABLED | MF_GRAYED );
							CheckMenuItem( hMenu, IDM_OPT_INTERNAL, MF_UNCHECKED );
							EnableMenuItem( hMenu, IDM_OPT_INTERNAL, MF_ENABLED );
							g_dpSrvr.m_bCheckAddr	= false;
						}
					}
					break;
/*
#ifdef __S0114_RELOADPRO
				case IDT_RELOAD_PROJECT:
					{
						if( g_dpSrvr.m_bReloadPro )
							g_DbManager.Load_ReloadAccount();
					}
					break;
#endif // __S0114_RELOADPRO
*/
				case IDT_BUYING_INFO:
					CBuyingInfoMng::GetInstance()->Process();
					break;
				}
			}
			break;

		case WM_COMMAND:
			wmId    = LOWORD(wParam); 
			wmEvent = HIWORD(wParam); 
			// Parse the menu selections:
			switch (wmId)
			{
				case IDM_EXIT:
				   DestroyWindow(hWnd);
				   break;
				case IDM_OPT_INTERNAL:
					{
						HMENU hMenu		= GetMenu( hWnd );
						CheckMenuItem( hMenu, IDM_OPT_INTERNAL, MF_CHECKED );
						EnableMenuItem( hMenu, IDM_OPT_INTERNAL, MF_DISABLED | MF_GRAYED );
						CheckMenuItem( hMenu, IDM_OPT_EXTERNAL, MF_UNCHECKED );
						EnableMenuItem( hMenu, IDM_OPT_EXTERNAL, MF_ENABLED );
						g_dpSrvr.m_bCheckAddr	= true;
						break;
					}
				case IDM_OPT_EXTERNAL:
					{
						HMENU hMenu		= GetMenu( hWnd );
						CheckMenuItem( hMenu, IDM_OPT_EXTERNAL, MF_CHECKED );
						EnableMenuItem( hMenu, IDM_OPT_EXTERNAL, MF_DISABLED | MF_GRAYED );
						CheckMenuItem( hMenu, IDM_OPT_INTERNAL, MF_UNCHECKED );
						EnableMenuItem( hMenu, IDM_OPT_INTERNAL, MF_ENABLED );
						g_dpSrvr.m_bCheckAddr	= false;
						break;
					}
				case IDM_OPT_MAX_CONN:
					{
						DialogBox( hInst, MAKEINTRESOURCE( IDD_DIALOG_MAX_CONN ), hWnd, MaxConnDlgProc );
						break;
					}
				case IDM_OPT_TOGGLE:
					{
						DialogBox( hInst, MAKEINTRESOURCE( IDD_DIALOG_TOGGLE ), hWnd, ToggleDlgProc );
						break;
					}
				case IDM_OPT_SETTIME:
					{
						DialogBox( hInst, MAKEINTRESOURCE( IDD_DIALOG_TIME ), hWnd, SetTimeDlgProc );
						break;
					}
				case IDM_OPT_INTERNAL_IP:
					{
						g_dpSrvr.LoadAddrPmttd( "pmttd.ini" );
						g_dpSrvr.LoadIPCut( "IPCut.ini" );
						break;
					}
				default:
				   return DefWindowProc(hWnd, message, wParam, lParam);
			}
			break;

		case WM_PAINT:
			hdc = BeginPaint(hWnd, &ps);
			g_MyTrace.Paint( hdc );
			EndPaint(hWnd, &ps);
			break;

		case WM_DESTROY:
			KillTimer( hMainWnd, IDT_SENDPLAYERCOUNT );
			if( ::GetLanguage() == LANG_THA )
				KillTimer( hMainWnd, IDT_PREVENT_EXCESS );
/*
#ifdef __S0114_RELOADPRO
			KillTimer( hMainWnd, IDT_RELOAD_PROJECT );
#endif // __S0114_RELOADPRO
*/
			PostQuitMessage(0);
			break;

		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}