1
2 CString Fullstring, Appname, Fileext;
3 Fullstring.LoadString(IDR_MAINFRAME);
4 //获取完整的分割串
5 AfxExtractSubString(Appname, Fullstring, 0, '\n');
6 //析出第一个子串
7 AfxExtractSubString(Fileext, Fullstring, 4, '\n');
8 //析出第四个子串
CString 和COleDateTime之间的转换
CString str = "2004-07-08 11:22:33";
COleVariant VariantTime;
VariantTime = str;
VariantTime.ChangeType(VT_DATE);
COleDateTime DataTime = VariantTime;
STR)strHTML,strHTML.GetLength(),5 tmp,strHTML.GetLength()+1);
6 strHTML = tmp;
7 delete tmp;
8
_RecordsetPtr bInDateBase = m_pConn->Execute((_variant_t)strSQL , &index , 1);
if (!bInDateBase->adoEOF) //有数据
{
}
1 _variant_t var;
2 var= m_pRecordset->GetCollect("posInfo"); //可能为空
3 if(var.vt != VT_NULL) //为NULL
4 strPosInfo = var;
5 else
6 strPosInfo = “”;
7
1 //将字符串数字传换成BCD码 -- 例如 "1234" -> 0x1234
2 void CGPS_Info_Redirect_CZDlg::CStringDataToBCDData(CString strData , BYTE* bBCD)
3 {
4 for (int i = 0 ; i < strData.GetLength() ; i++)
5 {
6 ASSERT(strData[i] >= '0' && strData[i] <='9');
7 if (i % 2 == 0) //1,3,5,7,9
8 {
9 bBCD[i/2] =(strData[i] - 0x30)<<4;//左移四位
10 }
11 else
12 {
13 bBCD[i/2] += (strData[i] - 0x30);
14 }
15 }
16 }
1 //将int类型copy到BYTE数组中
2 void CGPS_Info_Redirect_CZDlg::CopyIntToByte(BYTE* data , int iData)
3 {
4 WORD wHigh = HIWORD(iData);
5 WORD wLow = LOWORD(iData);
6 data[0] = HIBYTE(wHigh);
7 data[1] = LOBYTE(wHigh);
8 data[2] = HIBYTE(wLow);
9 data[3] = LOBYTE(wLow);
10 }
11
posted on 2009-08-28 17:08
李佳 阅读(242)
评论(0) 编辑 收藏 引用 所属分类:
奇技淫巧