CString m_Send=L"12345678909876543210";

    char *stops, s[3];
    unsigned char  d[10];     
    for (size_t i = 0; i < 10; i++)
    {
        s[0] = m_Send.GetAt(i * 2);
        s[1] = m_Send.GetAt(i * 2 + 1);
        s[2] = 0x0;
        d[i] = (unsigned char)strtoul(s, &stops, 16);
    }

输出结果为d[0]=0x12,d[1]=0x34,.......

适用于需要将CString类型转为十六进制时的一种方法