출처 : http://blog.naver.com/PostView.nhn?blogId=jinsang83&logNo=80095233911
m_Busy.Create(_T("Busy"), WS_CHILD|WS_VISIBLE|BS_CHECKBOX|WS_TABSTOP|BS_NOTIFY,
CRect(300,2,355,22), this, Click_Busy);
m_Away.Create(_T("Away"), WS_CHILD|WS_VISIBLE|BS_CHECKBOX|WS_TABSTOP|BS_NOTIFY,
CRect(360,2,415,22), this, Click_Away);
m_Mute.Create(_T("Mute"), WS_CHILD|WS_VISIBLE|BS_CHECKBOX|WS_TABSTOP|BS_NOTIFY,
CRect(420,2,475,22), this, Click_Mute);
BS_CHECKBOX로 해야 내가 누를때마다 별도 처리가 가능하다 BS_AUTOCHECKBOX로 하면
내가 원하는 별도 처리가 불가능하다
자세한건 Win API 정보 200~201 페이지에 잘 써져있다...
그리구나서
메세지 맵에
ON_BN_CLICKED(Click_Busy, &CMainFrame::UserStateBusyCheckBox)
ON_BN_CLICKED(Click_Away, &CMainFrame::UserStateAwayCheckBox)
ON_BN_CLICKED(Click_Mute, &CMainFrame::UserStateMuteCheckBox)
추가 후
afx_msg void UserStateBusyCheckBox(void);
afx_msg void UserStateAwayCheckBox(void);
afx_msg void UserStateMuteCheckBox(void);
메서드 선언 후
로그인 했을때
if (m_main->m_ptrDoc.m_userInfo.m_settinglist.m_busy)
{
m_main->m_Busy.SetCheck(BST_CHECKED);
}
if (m_main->m_ptrDoc.m_userInfo.m_settinglist.m_away)
{
m_main->m_Away.SetCheck(BST_CHECKED);
}
if (m_main->m_ptrDoc.m_userInfo.m_settinglist.m_mute)
{
m_main->m_Mute.SetCheck(BST_CHECKED);
}
클릭했을 때
void CMainFrame::UserStateBusyCheckBox(void)
{
if (m_Busy.GetCheck() == BST_CHECKED)
{
m_Busy.SetCheck(BST_UNCHECKED);
ptr->State = Send_Here;
SendFerret();
}
else if (m_Busy.GetCheck() == BST_UNCHECKED)
{
m_Busy.SetCheck(BST_CHECKED);
ptr->State = Send_Busy;
SendFerret();
}
}
void CMainFrame::UserStateAwayCheckBox(void)
{
if (m_Away.GetCheck() == BST_CHECKED)
{
m_Away.SetCheck(BST_UNCHECKED);
ptr->State = Send_Here;
SendFerret();
}
else
{
m_Away.SetCheck(BST_CHECKED);
ptr->State = Send_Away;
SendFerret();
}
}
void CMainFrame::UserStateMuteCheckBox(void)
{
if (m_Mute.GetCheck() == BST_CHECKED)
m_Mute.SetCheck(BST_UNCHECKED);
else
m_Mute.SetCheck(BST_CHECKED);
ptr->State = Send_Mute;
SendFerret();
}
[출처] SDI에 체크 박스를 하자|작성자 바체