BOOL CDlgJianmoLogin::InitHistoryList( void ) { if ( IsWindow( m_wndGridHistory.GetSafeHwnd() ) ) return FALSE; CRect rc; m_wndHistoryList.GetClientRect (&rc); m_wndHistoryList.MapWindowPoints (this, &rc); m_wndGridHistory.Create (WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, rc, this, (UINT)-1); m_wndGridHistory.m_hwndRecvMsg = this->GetSafeHwnd(); m_wndGridHistory.EnableColumnAutoSize (FALSE); m_wndGridHistory.SetSingleSel (TRUE); m_wndGridHistory.EnableGroupByBox (FALSE); m_wndGridHistory.SetReadOnly (TRUE); m_wndGridHistory.SetWholeRowSel (TRUE); m_wndGridHistory.EnableHeader (TRUE, 0); m_wndGridHistory.SetWindowPos (&CWnd::wndTop, -1, -1, -1, -1, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); //设置颜色 CBCGPGridColors colors; colors.m_LeftOffsetColors.m_clrBackground = globalData.clrWindow; m_wndGridHistory.SetColorTheme (colors); //初始化列 int nColCount = sizeof( arrColName ) / sizeof( LPCTSTR ); for (int i=0; i<nColCount; i++) { m_wndGridHistory.InsertColumn ( i, arrColName[i], arrColWidth[i] ); } //取得行数据 LoadHistoryList(); //更新 m_wndGridHistory.AdjustLayout (); return TRUE; }
void ShowHistory(MCONTACT hContact, BYTE isAlert) { HWND hHistoryDlg = WindowList_Find(hWindowList, hContact); if (hHistoryDlg == NULL) { hHistoryDlg = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_HISTORY), NULL, HistoryDlgProc, hContact); LoadHistoryList(hContact, hHistoryDlg, IDC_HISTORYLIST); WindowList_Add(hWindowList, hHistoryDlg, hContact); } else { SetForegroundWindow(hHistoryDlg); LoadHistoryList(hContact, hHistoryDlg, IDC_HISTORYLIST); SetFocus(hHistoryDlg); } if (isAlert) SkinPlaySound("LastSeenTrackedStatusChange"); }