效果:
在IDC_EDIT_HTTP_INPUT 输入http请求
在IDC_EDIT_HTTP_OUTPUT 反馈返回数据json格式的
void CTG_HelperDlg::OnBnClickedButtonSubmit()
{
CString str;
GetDlgItem(IDC_EDIT_HTTP_INPUT)->GetWindowText(str);
AppendToOutput(str);
CString rsp = L"";
CString post_data = L"";
ExecuteRequest(
L"GET",
str,
post_data,
rsp
);
TRACE("rsp:%s",rsp);
}
void CTG_HelperDlg::AppendToOutput(CString str)
{
str = _T("\r\n") + str;
CEdit* http_output_editbox = (CEdit*)GetDlgItem(IDC_EDIT_HTTP_OUTPUT);
//在末尾添加内容
int nCount = 0;
int nLastLineStart = 0;
int nLastLineEnd = 0;
nCount = http_output_editbox->GetLineCount(); //获取行数,包括回车行
//MessageBox(nCount);
nLastLineStart = http_output_editbox->LineIndex( nCount - 1 ); //获取字符数,许可多行
nLastLineEnd