WEB开发网
开发学院手机开发Windows Mobile 开发 在Windows mobile 5.0下操作INI文件 阅读

在Windows mobile 5.0下操作INI文件

 2010-08-22 12:58:00 来源:WEB开发网   
核心提示:");LPTSTR lpCombine = strCombine.GetBuffer(0);iniFile.SetLength(0);iniFile.SeekToBegin();iniFile.Write(lpCombine, strCombine.GetLength() * 2);iniFile.Close
");

LPTSTR lpCombine = strCombine.GetBuffer(0);

iniFile.SetLength(0);

iniFile.SeekToBegin();

iniFile.Write(lpCombine, strCombine.GetLength() * 2);

iniFile.Close();

return TRUE;

}

else

{

iIndex3 = strCombine.Find(L" ", iIndex2 + 1);

if(iIndex3 == -1)

{

iniFile.Close();

return FLASE;

}

iIndexT = iIndex2 + 1 + strEntry.GetLength();

strCombine.Delete(iIndexT, iIndex3 - iIndexT);

strCombine.Insert(iIndexT, strValue);

LPTSTR lpCombine = strCombine.GetBuffer(0);

iniFile.SetLength(0);

iniFile.SeekToBegin();

iniFile.Write(lpCombine, strCombine.GetLength() * 2);

iniFile.Close();

return TRUE;

}

iniFile.Close();

return FLASE;

}

3。替换INI值

BOOL ReplaceInIVal(LPCTSTR lpFolderName,LPCTSTR lpKey,LPCTSTR lpValue)

{

if(lpFolderName==NULL||lpFolderName == NULL || lpFolderName == NULL)

{

return HT_ERROR;

}

CFile iniFile;

CString strCombine;

if(!iniFile.Open(L"ini文件所在路", CFile::modeReadWrite|CFile::modeCreate|CFile::modeNoTruncate))

{

return FALSE;

}

DWORD dwFilesize = iniFile.GetLength() / 2 + 1;

WCHAR *pBuf;

try

{

pBuf = new WCHAR[dwFilesize];

}

catch(...)

{

iniFile.Close();

return FALSE;

}

if(iniFile.Read(pBuf, iniFile.GetLength()) != iniFile.GetLength())

{

delete[] pBuf;

iniFile.Close();

return FALSE;

}

pBuf[iniFile.GetLength() / 2] = NULL;

strCombine.GetBuffer(MAX_LEN);

上一页  1 2 3 4 5 6  下一页

Tags:Windows mobile 操作

编辑录入:coldstar [复制链接] [打 印]
赞助商链接