如果是SendMessage发送的CString CString s = "xxxxxx";SendMessage(hWnd,WM_XXXX,NULL,(LPARAM)&s); 消息处理函数:CString s = *((CString*)lParam); 如果使用PostMessage发送:CString* ps = new CString("xxxxxx");PostMessage(hWnd,WM_XXXX,NULL,(LPARAM)ps); 消息接收:
(1) char*转换成CString 若将char*转换成CString,除了直接赋值外,还可使用CString::Format进行.例如: char chArray[] = "This is a test"; char * p = "This is a test"; 或 LPSTR p = "This is a test"; 或在已定义Unicode应的用程序中 TCHAR * p = _T("This is a test"
1.format 可以帮助各种类型转换成CString. a. int 转 CString CString str; int number = 4; str.Format(_T("%d"),number); b. double 转 CString CString str; double num = 1.46; str.Format(_T("%lf"),num); c. 将十进制转为八进制 CString str; int num = 255; str.Format
1.char*转换成CString 若将char*转换成CString,除了直接赋值外,还可使用CString::format进行.例如: char chArray[] = "This is a test"; char * p = "This is a test"; 或 LPSTR p = "This is a test"; 或在已定义Unicode应的用程序中 TCHAR * p = _T("This is a test")