2012年10月12日 星期五

VC++ - char[]轉CString

CString m_bKeyName;
char key_file[256]

/* copy from char[] to CString */
m_bKeyName = key_file;

Reference:
http://www.programmer-club.com.tw/ShowSameTitleN/vc/14293.html

MFC - Checkbox

/* IDC_CHECK_1: check box's ID */
CButton* bCheck1Obj=(CButton*)GetDlgItem(IDC_CHECK_1);

if(bCheck1Obj->GetCheck() == BST_CHECKED)
{
          /* current state is checked. */
}
else if(bCheck1Obj->GetCheck() == BST_UNCHECKED)
{
         /* current state is un-checked. */
}
else
{

}

/* 改變checkbox的state, 用SetCheck() */
bCheck1Obj->用SetCheck(BST_CHECKED); /* 選取checkbox */


bCheck1Obj->用SetCheck(BST_UNCHECKED); /* 選取checkbox */

Reference:
[1] http://mqjing.blogspot.tw/2007/04/mfc-checkbox.html
[2] http://msdn.microsoft.com/en-us/library/31deb72x(v=vs.80).aspx