MFC vc++ 一些 API 的使用

来源:互联网 发布:知乎 瘦身塑型 编辑:程序博客网 时间:2024/06/07 15:48

MessageBox

 

CString str;

str.Format((L"result is %d"),bb);
 ::MessageBox(NULL,str,0,0);

 

Cstring

Cstring str;

str.Left(4) == "COM6"

str.Mid();
CString   Mid(   int   nFirst,   int   nCount   )   const;
nCount指明你要多少位。

//格式转换

TCHAR DeviceName[64];
COMMTIMEOUTS CommTimeOuts; 
wsprintf(DeviceName,L"COM%d:",port);

CString   ff= "123 "; 
int   i=atoi(ff.GetBuffer(10));

//c++
int num;
char cNum[32];
sprintf(cNum, "%d", num );

//获取长度
byte * Data;
int Length = sizeof(Data);

//宽字付定义
WCHAR key[8];
wcscpy(key, L"0000");

 

原创粉丝点击