void wlog(const char* buffer){ char* buf; int hloglen=GetWindowTextLength(hlog)+1; int slen=strlen(buffer)+1; if(slen<30000){ buf= new char[2];//hloglen+slen+1]; buf = (char*)Mrealloc(buf,hloglen+slen+1); memset(buf,0,hloglen+slen+1); if((hloglen+slen)<30000)GetWindowText(hlog,buf,hloglen); else{ char* tmpbuf=new char[2];tmpbuf = (char*)Mrealloc(tmpbuf,hloglen+1);GetWindowText(hlog,&tmpbuf[0],hloglen); //int oldsize;oldsize=sizeof(globallog); globallog = (char*)Mrealloc(globallog,hloglen+globallogsize+1); memcpy(&globallog[globallogsize],tmpbuf,hloglen-1);globallogsize+=hloglen; } lstrcat(buf,buffer); SetWindowText(hlog, buf); Edit_Scroll(hlog,Edit_GetLineCount(hlog),0); int wlen=GetWindowTextLength(hlog); Edit_SetSel(hlog,wlen-1,wlen); Edit_SetSel(hlog,wlen,wlen); SetFocus(hlog); ShowCaret(hlog); delete[] buf; } }
void Dlg_CreateReport (HWND hwndEdit) { TCHAR szBuf[500]; // Line buffer int i, nVisLine; DWORD dwMin, dwMax; float rAvg, rStdDev; // Disable updates to prevent the edit box from scrolling. SetWindowRedraw(hwndEdit, FALSE); Dlg_IntervalStat(g_pdwTickSamples, g_nSamplesMax, &dwMin, &dwMax, &rAvg, &rStdDev); // Clear the report. Edit_SetText(hwndEdit, _TEXT("")); // Write the report. _stprintf(szBuf, _TEXT("Period (mS): %lu\r\n") _TEXT("Sample Size: %lu\r\n") _TEXT("\r\n") _TEXT("Interval Statistics\r\n") _TEXT(" Avg. Period: %.3f\r\n") _TEXT(" Min. Period: %lu\r\n") _TEXT(" Max. Period: %lu\r\n") _TEXT(" Standard Dev.: %.3f\r\n") _TEXT("\r\n") _TEXT("Timer Samples:"), g_uPeriod, g_nSamplesMax, rAvg, dwMin, dwMax, (double) rStdDev); Dlg_AppendEditText(hwndEdit, szBuf); _tcscpy(szBuf, _TEXT("\r\n")); for (i = 0; i < g_nSamplesMax; i++) { _ultot(g_pdwTickSamples[i], szBuf + 2, 10); Dlg_AppendEditText(hwndEdit, szBuf); } // Move caret to start of text. Edit_SetSel(hwndEdit, 0, 0); // Make first report line first visible line. nVisLine = Edit_GetFirstVisibleLine(hwndEdit); Edit_Scroll(hwndEdit, -nVisLine, 0); // Enable updates, and force update. SetWindowRedraw(hwndEdit, TRUE); InvalidateRect(hwndEdit, NULL, TRUE); }
void CEpgDataCap_BonDlg::OnTimer(UINT_PTR nIDEvent) { // TODO: ここにメッセージ ハンドラー コードを追加するか、既定の処理を呼び出します。 switch(nIDEvent){ case TIMER_INIT_DLG: { KillTimer( TIMER_INIT_DLG ); if( this->iniMin == TRUE && this->minTask == TRUE){ ShowWindow(m_hWnd, SW_HIDE); } } break; case TIMER_STATUS_UPDATE: { KillTimer( TIMER_STATUS_UPDATE ); SetThreadExecutionState(ES_SYSTEM_REQUIRED); int iLine = Edit_GetFirstVisibleLine(GetDlgItem(IDC_EDIT_STATUS)); float signal = 0; DWORD space = 0; DWORD ch = 0; ULONGLONG drop = 0; ULONGLONG scramble = 0; vector<NW_SEND_INFO> udpSendList; vector<NW_SEND_INFO> tcpSendList; BOOL ret = this->main.GetViewStatusInfo(&signal, &space, &ch, &drop, &scramble, &udpSendList, &tcpSendList); wstring statusLog = L""; if(ret==TRUE){ Format(statusLog, L"Signal: %.02f Drop: %I64d Scramble: %I64d space: %d ch: %d",signal, drop, scramble, space, ch); }else{ Format(statusLog, L"Signal: %.02f Drop: %I64d Scramble: %I64d",signal, drop, scramble); } statusLog += L"\r\n"; wstring udp = L""; if( udpSendList.size() > 0 ){ udp = L"UDP送信:"; for( size_t i=0; i<udpSendList.size(); i++ ){ wstring buff; if( udpSendList[i].broadcastFlag == FALSE ){ Format(buff, L"%s:%d ",udpSendList[i].ipString.c_str(), udpSendList[i].port); }else{ Format(buff, L"%s:%d(Broadcast) ",udpSendList[i].ipString.c_str(), udpSendList[i].port); } udp += buff; } udp += L"\r\n"; } statusLog += udp; wstring tcp = L""; if( tcpSendList.size() > 0 ){ tcp = L"TCP送信:"; for( size_t i=0; i<tcpSendList.size(); i++ ){ wstring buff; Format(buff, L"%s:%d ",tcpSendList[i].ipString.c_str(), tcpSendList[i].port); tcp += buff; } tcp += L"\r\n"; } statusLog += tcp; SetDlgItemText(m_hWnd, IDC_EDIT_STATUS, statusLog.c_str()); Edit_Scroll(GetDlgItem(IDC_EDIT_STATUS), iLine, 0); wstring info = L""; this->main.GetEpgInfo(Button_GetCheck(GetDlgItem(IDC_CHECK_NEXTPG)), &info); WCHAR pgInfo[512] = L""; GetDlgItemText(m_hWnd, IDC_EDIT_PG_INFO, pgInfo, 512); if( info.substr(0, 511).compare(pgInfo) != 0 ){ SetDlgItemText(m_hWnd, IDC_EDIT_PG_INFO, info.c_str()); } SetTimer(TIMER_STATUS_UPDATE, 1000, NULL); } break; case TIMER_CHSCAN_STATSU: { KillTimer( TIMER_CHSCAN_STATSU ); DWORD space = 0; DWORD ch = 0; wstring chName = L""; DWORD chkNum = 0; DWORD totalNum = 0; DWORD status = this->main.GetChScanStatus(&space, &ch, &chName, &chkNum, &totalNum); if( status == ST_WORKING ){ wstring log; Format(log, L"%s (%d/%d 残り約 %d 秒)\r\n", chName.c_str(), chkNum, totalNum, (totalNum - chkNum)*10); SetDlgItemText(m_hWnd, IDC_EDIT_LOG, log.c_str()); SetTimer(TIMER_CHSCAN_STATSU, 1000, NULL); }else if( status == ST_CANCEL ){ KillTimer(TIMER_CHSCAN_STATSU); SetDlgItemText(m_hWnd, IDC_EDIT_LOG, L"キャンセルされました\r\n"); }else if( status == ST_COMPLETE ){ KillTimer(TIMER_CHSCAN_STATSU); SetDlgItemText(m_hWnd, IDC_EDIT_LOG, L"終了しました\r\n"); ReloadServiceList(); int sel = ComboBox_GetCurSel(GetDlgItem(IDC_COMBO_SERVICE)); if( sel != CB_ERR ){ DWORD index = (DWORD)ComboBox_GetItemData(GetDlgItem(IDC_COMBO_SERVICE), sel); SelectService(this->serviceList[index].originalNetworkID, this->serviceList[index].transportStreamID, this->serviceList[index].serviceID, this->serviceList[index].space, this->serviceList[index].ch ); } BtnUpdate(GUI_NORMAL); ChgIconStatus(); //同じサービスが別の物理チャンネルにあるかチェック wstring msg = L""; for( size_t i=0; i<this->serviceList.size(); i++ ){ for( size_t j=i+1; j<this->serviceList.size(); j++ ){ if( this->serviceList[i].originalNetworkID == this->serviceList[j].originalNetworkID && this->serviceList[i].transportStreamID == this->serviceList[j].transportStreamID && this->serviceList[i].serviceID == this->serviceList[j].serviceID ){ wstring log = L""; Format(log, L"%s space:%d ch:%d <=> %s space:%d ch:%d\r\n", this->serviceList[i].serviceName.c_str(), this->serviceList[i].space, this->serviceList[i].ch, this->serviceList[j].serviceName.c_str(), this->serviceList[j].space, this->serviceList[j].ch); msg += log; break; } } } if( msg.size() > 0){ wstring log = L"同一サービスが複数の物理チャンネルで検出されました。\r\n受信環境のよい物理チャンネルのサービスのみ残すように設定を行ってください。\r\n正常に録画できない可能性が出てきます。\r\n\r\n"; log += msg; MessageBox(m_hWnd, log.c_str(), NULL, MB_OK); } } } break; case TIMER_EPGCAP_STATSU: { KillTimer( TIMER_EPGCAP_STATSU ); EPGCAP_SERVICE_INFO info; DWORD status = this->main.GetEpgCapStatus(&info); if( status == ST_WORKING ){ int sel = ComboBox_GetCurSel(GetDlgItem(IDC_COMBO_SERVICE)); if( sel != CB_ERR ){ DWORD index = (DWORD)ComboBox_GetItemData(GetDlgItem(IDC_COMBO_SERVICE), sel); if( info.ONID != this->serviceList[index].originalNetworkID || info.TSID != this->serviceList[index].transportStreamID || info.SID != this->serviceList[index].serviceID ){ } this->initONID = info.ONID; this->initTSID = info.TSID; this->initSID = info.SID; ReloadServiceList(); this->main.SetSID(info.SID); } SetDlgItemText(m_hWnd, IDC_EDIT_LOG, L"EPG取得中\r\n"); SetTimer(TIMER_EPGCAP_STATSU, 1000, NULL); }else if( status == ST_CANCEL ){ KillTimer(TIMER_EPGCAP_STATSU); SetDlgItemText(m_hWnd, IDC_EDIT_LOG, L"キャンセルされました\r\n"); }else if( status == ST_COMPLETE ){ KillTimer(TIMER_EPGCAP_STATSU); SetDlgItemText(m_hWnd, IDC_EDIT_LOG, L"終了しました\r\n"); BtnUpdate(GUI_NORMAL); ChgIconStatus(); } } break; case TIMER_REC_END: { this->main.StopRec(); KillTimer(TIMER_REC_END); SetDlgItemText(m_hWnd, IDC_EDIT_LOG, L"録画停止しました\r\n"); BtnUpdate(GUI_NORMAL); Button_SetCheck(GetDlgItem(IDC_CHECK_REC_SET), BST_UNCHECKED); ChgIconStatus(); } break; case RETRY_ADD_TRAY: { KillTimer(RETRY_ADD_TRAY); wstring buff=L""; wstring bonFile = L""; this->main.GetOpenBonDriver(&bonFile); WCHAR szBuff2[256]=L""; GetWindowText(GetDlgItem(IDC_COMBO_SERVICE), szBuff2, 256); Format(buff, L"%s : %s", bonFile.c_str(), szBuff2); HICON setIcon = this->iconBlue; if( this->main.IsRec() == TRUE ){ setIcon = this->iconRed; }else if( this->main.GetEpgCapStatus(NULL) == ST_WORKING ){ setIcon = this->iconGreen; }else if( this->main.GetOpenBonDriver(NULL) == FALSE ){ setIcon = this->iconGray; } if( AddTaskBar( GetSafeHwnd(), WM_TRAY_PUSHICON, TRAYICON_ID, setIcon, buff ) == FALSE ){ SetTimer(RETRY_ADD_TRAY, 5000, NULL); } } break; default: break; } }
void LargeTextWindow::ScrollVertically(int delta_lines) { Edit_Scroll(*this, delta_lines, 0); }
void CPlugin::outputToNativeWindow(LPSTR szString) { if (!m_hWndStandAloneLogWindow) return; // VERSION FOR EDIT BOX static char text[16384]; if (strlen(szString)) { int length = Edit_GetTextLength(m_hWndStandAloneLogWindow); if ((length + strlen(szString)) > sizeof(text)) strcpy(text, szString); else { Edit_GetText(m_hWndStandAloneLogWindow, text, sizeof(text)); strcat(text, szString); } Edit_SetText(m_hWndStandAloneLogWindow, text); int lines = Edit_GetLineCount(m_hWndStandAloneLogWindow); Edit_Scroll(m_hWndStandAloneLogWindow, lines, 0); } else Edit_SetText(m_hWndStandAloneLogWindow, ""); // clear the window /* // VERSION FOR LISTBOX // parse the string and add lines to the listbox char *p = 0; char *newline = szString; for (;;) { // could be either \r\n or \n, we don't need them at all for the listbox p = strchr(newline, '\n'); if (!p) break; if (*(p - 1) == '\r') *(p - 1) = '\0'; else *p = '\0'; char line[512]; strcpy(line, newline); ListBox_AddString(m_hWndStandAloneLogWindow, line); int count = ListBox_GetCount(m_hWndStandAloneLogWindow); if(count == 32767) ListBox_ResetContent(m_hWndStandAloneLogWindow); ListBox_SetCaretIndex(m_hWndStandAloneLogWindow, count - 1); UpdateWindow(m_hWndStandAloneLogWindow); // restore the original if (*p == '\n') *(p - 1) = '\r'; else *p = '\n'; newline = ++p; } */ }