比如有一个确定按钮,,怎么取“确定“两个字

解决方案 »

  1.   

    是API函数
    GetWindowText,看msdn吧。
      

  2.   

    CString str;
    GetDlgItem(控件ID)->GetWindowText(&str);
      

  3.   

    错了,是:
    CString str;
    GetDlgItem(控件ID)->GetWindowText(str);
      

  4.   

    找到那个窗口的句柄hwnd
    然后GetWindowText(
      HWND hWnd,        // handle to window or control
      LPTSTR lpString,  // text buffer
      int nMaxCount     // maximum number of characters to copy
    );
    就可以了
      

  5.   

    同意leeajax(教我学VC) ( ) 的解决办法,先获得按钮的句柄,在调GetWIndowText();
      

  6.   

    #define IDC_BUTTON 40000//按钮的ID
    ...........
    CButton *pbutton;
    CString buttonstring;
    pbutton = (CButton *)GetDlgItem(IDC_BUTTON);
    pbutton->GetWindowText(buttonstring);//