1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
BOOL CTestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
m_cCombo.AddString("Item 1");
m_cCombo.AddString("Item 2");
m_cCombo.AddString("Item 3");
m_cCombo.AddString("Item 4");
m_cCombo.AddString("Item 5");
m_cCombo.AddString("Item 6");
int Idx = m_cCombo.SelectString(-1, "Item 3");
Idx = m_cCombo.GetCurSel();
CString buf;
buf.Format("Index : %d", Idx);
MessageBox(buf);
return TRUE; // return TRUE unless you set the focus to a control
}
...
void CTestDlg::OnButton1()
{
int Idx = m_cCombo.GetCurSel();
CString buf;
buf.Format("Index : %d", Idx);
MessageBox(buf);
} |
Partager