void CEpgDataCap_BonDlg::OnSize(UINT nType, int cx, int cy) { CDialogEx::OnSize(nType, cx, cy); // TODO: ここにメッセージ ハンドラー コードを追加します。 if( nType == SIZE_MINIMIZED && this->minTask == TRUE){ CString buff=L""; wstring bonFile = L""; this->main.GetOpenBonDriver(&bonFile); CString strBuff2=L""; this->combService.GetWindowText(strBuff2); buff.Format(L"%s : %s", bonFile.c_str(), strBuff2.GetBuffer(0)); 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); } if(!this->iniMin) ShowWindow(SW_HIDE); } }
LRESULT CEpgDataCap_BonDlg::OnTaskbarCreated(WPARAM, LPARAM) { if( IsWindowVisible() == FALSE && this->minTask == TRUE){ CString buff=L""; wstring bonFile = L""; this->main.GetOpenBonDriver(&bonFile); CString strBuff2=L""; this->combService.GetWindowText(strBuff2); buff.Format(L"%s : %s", bonFile.c_str(), strBuff2.GetBuffer(0)); 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); } } return 0; }
LRESULT CEpgDataCap_BonDlg::OnTaskbarCreated(WPARAM, LPARAM) { if( IsWindowVisible(m_hWnd) == FALSE && this->minTask == TRUE){ 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); } } return 0; }
void CEpgDataCap_BonDlg::OnSize(UINT nType, int cx, int cy) { // TODO: ここにメッセージ ハンドラー コードを追加します。 if( nType == SIZE_MINIMIZED && this->minTask == TRUE){ 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); } if(!this->iniMin) ShowWindow(m_hWnd, SW_HIDE); } }
BOOL CEpgTimerTaskDlg::OnInitDialog() { CDialogEx::OnInitDialog(); // このダイアログのアイコンを設定します。アプリケーションのメイン ウィンドウがダイアログでない場合、 // Framework は、この設定を自動的に行います。 SetIcon(m_hIcon, TRUE); // 大きいアイコンの設定 SetIcon(m_hIcon, FALSE); // 小さいアイコンの設定 // TODO: 初期化をここに追加します。 wstring pipeName = L""; wstring pipeEventName = L""; Format(pipeName, L"\\\\.\\pipe\\EpgTimerGUI_Ctrl_BonPipe_%d", GetCurrentProcessId()); Format(pipeEventName, L"Global\\EpgTimerGUI_Ctrl_BonConnect_%d", GetCurrentProcessId()); m_cPipe.StartServer(pipeEventName.c_str(), pipeName.c_str(), OutsideCmdCallback, this); //ウインドウの復元 WINDOWPLACEMENT Pos; Pos.length = sizeof(WINDOWPLACEMENT); Pos.flags = NULL; Pos.showCmd = SW_HIDE; Pos.rcNormalPosition.left = 0; Pos.rcNormalPosition.right = 0; Pos.rcNormalPosition.top = 0; Pos.rcNormalPosition.bottom = 0; SetWindowPlacement(&Pos); CString strBuff=L""; if( AddTaskBar( GetSafeHwnd(), WM_TRAY_PUSHICON, TRAYICON_ID, m_hIconBlue, strBuff ) == FALSE ){ SetTimer(RETRY_ADD_TRAY, 5000, NULL); } CSendCtrlCmd cmd; if( cmd.SendRegistGUI(GetCurrentProcessId()) != CMD_SUCCESS ){ MessageBox(L"EpgTimerSrv.exeの起動を確認できませんでした。\r\n終了してください。"); } return TRUE; // フォーカスをコントロールに設定した場合を除き、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(SW_HIDE); } } break; case TIMER_STATUS_UPDATE: { KillTimer( TIMER_STATUS_UPDATE ); SetThreadExecutionState(ES_SYSTEM_REQUIRED); int iLine = this->editStatus.GetFirstVisibleLine(); 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); if(ret==TRUE){ this->statusLog.Format(L"Signal: %.02f Drop: %I64d Scramble: %I64d space: %d ch: %d",signal, drop, scramble, space, ch); }else{ this->statusLog.Format(L"Signal: %.02f Drop: %I64d Scramble: %I64d",signal, drop, scramble); } this->statusLog += L"\r\n"; CString udp = L""; if( udpSendList.size() > 0 ){ udp = "UDP送信:"; for( size_t i=0; i<udpSendList.size(); i++ ){ CString buff; if( udpSendList[i].broadcastFlag == FALSE ){ buff.Format(L"%s:%d ",udpSendList[i].ipString.c_str(), udpSendList[i].port); }else{ buff.Format(L"%s:%d(Broadcast) ",udpSendList[i].ipString.c_str(), udpSendList[i].port); } udp += buff; } udp += L"\r\n"; } this->statusLog += udp; CString tcp = L""; if( tcpSendList.size() > 0 ){ tcp = "TCP送信:"; for( size_t i=0; i<tcpSendList.size(); i++ ){ CString buff; buff.Format(L"%s:%d ",tcpSendList[i].ipString.c_str(), tcpSendList[i].port); tcp += buff; } tcp += L"\r\n"; } this->statusLog += tcp; SetDlgItemText(IDC_EDIT_STATUS, this->statusLog); editStatus.LineScroll(iLine); CString info = L""; this->main.GetEpgInfo(this->btnPgNext.GetCheck(), &info); if( this->pgInfo.Compare(info) != 0 ){ this->pgInfo = info; SetDlgItemText(IDC_EDIT_PG_INFO, this->pgInfo); } 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 ){ this->log.Format(L"%s (%d/%d 残り約 %d 秒)\r\n", chName.c_str(), chkNum, totalNum, (totalNum - chkNum)*10); SetDlgItemText(IDC_EDIT_LOG, this->log); SetTimer(TIMER_CHSCAN_STATSU, 1000, NULL); }else if( status == ST_CANCEL ){ KillTimer(TIMER_CHSCAN_STATSU); this->log = L"キャンセルされました\r\n"; SetDlgItemText(IDC_EDIT_LOG, this->log); }else if( status == ST_COMPLETE ){ KillTimer(TIMER_CHSCAN_STATSU); this->log = L"終了しました\r\n"; SetDlgItemText(IDC_EDIT_LOG, this->log); ReloadServiceList(); int sel = this->combService.GetCurSel(); if( sel != CB_ERR ){ DWORD index = (DWORD)this->combService.GetItemData(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(log.c_str()); } } } 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 = this->combService.GetCurSel(); if( sel != CB_ERR ){ DWORD index = (DWORD)this->combService.GetItemData(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); } this->log = L"EPG取得中\r\n"; SetDlgItemText(IDC_EDIT_LOG, this->log); SetTimer(TIMER_EPGCAP_STATSU, 1000, NULL); }else if( status == ST_CANCEL ){ KillTimer(TIMER_EPGCAP_STATSU); this->log = L"キャンセルされました\r\n"; SetDlgItemText(IDC_EDIT_LOG, this->log); }else if( status == ST_COMPLETE ){ KillTimer(TIMER_EPGCAP_STATSU); this->log = L"終了しました\r\n"; SetDlgItemText(IDC_EDIT_LOG, this->log); BtnUpdate(GUI_NORMAL); ChgIconStatus(); } } break; case TIMER_REC_END: { this->main.StopRec(); KillTimer(TIMER_REC_END); this->log = L"録画停止しました\r\n"; SetDlgItemText(IDC_EDIT_LOG, this->log); BtnUpdate(GUI_NORMAL); chkRecSet.SetCheck(FALSE); ChgIconStatus(); } break; case RETRY_ADD_TRAY: { KillTimer(RETRY_ADD_TRAY); CString buff=L""; wstring bonFile = L""; this->main.GetOpenBonDriver(&bonFile); CString strBuff2=L""; this->combService.GetWindowText(strBuff2); buff.Format(L"%s : %s", bonFile.c_str(), strBuff2.GetBuffer(0)); 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; } CDialogEx::OnTimer(nIDEvent); }
void CEpgTimerTaskDlg::OnTimer(UINT_PTR nIDEvent) { // TODO: ここにメッセージ ハンドラー コードを追加するか、既定の処理を呼び出します。 if( nIDEvent == RETRY_ADD_TRAY ){ KillTimer(RETRY_ADD_TRAY); CString strBuff=L""; /* RESERVE_DATA Item; if( GetNextReserve(&Item) == TRUE ){ wstring strTime; GetTimeString3(Item.StartTime, Item.dwDurationSec, strTime); strBuff += L"次の予約 "; strBuff += strTime.c_str(); strBuff += L" "; strBuff += Item.strTitle.c_str(); }else{ strBuff += L"次の予約 なし"; }*/ HICON hSetIcon = m_hIconBlue; switch(m_dwSrvStatus){ case 1: hSetIcon = m_hIconRed; break; case 2: hSetIcon = m_hIconGreen; break; default: break; } if( AddTaskBar( GetSafeHwnd(), WM_TRAY_PUSHICON, TRAYICON_ID, hSetIcon, strBuff ) == FALSE ){ SetTimer(RETRY_ADD_TRAY, 5000, NULL); } }else if( nIDEvent == RETRY_CHG_TRAY ){ KillTimer(RETRY_CHG_TRAY); CString strBuff=L""; /* RESERVE_DATA Item; if( GetNextReserve(&Item) == TRUE ){ wstring strTime; GetTimeString3(Item.StartTime, Item.dwDurationSec, strTime); strBuff += L"次の予約 "; strBuff += strTime.c_str(); strBuff += L" "; strBuff += Item.strTitle.c_str(); }else{ strBuff += L"次の予約 なし"; } */ HICON hSetIcon = m_hIconBlue; switch(m_dwSrvStatus){ case 1: hSetIcon = m_hIconRed; break; case 2: hSetIcon = m_hIconGreen; break; default: break; } if( ChgTipsTaskBar( GetSafeHwnd(), TRAYICON_ID, hSetIcon, strBuff ) == FALSE ){ SetTimer(RETRY_CHG_TRAY, 5000, NULL); } } CDialogEx::OnTimer(nIDEvent); }