/********************************************************************* * * Function : InitLogWindow * * Description : Initialise the log window. * * Parameters : None * * Returns : Always TRUE (there should be error checking on the resources). * *********************************************************************/ BOOL InitLogWindow(void) { int i; /* Load the icons */ g_hiconIdle = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_IDLE)); g_hiconOff = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_OFF)); for (i = 0; i < ANIM_FRAMES; i++) { g_hiconAnim[i] = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ANIMATED1 + i)); } g_hiconApp = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_MAINICON)); /* Create the user interface */ g_hwndLogFrame = CreateLogWindow(g_hInstance, g_nCmdShow); g_hwndTray = CreateTrayWindow(g_hInstance); TrayAddIcon(g_hwndTray, 1, g_hiconApp, "Privoxy"); /* Create pattern matching buffers (for highlighting */ LogCreatePatternMatchingBuffers(); /* Create a critical section to protect multi-threaded access to certain things */ InitializeCriticalSection(&g_criticalsection); return TRUE; }
void CMessageLog::Show() { #ifdef CONFIG_MESSAGE_LOG_WIN32 if (m_hwndMessageLog == NULL) CreateLogWindow(); ::ShowWindow(m_hwndMessageLog, SW_SHOW); if (!g_fMessageLogsPaused) ::SendMessage(m_hwndRichEdit, WM_VSCROLL, SB_BOTTOM, d_zNA); // When the Message Log becomes visible, scroll at the bottom so the user may see the most recent messages. #else Report(m_pwChatDebugger != NULL && "The widget should have been created!"); if (m_pwChatDebugger == NULL) CreateLogWindow(); m_pwChatDebugger->show(); #endif }
CWinLog::CWinLog( QWidget *parent, long MaxLines /*= 1000*/ ) : m_lMaxLines( MaxLines ) , m_bFirstString( true ) { CreateLogWindow(parent); //QObject::connect(this, SIGNAL(sendMessage(void)), this, SLOT(UsersEndMessage(void))); }
void KLog::SetTarget(UINT32 nTarget, LPSTR szFilename){ m_nTarget = nTarget; if (nTarget & K_LOG_TARGET_FILE) lstrcpy(m_szFilename, szFilename); else m_szFilename[0] = NULL; if (nTarget & K_LOG_TARGET_WINDOW) CreateLogWindow(); else m_hwnd = NULL; Log("KLog Logging Started"); }
ZFLog::ZFLog( UINT32 nTarget, LPSTR szFilename ) { m_nTarget = nTarget; if( nTarget & ZF_LOG_TARGET_FILE ) lstrcpy( m_szFilename, szFilename ); else m_szFilename[0] = NULL; if( nTarget & ZF_LOG_TARGET_WINDOW ) CreateLogWindow(); else m_hwnd = NULL; Log( "F-Killer Logging Started..." ); }
//로그창 설정 HRESULT cLogMgr::Init( unsigned int nTarget, HWND hParentWnd, const char* pszFileName ) { m_nTarget = nTarget; //로그파일로 저장한다면... if( m_nTarget & LOG_FILE ) strcpy_s( m_szFileName, MAX_PATH, pszFileName ); else m_szFileName[0] = NULL; //로그 윈도우라면... if( m_nTarget & LOG_WINDOW ) CreateLogWindow( hParentWnd ); AddLog( "============== Begin Log ============== " ); return S_OK; }
void static OnCreate (HWND hWnd) /* Effect: Perform all actions needed when the main window is created. In particular, create the three data windows, and show one of them. To Do: Check for proper creation. If not possible, we will need to abort creation of the program. Called By: MainWndProc only, in response to a WM_CREATE message. */ { // OnCreate hWndGraph = CreateGraphWindow (hWnd) ; #ifdef ADVANCED_PERFMON hWndLog = CreateLogWindow (hWnd) ; hWndAlert = CreateAlertWindow (hWnd) ; hWndReport = CreateReportWindow (hWnd) ; #endif hWndStatus = CreatePMStatusWindow (hWnd) ; CreateToolbarWnd (hWnd) ; MinimumSize += WindowHeight (hWndToolbar) ; Options.bMenubar = TRUE ; Options.bToolbar = TRUE ; Options.bStatusbar = TRUE; Options.bAlwaysOnTop = FALSE ; // initialize to chart view - HWC iPerfmonView = IDM_VIEWCHART; ShowWindow (PerfmonViewWindow (), SW_SHOWNORMAL) ; } // OnCreate
CWinLog::CWinLog( long MaxLines /*= 1000*/ ) : m_lMaxLines( MaxLines ) , m_bFirstString( true ) { CreateLogWindow(); }
void CMessageLog::AppendTextU(QRGBX coxTextColor, PSZUC pszuTextAppend, PSZAC pszTextExtra) { if (g_fMessageLogsPaused) return; #ifdef CONFIG_MESSAGE_LOG_WIN32 if (g_hwndMainWindow == NULL) { // The main window has not been created yet, so this message is very early (typically an assertion failure within a constructor or something of that sort) //Assert(g_pwMainWindow == NULL); // This pointer should also be NULL //Assert(m_hwndMessageLog == NULL); ::OutputDebugStringA((PSZAC)pszuTextAppend); ::OutputDebugStringA((PSZAC)pszTextExtra); return; } if (m_hwndMessageLog == NULL) CreateLogWindow(); if (!IsWindow(m_hwndRichEdit)) { ::OutputDebugStringA("MessageLog: Rich Edit is unavailable\n"); if (this != &g_oErrorLog) ErrorLog_AddNewMessage("MessageLog: Rich Edit is unavailable\n", pszuTextAppend); /* if (g_pwMainWindow != NULL) g_pwMainWindow->setWindowTitle(QString::fromUtf8((const char *)pszuTextAppend)); // Try to display something to the user using the caption as the "Message Log" */ return; } RichEdit_SelectionMoveToEnd(m_hwndRichEdit); int ichSel = 0; // Index of the last selected character. ::SendMessage(m_hwndRichEdit, EM_GETSEL, OUT (WPARAM)&ichSel, OUT (LPARAM)&ichSel); // The start and end of the selection should be the same, since we just called RichEdit_SelectionMoveToEnd(). if (ichSel >= d_cchLogMax) { // The log is full, so flush some of the data ::SendMessage(m_hwndRichEdit, EM_SETSEL, 0, d_cchLogMax / 4); // Remove one fourth of the log ::SendMessage(m_hwndRichEdit, EM_REPLACESEL, FALSE /* fCanUndo */, (LPARAM)L"[...]"); RichEdit_SelectionMoveToEnd(m_hwndRichEdit); } // Set the character format to the insertion point CHARFORMAT cf; InitToGarbage(OUT &cf, sizeof(cf)); cf.cbSize = sizeof(cf); cf.dwMask = CFM_COLOR | CFM_BOLD; cf.crTextColor = COX_GetRGB(coxTextColor); cf.dwEffects = COX_IsBold(coxTextColor) ? CFE_BOLD : 0; Verify( ::SendMessage(m_hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION, IN (LPARAM)&cf) ); // If the EM_SETCHARFORMAT fails, it may be because the method EditW_EnableColoring() was not called. SETTEXTEX st = { ST_SELECTION, CP_UTF8 }; ::SendMessage(m_hwndRichEdit, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)pszuTextAppend); if (pszTextExtra != NULL) ::SendMessage(m_hwndRichEdit, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)pszTextExtra); ::SendMessage(m_hwndRichEdit, WM_VSCROLL, SB_BOTTOM, d_zNA); // Ensure the inserted text is visible by scrolling to the bottom ::UpdateWindow(m_hwndRichEdit); // Force the window to redraw immediately #else Report(m_pwChatDebugger != NULL && "The widget should have been created!"); if (m_pwChatDebugger == NULL) CreateLogWindow(); Assert(m_pwChatDebugger != NULL); Assert(m_pwTextBrowser != NULL); if (m_pwTextBrowser != NULL) { QTextCursor oTextCursor = m_pwTextBrowser->textCursor(); oTextCursor.movePosition(QTextCursor::End); m_pwTextBrowser->setTextCursor(oTextCursor); m_pwTextBrowser->setFontWeight(COX_IsBold(coxTextColor) ? QFont::Bold : QFont::Normal); m_pwTextBrowser->setTextColor(COX_GetQRGB(coxTextColor)); m_pwTextBrowser->insertPlainText(QString::fromUtf8((char *)pszuTextAppend)); if (pszTextExtra != NULL) m_pwTextBrowser->insertPlainText(QString::fromUtf8((char *)pszTextExtra)); Widget_ScrollToEnd(m_pwTextBrowser); } #endif } // AppendTextU()
public: void CreateWidget() { CreateLogWindow(); } // Wrapper to create the MessageLog