The GetWindowText function copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied.

解决方案 »

  1.   

    使用API:
    GetWindowText参数如下
    int GetWindowText(    HWND hWnd, // 控件的句柄
        LPTSTR lpString, // 缓冲区指针
        int nMaxCount  // 需要的文字最大长度
     
          );
    返回值为获取的长度
    文字长度可以使用如下API获取:
    int GetWindowTextLength(    HWND hWnd  // handle of window or control with text
       );
    返回值为文字长度.
    例如这样就把szText复制为控件的文字.
    GetWindowText( 
    controlhWnd
    ,szText
    ,GetWindowTextLength( controlhWnd)
    );