공룡호가 사는 세상 이야기

공부한 것들 이제 정리한다 -_-;;
열심히 살겠다고 약속했다. 살길은 공부 뿐..

#1
in Unix -> file scripter
command line : "script" , "exit" use;
(Unix에서 화면 갈무리 방법)

#2
키보드 포커스를 얻는 법.
해당 컨트롤러에 컨트롤 변수를 추가한 후,
Control_Variable.SetFocus(); 함수를 호출한다.
호출 시점은 해당 컨트롤러 생성 이후.

#3
CString chat;                                    //Initialize chat variable
m_InputChat_C.GetWindowText(chat); //Get Text for 'editbox'
m_ChatView.AddString(chat);            //Send the Text of 'Getted Text'

#4 (by snbosoft.com)
CDialog 에서 IDOK에 대한 디폴트 키로서, Return 키가 할당되어있다.
비슷하게 Esc도 같은 기능인데, 원하지 않는 시점에서 프로그램이 종료될 수 있다.

이는 PretranslateMessage() 에서 메세지를 후킹함으로서 간단히 해결된다.

BOOL CTestDlg::PreTranslateMessage(MSG* pMsg)
{
  if( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN )
    return TRUE;

  return CDialog::PreTranslateMessage(pMsg);
}

#5
CWnd *pWnd = CWnd::GetDlgItem(해당 컨트롤러ID); //get pointer of 'editbox'
pWnd->SetWindowText(_T("초기화할 문자열")); //Re-Initialize of 'editbox'

#6
버튼 활성화/비활성화 방법(MFC)
해당 버튼의 컨트롤 변수를 만든 다음,

Control_Variable.EnableWindow(진리값);

진리값이 TRUE일 경우 = 비활성화 버튼을 활성화로
        FALSE일 경우 = 활성화 버튼을 비활성화로

#7 (About Button activation)
BOOL EnableWindow(
  HWND hWnd,     // handle to window
  BOOL bEnable   // flag for enabling or disabling input
);

함수는 리턴값이

If the window was previously disabled, the return value is nonzero.
If the window was not previously disabled, the return value is zero. To get extended error information, callGetLastError.

이므로, 비활성화시, nonzero를 리턴한다.
즉, 이 함수를 이용하여 체크를 하면 그만이다. 다시 돌려놓으면 되니까..
다른 함수가 있을려나 -_-?

if((Control_Variable.EnableWindow(FALSE)))  //Running Server

else       //or, not
//to do
Control_Variable.EnableWindow(TRUE);

'프로그래밍' 카테고리의 다른 글

Anonymous Class  (0) 2006.08.08
MFC - CAsyncSocket CLASS  (0) 2006.08.06
WINSOCK ERROR  (0) 2006.07.19
CMemFile Class  (0) 2006.06.10
습관  (0) 2006.06.06