// 1 、WPARAM 转为 int
WPARAM wParam;
int nMatchRow = (int)lParam;
// 2、 CString 转为 WPARAM
WPARAM wParam = (WPARAM)str.AllocSysString()
//3、WPARAM 转为 CString
WPARAM wParam,
BSTR b = (BSTR)wParam;
CString cs(b);
//4、CString 转为int
CString str = _T("123");
int i = _ttoi(str);
// 5、CString 转为 cstring
cstring cs1;
CString CS = L"xxk";
cs1 = CW2A(CS);
//6、 CString 转为double
CString str = _T("123.321");
double d = atof(str.GetBuffer());
double d2 = _wtof(str).GetBuffer();
//7、其他专为CString
int a = 1;
double f = 1.2;
char[20] = "Ma_Hong_Kai"
CString cs;
cs.Format(_T("%d,%0.1f,%s"),a,f,ch);
CString 的转换为int、double 、WParam、
最新推荐文章于 2024-06-06 14:32:26 发布
本文详细介绍了在Windows编程中常见的类型转换操作,包括WPARAM转换为int,CString与WPARAM、BSTR之间的转换,以及将CString转换为int和double。还展示了使用CString进行格式化输出的方法,涵盖了基本数据类型的转换和字符串处理技巧。
摘要由CSDN通过智能技术生成