void CCellphoneDlg::OnYes() { // TODO: Add extra validation here m_pCellphoneSocket = new CellphoneSocket(); if( !m_pCellphoneSocket->Create(CELLPHONE_PORT) ) { MessageBox("Failed to create the chatting socket"); delete m_pCellphoneSocket; m_pCellphoneSocket = NULL; } if( !m_pCellphoneSocket->Listen() ) { MessageBox("Failed to listen to a connection for chat"); delete m_pCellphoneSocket; m_pCellphoneSocket = NULL; } CEdit* status = (CEdit*)GetDlgItem(IDC_STATUS); CButton* ok = (CButton*)GetDlgItem(ID_YES); CButton* cancel = (CButton*)GetDlgItem(ID_NO); status->SetWindowText("Listening to a cellphone..."); ok->ShowWindow(FALSE); cancel->SetWindowText("Cancel"); cancel->ShowWindow(TRUE); m_bIsListening = true; m_bIsConnected = false; }
void CMonProcDlg::OnCancelCheckTomcat( ) { CButton *pCheckButton = (CButton *) GetDlgItem( IDC_CHECKTOMCAT ); CButton *pCancelButton = (CButton *) GetDlgItem( IDC_CANCELCHECKTOMCAT ); pCheckButton->EnableWindow( TRUE ); pCheckButton->ShowWindow( SW_SHOW ); pCancelButton->ShowWindow( SW_HIDE ); PumpMessages( ); CancelCheckTomcat( ); }
void zstringEx::showCtl(int CtlID,BOOL isshow,HWND ParentWindowHwnd) { HWND oh; if(ParentWindowHwnd==NULL) { CWnd *w=::AfxGetMainWnd(); oh=w->m_hWnd; } else oh=ParentWindowHwnd; CButton b; b.Attach(GetDlgItem(oh,CtlID)); if(isshow)b.ShowWindow(SW_SHOW);else b.ShowWindow(SW_HIDE); b.Detach(); }
void CDBSchemaTableView::CreateButton(CButton& btn, UINT id, CWnd* pParent, LPCTSTR lpTitle, UINT width, UINT height, DWORD dwStyle, CFont* pFont) { static CFont* pDefaultFont = 0; if(!pDefaultFont) { pDefaultFont = new CFont; pDefaultFont->CreateFont(16, // nHeight 0, // nWidth 0, // nEscapement 0, // nOrientation 0, // nWeight FALSE, // bItalic FALSE, // bUnderline 0, // cStrikeOut ANSI_CHARSET, // nCharSet OUT_DEFAULT_PRECIS, // nOutPrecision CLIP_DEFAULT_PRECIS, // nClipPrecision DEFAULT_QUALITY, // nQuality DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily _T( "Arial ")); // lpszFac } RECT rect = {0, 0, width, height}; btn.Create(lpTitle, dwStyle, rect, pParent, id); if(!pFont) pFont = pDefaultFont; btn.SetFont(pFont); btn.ShowWindow(SW_SHOW); }
void CScriptEdit::RefreshDialog() { CString tmpstr; CButton *cb; int topline; int i; if(m_firsterror>=0) { topline=m_text_control.GetFirstVisibleLine(); for(i=0;i<LINES;i++) { cb=(CButton *) GetDlgItem(IDC_U1+i); if(topline+i>=m_count) { cb->ShowWindow(false); } else { cb->ShowWindow(true); tmpstr.Format("%d",topline+i+1); cb->SetWindowText(tmpstr); if(m_errors[topline+i]&0xffff) cb->SetCheck(false); else cb->SetCheck(true); } } } else { topline=m_text_control.GetFirstVisibleLine(); for(i=0;i<LINES;i++) { cb=(CButton *) GetDlgItem(IDC_U1+i); if(topline+i>=m_count) { cb->ShowWindow(false); } else { cb->ShowWindow(true); tmpstr.Format("%d",topline+i+1); cb->SetWindowText(tmpstr); cb->SetCheck(true); } } } }
BOOL CFormatConverterWnd::OnInitDialog() { BOOL bResult = CPropertySheet::OnInitDialog(); // TODO: Add your specialized code here ModifyStyle(0, WS_MINIMIZEBOX); CButton* omBtn; WINDOWPLACEMENT omWndPlace; omBtn = reinterpret_cast<CButton*>(GetDlgItem(ID_APPLY_NOW)); omBtn->ShowWindow(SW_HIDE); omBtn->GetWindowPlacement(&omWndPlace); omBtn = reinterpret_cast<CButton*>(GetDlgItem(IDOK)); omBtn->ShowWindow(SW_HIDE); omBtn = reinterpret_cast<CButton*>(GetDlgItem(IDCANCEL)); omBtn->SetWindowText("Close"); omBtn->SetWindowPlacement(&omWndPlace); return bResult; }
void Display::updateState(BOOL pstate,BOOL nstate) { CEdit *eser,*eport,*euser; CStatic *sser,*sport,*suser,*sgroup1,*sgroup2; CButton *con; //Destroy server related items con=(CButton*)GetDlgItem(IDC_BUTTON1); con->ShowWindow(pstate); eser=(CEdit*)GetDlgItem(IDC_EDIT1); eser->ShowWindow(pstate); eport=(CEdit*)GetDlgItem(IDC_EDIT2); eport->ShowWindow(pstate); euser=(CEdit*)GetDlgItem(IDC_EDIT3); euser->ShowWindow(pstate); sser=(CStatic*)GetDlgItem(1098); sser->ShowWindow(pstate); suser=(CStatic*)GetDlgItem(1086); suser->ShowWindow(pstate); sport=(CStatic*)GetDlgItem(1099); sport->ShowWindow(pstate); sgroup1=(CStatic*)GetDlgItem(1097); sgroup1->ShowWindow(pstate); //Enable Send to items sgroup2=(CStatic*)GetDlgItem(1075); sgroup2->ShowWindow(nstate); radio1=(CButton*)GetDlgItem(IDC_RADIO1); radio2=(CButton*)GetDlgItem(IDC_RADIO2); start=(CButton*)GetDlgItem(IDC_BUTTON5); stop=(CButton*)GetDlgItem(IDC_BUTTON6); radio1->ShowWindow(nstate); radio2->ShowWindow(nstate); radio1->SetCheck(1); radio2->SetCheck(0); start->ShowWindow(nstate); cbox->ShowWindow(nstate); if(doit==TRUE) talk->ShowWindow(TRUE); anicon->ShowWindow(FALSE); }
void ProceedingDialog::OnShowWindow(BOOL bShow, UINT nStatus) { CDialog::OnShowWindow(bShow, nStatus); if ( bShow ) { CButton *bp = (CButton *)GetDlgItem( IDCANCEL ); bp->ShowWindow( SW_HIDE ); } }
LRESULT CCellphoneDlg::OnAccept(WPARAM wParam, LPARAM lParam) { m_device->m_bOnInputDevice = true; m_device->m_typeOnInputDevice = CELLPHONE_TOUCHPAD; CEdit* status = (CEdit*)GetDlgItem(IDC_STATUS); CButton* ok = (CButton*)GetDlgItem(ID_YES); CButton* cancel = (CButton*)GetDlgItem(ID_NO); status->SetWindowText("Cellphone is connected"); ok->ShowWindow(FALSE); cancel->SetWindowText("Disconnect"); cancel->ShowWindow(TRUE); m_bIsListening = false; m_bIsConnected = true; return 0; }
void MessagesDlg::UpdateHoldButton(pjsua_call_info *call_info) { #ifndef _GLOBAL_NO_HOLD MessagesContact* messagesContact = GetMessageContact(); if (messagesContact) { CButton* button = (CButton*)GetDlgItem(IDC_HOLD); CButton* buttonTransfer = (CButton*)GetDlgItem(IDC_TRANSFER); CButton* buttonDialer = (CButton*)microsipDlg->pageDialer->GetDlgItem(IDC_HOLD); CButton* buttonTransferDialer = (CButton*)microsipDlg->pageDialer->GetDlgItem(IDC_TRANSFER); if (messagesContact->callId != -1) { if (call_info && messagesContact->callId == call_info->id && call_info->media_cnt>0) { buttonTransfer->ShowWindow(SW_SHOW); buttonTransferDialer->EnableWindow(TRUE); if (call_info->media_status == PJSUA_CALL_MEDIA_ACTIVE || call_info->media_status == PJSUA_CALL_MEDIA_REMOTE_HOLD ) { button->ShowWindow(SW_SHOW); button->SetCheck(BST_UNCHECKED); buttonDialer->EnableWindow(TRUE); buttonDialer->SetCheck(BST_UNCHECKED); return; } else if (call_info->media_status == PJSUA_CALL_MEDIA_LOCAL_HOLD || call_info->media_status == PJSUA_CALL_MEDIA_NONE) { button->ShowWindow(SW_SHOW); button->SetCheck(BST_CHECKED); buttonDialer->EnableWindow(TRUE); buttonDialer->SetCheck(BST_CHECKED); return; } } } else { button->ShowWindow(SW_HIDE); button->SetCheck(BST_UNCHECKED); buttonDialer->EnableWindow(FALSE); buttonDialer->SetCheck(BST_UNCHECKED); buttonTransfer->ShowWindow(SW_HIDE); buttonTransferDialer->EnableWindow(FALSE); } } #endif }
BOOL CWSPrintDialog::OnInitDialog() { bool bShowPrintRedlineOptions = Workshare::OptionApi::GetBool( L"ShowPrintRedlineOptions"); CButton *pButton; pButton = (CButton*)GetDlgItem(IDC_CHECK_BW); if( bShowPrintRedlineOptions) { pButton->SetCheck(m_bBlackAndWhite); } else { pButton->ShowWindow( SW_HIDE); } pButton = (CButton*)GetDlgItem(IDC_CHECK_CHANGES); if( bShowPrintRedlineOptions) { pButton->SetCheck(m_bChangesOnly); } else { pButton->ShowWindow(SW_HIDE); } // resize the control to 3 times the width CRect rcIcon; GetDlgItem(1086)->GetWindowRect(rcIcon); GetDlgItem(1086)->SetWindowPos(&wndTop, 0, 0, 2+rcIcon.Width()*3, 2+rcIcon.Height(), SWP_NOMOVE); CEdit *pEdit = (CEdit *)GetDlgItem(1154); pEdit->EnableWindow(TRUE); CButton *pCheck = (CButton *)GetDlgItem( 1041 ); m_bCollate = pCheck->GetCheck(); CButton *pCheckPrintToFile = (CButton *)GetDlgItem( 1040 ); pCheckPrintToFile->SetCheck(FALSE); return TRUE; }
void CCellphoneDlg::OnNo() { // TODO: Add extra cleanup here CEdit* status = (CEdit*)GetDlgItem(IDC_STATUS); CButton* ok = (CButton*)GetDlgItem(ID_YES); CButton* cancel = (CButton*)GetDlgItem(ID_NO); if(m_pCellphoneSocket) { delete m_pCellphoneSocket; m_pCellphoneSocket = NULL; } status->SetWindowText("Listen to a cellphone?"); ok->SetWindowText("Listen"); ok->ShowWindow(TRUE); cancel->ShowWindow(FALSE); m_bIsListening = false; m_bIsConnected = false; }
void CRichListCtrl::DrawItem(CDC* pDC, int nItem, CRect &rcItem) { if (nItem < 0 || nItem >= (int)m_vctItem.size()) { return; } bool bSelected = false; if (GetItemState(nItem, LVIS_SELECTED)) { bSelected = true; } bool bFocus = false; CWnd *pWndFocus = GetFocus(); if (IsChild(pWndFocus) || pWndFocus == this) { bFocus = true; } int pos = GetScrollPos(SB_HORZ); int nColumnCount = GetHeaderCtrl()->GetItemCount(); CRect rcSubItem; for (int j = 0; j < nColumnCount; ++j) { GetHeaderCtrl()->GetItemRect(j, &rcSubItem); rcSubItem.top = rcItem.top; rcSubItem.bottom = rcItem.bottom; rcSubItem.OffsetRect(-pos, 0); if(rcSubItem.right < rcItem.left || rcSubItem.left > rcItem.right) { continue; } map<int, ListSubItem*>::iterator it = m_vctItem[nItem].find(j); if (it == m_vctItem[nItem].end() || it->second->itemType == CTRL_STATIC) { DrawSubItem(pDC, nItem, j, rcSubItem, bSelected, bFocus); } else if (it->second->itemType == CTRL_BUTTON) { CButton *pButton = (CButton*)(it->second->pItem); if (pButton != NULL) { pButton->ShowWindow(SW_SHOW); pButton->MoveWindow(rcSubItem); } } } }
BOOL CCellphoneDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here m_device = &((CChatDlg*)m_pChatDlg)->m_pHugMe->m_device; CEdit* status = (CEdit*)GetDlgItem(IDC_STATUS); CButton* ok = (CButton*)GetDlgItem(ID_YES); CButton* cancel = (CButton*)GetDlgItem(ID_NO); status->SetWindowText("Listen to a cellphone?"); ok->SetWindowText("Listen"); ok->ShowWindow(TRUE); cancel->ShowWindow(FALSE); m_bIsListening = false; m_bIsConnected = false; return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CWelcomeWnd::OnPaint() { CPaintDC dc(this); // device context for painting // get our own DC instead, with no restrictions CDC* pDC = GetDC(); // realize the palette CPalette* pOldPalette = pDC->SelectPalette(m_bitmap.GetPalette(), FALSE); pDC->RealizePalette(); // And draw the bitmap BITMAP bmInfo; if (m_bitmap.m_hObject == NULL) return; m_bitmap.GetObject(sizeof(BITMAP),&bmInfo); CDC newDC; newDC.CreateCompatibleDC(pDC); CBitmap* pOldBitmap = newDC.SelectObject(&m_bitmap); pDC->BitBlt(0,0,bmInfo.bmWidth,bmInfo.bmHeight,&newDC,0,0,SRCCOPY); // (void)newDC.SelectObject(pOldBitmap); newDC.DeleteDC(); pDC->SelectPalette(pOldPalette, FALSE); ReleaseDC(pDC); // draw the 'OK' button CRect winRect, rect; GetClientRect(&winRect); CButton* pBtn = (CButton*) GetDlgItem(IDOK); pBtn->GetWindowRect(&rect); ScreenToClient(&rect); int nWidth = rect.Width(); int nHeight = rect.Height(); rect.bottom = winRect.bottom - 24; rect.top = rect.bottom - nHeight; rect.left = (winRect.right - nWidth) / 2; rect.right = rect.left + nWidth; pBtn->MoveWindow(&rect); pBtn->ShowWindow(SW_SHOW); }
// enum camera callback static void callback(void *pItem, char *pDeviceName) { TCHAR buffer[80] = L""; size_t wlen; int *idcCam = (int*)pItem; if (*idcCam <= IDC_CAM4) { CButton *item = (CButton*)pDlg->GetDlgItem(*idcCam); item->EnableWindow(); item->SetCheck(BST_CHECKED); item->ShowWindow(SW_SHOWNORMAL); mbstowcs_s(&wlen, buffer, pDeviceName, 80); // Buffaloのカメラの行末にCR,LFが入っているので、これを除去 for (wlen--; 0 < wlen; wlen--) { if (buffer[wlen] == 13 || buffer[wlen] == 10) buffer[wlen] = 0; } item->SetWindowText(buffer); } (*idcCam)++; }
/* #FN# Performs special processing when the dialog box is initialized */ BOOL /* #AS# TRUE unless you set the focus to a control */ CWarningDlg:: OnInitDialog() { CDialog::OnInitDialog(); if( !m_bCancel ) { CRect rcCtrl; CButton *pButton = (CButton *)GetDlgItem( IDCANCEL ); ASSERT(NULL != pButton); pButton->GetWindowRect( rcCtrl ); ScreenToClient( rcCtrl ); pButton->ShowWindow( SW_HIDE ); pButton = (CButton *)GetDlgItem( IDOK ); ASSERT(NULL != pButton); pButton->SetWindowPos( NULL, rcCtrl.TopLeft().x, rcCtrl.TopLeft().y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS ); } if( '\0' == *m_szWarningText ) _LoadStringLx( -1 != m_nWarningID ? m_nWarningID : IDS_WARN_ERROR, m_szWarningText ); SetDlgItemText( IDC_WARNING_TEXT, m_szWarningText ); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } /* #OF# CWarningDlg::OnInitDialog */
void CMonProcDlg::OnCheckTomcatButton( ) { CString csTomcat = "java"; CWnd *pWnd = 0; bool bStatus; #ifdef DEBUG_TRACE bool bTrace = FALSE; #endif int nCnt; int nStartupDelay = m_nStartupDelay / 20; long lRC; if ( nStartupDelay < 100 ) nStartupDelay = 100; CButton *pCheckButton = (CButton *) GetDlgItem( IDC_CHECKTOMCAT ); CButton *pCancelButton = (CButton *) GetDlgItem( IDC_CANCELCHECKTOMCAT ); pCheckButton->EnableWindow( FALSE ); PumpMessages( ); g_nCheckTomcat = 1; // going to begin checking Tomcat while ( g_nCheckTomcat ) { if ( !m_win32proc.GetProcessStatus( &csTomcat, &bStatus ) ) { AfxMessageBox( m_win32proc.GetLastError( ) ); return; } if ( pWnd == 0 && m_csWindowTitle.IsEmpty( ) == FALSE ) pWnd = FindWindow( m_csWindowClass, m_csWindowTitle ); if ( bStatus == FALSE ) // Tomcat not running { if ( m_nWriteLogMessage ) { if ( pWnd && ::IsWindow( pWnd->m_hWnd ) ) { ::SendMessage( pWnd->m_hWnd, WM_USER + m_nWriteLogMessage, 0, 0 ); PumpMessages( ); } } WinExec( m_csKillApp, SW_SHOW ); pWnd = 0; #ifdef DEBUG_TRACE TRACE0( "Tomcat not running\n" ); bTrace = FALSE; #endif Sleep( m_nKillAppDelay ); // two-second delay to let OE go down WinExec( m_csStartup, SW_SHOW ); #ifdef DEBUG_TRACE TRACE0( "WinExec Tomcat startup\n" ); #endif nCnt = 0; while ( g_nCheckTomcat && nCnt++ < 20 ) { PumpMessages( ); Sleep( nStartupDelay ); // twenty-second delay to let Tomcat start } } else { #ifdef DEBUG_TRACE if ( bTrace == FALSE ) { TRACE0( "Tomcat is running\n" ); bTrace = TRUE; } #endif if ( pWnd ) { if ( ::IsWindow( pWnd->m_hWnd ) ) { lRC = ::SendMessage( pWnd->m_hWnd, WM_USER + m_nQueryAliveMessage, 0, 0 ); PumpMessages( ); } else lRC = 0; } else lRC = -1; if ( lRC != -1 ) { // ::SendMessage( pWnd->m_hWnd, WM_USER + m_nWriteLogMessage, 0, 0 ); doesn't exist // PumpMessages( ); WinExec( m_csKillApp, SW_SHOW ); // stop OE pWnd = 0; #ifdef DEBUG_TRACE TRACE0( "Zeidon not running\n" ); bTrace = FALSE; #endif WinExec( m_csShutdown, SW_SHOW ); // stop Tomcat Sleep( m_nKillAppDelay ); // two-second delay to let OE go down WinExec( m_csStartup, SW_SHOW ); #ifdef DEBUG_TRACE TRACE0( "WinExec Tomcat2 startup\n" ); #endif } } if ( g_nCheckTomcat == 1 ) // beginning to check Tomcat { g_nCheckTomcat = 2; // check for Tomcat now in full swing pCheckButton->ShowWindow( SW_HIDE ); pCancelButton->ShowWindow( SW_SHOW ); } PumpMessages( ); Sleep( 1000 ); // one-second delay to let other apps work } }
void CWarnPopVideo::FullScreenPopVideo(void) { if (m_bFullScreen==false) //full screen { //Hide OK Button CButton *pBtnOK = (CButton *)GetDlgItem(IDOK); if (pBtnOK) pBtnOK->ShowWindow(SW_HIDE); CEdit *pEdit = (CEdit*)GetDlgItem(IDC_TIMEOUT); if (pEdit) pEdit->ShowWindow(SW_HIDE); CButton *pBtnPause = (CButton*)GetDlgItem(IDC_PAUSE_ALARM); if (pBtnPause) pBtnPause->ShowWindow(SW_HIDE); //Full Video Screen GetWindowPlacement(&m_struOldPlacement); //Remove WS_SIZEBOX windows style. or not the window can't be full-creen. ModifyStyle(WS_SIZEBOX,0,0); CRect WindowRect, ClientRect; RECT m_FullScreenRect; //ReDraw the window. Get the correct edge value. GetWindowRect(&WindowRect); WindowRect.left+=1; WindowRect.right+=1; MoveWindow(CRect(0,0,352,288),TRUE); GetWindowRect(&WindowRect); GetClientRect(&ClientRect); ClientToScreen(&ClientRect); //get the dest window rect. int x = GetSystemMetrics(SM_CXSCREEN); int y = GetSystemMetrics(SM_CYSCREEN); m_FullScreenRect.left = WindowRect.left - ClientRect.left; m_FullScreenRect.top = WindowRect.top - ClientRect.top; m_FullScreenRect.right = WindowRect.right - ClientRect.right + x; m_FullScreenRect.bottom = WindowRect.bottom - ClientRect.bottom + y; // m_FullScreenRect.left = 0; // m_FullScreenRect.top = 0; // m_FullScreenRect.right = GetSystemMetrics(SM_CXSCREEN); // m_FullScreenRect.bottom = GetSystemMetrics(SM_CYSCREEN); //Move the main window to the dest rect. WINDOWPLACEMENT wndpl; wndpl.length = sizeof(WINDOWPLACEMENT); wndpl.flags = 0; wndpl.showCmd = SW_SHOWNORMAL; wndpl.rcNormalPosition = m_FullScreenRect; SetWindowPlacement(&wndpl); //Move the view winow to full-screen. RECT rc; GetClientRect(&rc); m_pPopView->MoveWindow(&rc,TRUE); // m_bFullScreen = true; } else //Restore normal screen { //Show OK Button CRect btnRect; CButton *pBtnOK = (CButton *)GetDlgItem(IDOK); if (pBtnOK) { pBtnOK->ShowWindow(SW_SHOW); pBtnOK->GetClientRect(&btnRect); } CEdit *pEdit = (CEdit*)GetDlgItem(IDC_TIMEOUT); if (pEdit) pEdit->ShowWindow(SW_SHOW); CButton *pBtnPause = (CButton*)GetDlgItem(IDC_PAUSE_ALARM); if (pBtnPause) pBtnPause->ShowWindow(SW_SHOW); //Restore old position ModifyStyle(0,WS_SIZEBOX,0); SetWindowPlacement(&m_struOldPlacement); RECT rc; GetClientRect(&rc); rc.bottom -= (btnRect.Height()+3); m_pPopView->MoveWindow(&rc,TRUE); //SetWindowSize(); // m_bFullScreen = false; } }
void CRoom::draw() { POSITION pos; CButton* Button; CStatic* staticText; CString btnText[2]; CDevice* tmpDevice; int top = 10; int bottom = 30; int i = 0; int countButtonID = 3001; int countStaticID = 2001; CObList* list = phandleData->get_deviceList(); for (pos = list->GetHeadPosition(); pos != NULL;) { tmpDevice = (CDevice*)list->GetNext(pos); if(tmpDevice->get_room() != room) continue; if(tmpDevice->get_typ() == _T("fs20rsu")) { btnText[0] = _T("Auf"); btnText[1] = _T("Ab"); } else { btnText[0] = _T("An"); btnText[1] = _T("Aus"); } staticText = new CStatic(); DWORD dwStyleStatic = WS_EX_STATICEDGE; staticText->Create(tmpDevice->get_name(),dwStyleStatic,CRect(10,top,260,bottom),this,countStaticID); staticText->ShowWindow(TRUE); Button = new CButton(); DWORD dwStyle = WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON; Button->Create(btnText[0], dwStyle, CRect(300,top,340,bottom), this, countButtonID); Button->ShowWindow(TRUE); Button = NULL; buttonIDs[i][i] = countButtonID; countButtonID++; Button = new CButton(); Button->Create(btnText[1], dwStyle, CRect(360,top,400,bottom), this, countButtonID); Button->ShowWindow(TRUE); Button = NULL; buttonIDs[i][i+1] = countButtonID; countButtonID++; Button = new CButton(); Button->Create(_T("Details"), dwStyle, CRect(420,top,480,bottom), this, countButtonID); Button->ShowWindow(TRUE); Button = NULL; buttonIDs[i][i+2] = countButtonID; top += 30; bottom += 30; staticText = NULL; countButtonID++; countStaticID++; i++; } }