易发生错误一:
sscanf(buf, text(“%d”), var); //遗忘”&”
sscanf(buf, text(“%d”), &var);
易发生错误二:
template<class t> class mytem操作时,如果在头文件中仅仅声明class myclass,那么如下操作导致:
mytem<myclass> m_mytem;
可能出错。已遇上的错误:myclass中使用virtualalloc分配内存时,sizeof(myclass)的值不确定,导致分配内存失败。
关于combobox的使用:
combobox有dropdown和droplist两种type,对于droplist来说,onselchange()中使用updatedata()可以获得用户选择的项,而对于dropdown来说,onselchange()中必须先使用m_ctrlcombo.setsel(m_ctrlcombo.getsel()),然后使用updatedata()才可以获取用户选择的项。
要善于使用she处理问题,如记录文件读取:
file* pfile = fopen(strfilename, “r”);
do
{
__try
{
fgets(czbuf, linenum, pfile);
//do your things here…
}
__except(exception_execute_handler)
{
//continue or break?
}
}while(!feof(pfile));
fclose(pfile);