strCOLOR.ReleaseBuffer();
if(!strCOLOR.IsEmpty())
{
  CString temp= "0x" + strCOLOR.Mid(1,2);
  int red=atoi(temp);
  ...
}

解决方案 »

  1.   

    TO saucer(思归):不行,还是CString temp= "0x" + strCOLOR.Mid(1,2);出错!
      

  2.   

    TO otuotu(呕吐呕吐):这怎么可能,编译都通不过。
      

  3.   

    先把是哪里出问题搞清楚,注意
    if(!strCOLOR.IsEmpty())
    里有个!先试一下CString strCOLOR="#FF1122";
    if(!strCOLOR.IsEmpty())
    {
      CString temp= strCOLOR.Mid(1,2);
      int red=strtoul(temp,NULL,16);  int green=strtoul(strCOLOR.Mid(3,2),NULL,16);
    int blue=strtoul(strCOLOR.Mid(5,2),NULL,16);}
      

  4.   

    我调试过了,是strCOLOR.Mid(1,2);出错,不知道为什么,难道他读到FF就转换成字符了??
      

  5.   

    是if(!strCOLOR.IsEmpty())
    还是if(strCOLOR.IsEmpty())