随即
strlen,printf使用的时候字符串必须保证是以“/0”为结尾的,否则结果不可预料
直接使用char*以“/0”为结尾的变量会不安全;
typedef struct _UNICODE_STRING
{
USHORT Lenghth; 字符串长度
USHORT MaxmemLenght; 缓冲区长度
PWSTR Buffer; 缓冲区
}
sprntf,swprintf 格式化后的字符串都是以‘/0’为结尾的,可以使用strlen或wcslen计算字符串长度
分配缓冲区而不分配固定大小的内存 char buf[],
unicode ansc字符存储转换
char* mul=new char[wcslen(wid)+1];
void CNewDlg::WtoM(TCHAR* wid,char* &Mul)
{
int byte=WideCharToMultiByte(CP_OEMCP,NULL,wid,wcslen(wid)+1,NULL,0,NULL,FALSE);
WideCharToMultiByte(CP_OEMCP,NULL,wid,wcslen(wid)+1,Mul,byte+1,NULL,FALSE);
}
AFX_MANAGE_STATE(AfxGetStaticModuleState( )) 对dll文件调用资源
弹出式菜单
CMenu menupop;
CString str;
if(menupop.CreatePopupMenu())
{
POINT m_point;
GetCursorPos(&m_point);
str="在线查阅";
menupop.AppendMenuW(MF_STRING,ID_ONLINE,str);
str="添加为信任";
menupop.AppendMenuW(MF_STRING,ID_TRUST,str);
str="卸载模块";
menupop.AppendMenuW(MF_STRING,ID_UNLOAD,str);
str="进行数字签名认证";
menupop.AppendMenuW(MF_STRING,ID_CHECK_SIGN,str);
menupop.TrackPopupMenu(TPM_LEFTALIGN,m_point.x,m_point.y,this);
}
posted on 2012-07-26 17:50 fanhongyue 阅读(240) 评论(0) 编辑 收藏 举报