MFC的结构体定义中字符串可以使用CString类型;
struct MyStruct {int x;int y;CString str;
};
......
void CTttView::OnDraw(CDC* pDC)
{CTttDoc* pDoc = GetDocument();ASSERT_VALID(pDoc);// TODO: add draw code for native data hereCString str1;MyStruct m_myStruct;m_myStruct.x = 101;m_myStruct.y = 202;m_myStruct.str = _T("Hello World");str1.Format("%d, %d, %s", m_myStruct.x, m_myStruct.y, m_myStruct.str);pDC->TextOut(50, 50, str1);
}