void CTemTestDlg::tmtest(void)
{
//while(1)
{

unsigned char a,b,zhengshu,xiaoshu,xiaoshu1,xiaoshu2; 
CString str;
static BOOL isFirst=true;
tmreset();             //复位 
Delay_us(120);
tmwbyte(0xcc);         //跳过序列号命令   
tmwbyte(0x44);         //发转换命令 44H,
Delay_us(5);
tmreset ();      //复位 
Delay_us(200);
tmwbyte (0xcc);  //跳过序列号命令   
tmwbyte (0xbe);  //发送读取命令
a = tmrbyte ();  //读取低位温度    
b= tmrbyte ();  //读取高位温度           
zhengshu = a/16+b*16;      //整数部分
xiaoshu1 = (a&0x0f)*10/16;    //小数第一位
xiaoshu2 = (b&0x0f)*100/16%10;//小数第二位
xiaoshu=xiaoshu1*10+xiaoshu2; //小数两位
zh(zhengshu,xiaoshu);
//printf("%s\n",tmvalue);
str=tmvalue;
str+="℃";
//在文本框显示温度值
//CEdit *but;
//but =(CEdit *)GetDlgItem(IDC_EDIT2);
//but->SetDlgItemTextW;
if(!isFirst)//跳过第一次取值
SendMessageW(IDC_EDIT2,str);
else
isFirst=false;
//Sleep(500);
}
}出现错误error C2660: 'SetDlgItemTextW' : function does not take 2 parameters怎么改啊?

解决方案 »

  1.   

    SendMessageW(IDC_EDIT2,str); 
    -----------
    ???
      

  2.   

    程序中的SendMessageW(IDC_EDIT2,str); 打错了 应该是SetDlgItemTextW(IDC_EDIT2,str);
      

  3.   

    SetDlgItemTextW(HWND hDlg,int nIDDlgItem,LPCWSTR lpString)//人家本来就待三个参数,你写两个肯定有问题呗,
    SetDlgItemText(HWND hDlg,LPCWSTR lpString);//是想用这个函数吧,注意少一个 w 啊。
      

  4.   

    void SetDlgItemText( int nID, LPCTSTR lpszString );擦,写错了,这个才是原型。
      

  5.   

    SetDlgItemTextW()用于宽字符.一般情况下用SetDlgItemText()就够了.