button 의 caption text 가져와서

button 에 표시되는 text를 toggle 시키는데 유용하게 사용 할 수 있다.

 

CButton m_bt; //해당 버튼 컨트롤러에 대한 멤버변수

CString str="";
m_bt.GetWindowText(str);

 

str에 해당 버튼의 현재 caption 을 가져온다.

 

사용예--------

해당 버튼의 OnBnClick 이벤트 처리 함수에서

 if(str=="Start") //thread 시작
 {
    m_bt.SetWindowTextA("Stop");
 }
 else     //thread 종료
 {
    m_bt.SetWindowTextA("Start");
 }

+ Recent posts