ini文本文件

 贴几段代码:

 

    //获取当前路径

    HINSTANCE   hInst;   
    CString ls_Name; 
    ls_Name=AfxGetApp()->m_pszAppName;//获得应用程序的文件名 
    hInst=GetModuleHandle(ls_Name);//获得应用程序的句柄 
    char szBuf[256]; 
    char * p; 
    GetModuleFileName(hInst,szBuf,sizeof(szBuf));//获得应用程序所在的目录 
    p=szBuf; 
    while(strchr(p,'//'))   
    {    p=strchr(p,'//');         
         p++;     
    } 
    *p='/0';     
    gszAppPath=(CString)szBuf;

 

...

 

    //ini文本文件,不存在该文件就新建。若存在不允许覆盖
    CString mTempStr;
    mTempStr=gszAppPath+"param.ini";
    CFileException ex;
    CFile mFile;
    if (!(mFile.Open(mTempStr, CFile::modeCreate|CFile::modeNoTruncate,&ex)))
    {
        //MessageBox("没有被创建");
        TCHAR szError[1024];
        ex.GetErrorMessage(szError, 1024);
        MessageBox(szError);
    }
    else
    {
        //MessageBox("已经存在");
        mFile.Close();
    }

...

 

    //写入参数设置
    CString strTemp,strTemp1;
    strTemp=gszAppPath+"param.ini";
    strTemp1.Format("%d",m_AutoID);
    ::WritePrivateProfileString("ParamInfo","流水号",strTemp1,strTemp);

    ::WritePrivateProfileString("ParamInfo","卡号",m_CardNo,strTemp);

    strTemp1.Format("%d",m_GunNo);
    ::WritePrivateProfileString("ParamInfo","枪号",strTemp1,strTemp);
    strTemp1.Format("%d",m_GunNo1);
    ::WritePrivateProfileString("ParamInfo","枪编号第一字节",strTemp1,strTemp);
    strTemp1.Format("%d",m_GunNo2);
    ::WritePrivateProfileString("ParamInfo","枪编号第二字节",strTemp1,strTemp);
    strTemp1.Format("%d",m_GunNo3);
    ::WritePrivateProfileString("ParamInfo","枪编号第三字节",strTemp1,strTemp);

...

 

        //加载参数设置
        m_AutoID=::GetPrivateProfileInt("ParamInfo","流水号",0,mTempStr);

        ::GetPrivateProfileString("ParamInfo","卡号","",
                       m_CardNo.GetBuffer(100),100,mTempStr);
        m_CardNo.ReleaseBuffer();

        m_GunNo=::GetPrivateProfileInt("ParamInfo","枪号",0,mTempStr);
        m_GunNo1=::GetPrivateProfileInt("ParamInfo","枪编号第一字节",0,mTempStr);
        m_GunNo2=::GetPrivateProfileInt("ParamInfo","枪编号第二字节",0,mTempStr);
        m_GunNo3=::GetPrivateProfileInt("ParamInfo","枪编号第三字节",0,mTempStr);

        UpdateData(FALSE);

...

 

奇怪小问题,添加的类在类视图里不显示

5 楼zhdleo(叮东)回复于 2003-04-11 22:14:01 得分 20

不用那么烦!  
   
  就删调   *.ncb,   *.clw后,  
   
  重新打开工程,再打开向导,这时候会提问你恢复破坏的文件.  
   
  什么也不管,也不选,一路NEXT,就行了.


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值