Esempio n. 1
0
void LogTextAdd(BYTE type, char* msg, int len)
{
	
	if (len>LOG_TEXT_LENGTH-1)
	{
		len=LOG_TEXT_LENGTH-1;
	}
	m_cline++;
	if (m_cline>LOG_TEXT_LINE-1)
	{
		m_cline=0;
	}
	LogText[m_cline][0]=0;
	memcpy(&LogText[m_cline], msg, len);
	LogText[m_cline][1+len]=0;
	LogText[m_cline][len]=0;
	LogTextLength[m_cline]=len;
	LogTextViewType[m_cline]=type;	// Phew, 

#if (LOG_INMEDIATLY==1)
						RECT rect;
						HDC hdc = GetDC(ghWnd);
						GetClientRect(ghWnd, &rect);
						FillRect(hdc, &rect, (HBRUSH)GetStockObject(0));
						ReleaseDC(ghWnd, hdc);

						if ( gCurPaintType == 0)
						{
							if ( LogTextPaint != NULL )
							{
								LogTextPaint(ghWnd);
							}
						}
						
						gObjViewportPaint(ghWnd, gCurPaintPlayer);
						//g_ServerInfoDisplayer.Run(ghWnd);
						//GJNotifyMaxUserCount();
#endif
}
Esempio n. 2
0
//
//  FUNCIÓN: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PROPÓSITO: procesar mensajes de la ventana principal.
//
//  WM_COMMAND	: procesar el menú de aplicación
//  WM_PAINT	: pintar la ventana principal
//  WM_DESTROY	: enviar un mensaje de finalización y volver
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    int wmId, wmEvent;
    PAINTSTRUCT ps;

    switch (message)
    {

//	case WM_LBUTTONUP:
//			goto ShowPostWin;
//	case WM_CHAR:
//	{
//		if(wParam == VK_RETURN)
//		{
//ShowPostWin:
//			if(hWnd == hWnd_Post)
//				DialogBox(hInst, MAKEINTRESOURCE(IDD_POSTBOX), hWnd, PostWindow);
//		}
//	}break;

    case WM_COMMAND:
        wmId    = LOWORD(wParam);
        wmEvent = HIWORD(wParam);
        // Analizar las selecciones de menú:
        switch (wmId)
        {
        case ID_OPTIONS_DISCONNECTUSER:
            DialogBox(hInst,MAKEINTRESOURCE(IDD_UserList),hWnd,Users);
            break;
        case IDM_POST:
            DialogBox(hInst, MAKEINTRESOURCE(IDD_POSTBOX), hWnd, PostWindow);
            break;
        case IDM_ABOUT:
            DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
            break;
        case IDM_EXIT:
            DestroyWindow(hWnd);
            break;
        case ID_STATICS:
            JoinServer.Statics();
            break;
        //case ID_POSTSERVER_ADMINMESSAGE:
        //	ShowWindow(hWnd_Post, 1);
        //	UpdateWindow(hWnd_Post);
        //	break;
        default:
            return DefWindowProc(hWnd, message, wParam, lParam);
        }
        break;
    case WM_TIMER:
    {
        switch ( wParam )
        {
        case WM_LOG_PAINT:
        {
            RECT rect;
            HDC hdc = GetDC(hWnd);
            GetClientRect(hWnd, &rect);
            FillRect(hdc, &rect, (HBRUSH)GetStockObject(0));
            ReleaseDC(hWnd, hdc);

            if ( LogTextPaint != NULL )
            {
                LogTextPaint(hWnd);
            }
        }
        break;
        //case WM_POSTLOG_PAINT:
        //{
        //	if(PostServer.m_ServerPort != -1)
        //	{
        //		RECT rect;
        //		hdc = GetDC(hWnd_Post);
        //		GetClientRect(hWnd_Post, &rect);
        //		FillRect(hdc, &rect, (HBRUSH)GetStockObject(0));
        //		ReleaseDC(hWnd_Post, hdc);
        //		LogTextPaint(hWnd_Post);
        //	}
        //}break;
        case WM_FOURHOURS:
        {
            if(DSCheckNumber() == 1)
                DataServer1.SendGensRankingUpdate();
            else if(DSCheckNumber() == 2)
                DataServer2.SendGensRankingUpdate();
        }
        break;
        case WM_LOG_DATE_CHANGE:
        {
            if(DSCheckNumber() == 1)
                DataServer1.SendClearCoins();
            else if(DSCheckNumber() == 2)
                DataServer2.SendClearCoins();

            LogDateChange();
        }
        break;
        }
    }
    break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    case WM_CLOSE:
        if(hWnd == hWnd_Post)
        {
            ShowWindow(hWnd,0);
            break;
        }
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}
Esempio n. 3
0
//
//  FUNCIÓN: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PROPÓSITO: procesar mensajes de la ventana principal.
//
//  WM_COMMAND	: procesar el menú de aplicación
//  WM_PAINT	: pintar la ventana principal
//  WM_DESTROY	: enviar un mensaje de finalización y volver
//
//
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);
		// Analizar las selecciones de menú:
		switch (wmId)
		{
		case IDM_BLIST:
				serverManager.ReadBlackList(BLISTFILE);
			break;
		case IDM_SLIST:
				serverManager.ReadList(SLISTFILE);
			break;
		case IDM_ULIST:
				serverManager.ReadUpdateConfig();
			break;

		case IDM_ABOUT:
			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
		case WM_TIMER:
			switch ( wParam )
			{
				case WM_LOG_PAINT:
					{
						RECT rect;
						HDC hdc = GetDC(hWnd);
						GetClientRect(hWnd, &rect);
						FillRect(hdc, &rect, (HBRUSH)GetStockObject(0));
						ReleaseDC(hWnd, hdc);

						if ( LogTextPaint != NULL )
							LogTextPaint(hWnd);

						//g_ServerInfoDisplayer.Run(hWnd);
					}
					break;
				case WM_LOG_DATE_CHANGE:
					LogDateChange();
					break;
				case WM_SECONDPROC:
				{
					OBJSecondProc();
				}break;
			}
		break;
	//case WM_PAINT:
	//	hdc = BeginPaint(hWnd, &ps);
	//	// TODO: agregar código de dibujo aquí...
	//	EndPaint(hWnd, &ps);
	//	break;
	case WM_DESTROY:
		DestroyIocp();
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}