CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2000
    Posts
    44

    Get/SetProfileString

    I'm trying to write a program using Microsofts Embedded visual tools for Windows CE. This program needs to use a .ini file to load preferences. GetPrivateProfile... and SetPrivateProfile.... functions are not available. I am trying to use CWinApp and setting the m_pszProfileName. But, I do not know what to set this to. Is it just the .ini file name or can it include the path name too? Does the .ini file have to be in the same directory as the executable (or the pwd)? My code looks something like this:

    CWinApp *App = AfxGetApp();

    LPCTSTR IniFilename = _T("default.ini");

    free((void*)App->m_pszProfileName);

    App->m_pszProfileName = _tcsdup(IniFilename);

    LPCTSTR MyString= App->GetProfileString(_T("SECTION"),_T("VALUE") );









    Is it possible that I set up the .ini file wrong? I'm very confused. Any help would be greatly appreciated.



  2. #2
    Join Date
    Nov 1999
    Location
    Austria
    Posts
    56

    Re: Get/SetProfileString



    Pfad = SystemPfad+"\\WINLEASE.INI";
    if (WinLeaseIniFile.Open(Pfad,CStdioFile::modeRead))
    if (GetProfileString("System","DatenPfad","0") != "0")
    WinLeasePfad =GetProfileString("System","DatenPfad","0");
    else
    WriteProfileString("System","DatenPfad",WinLeasePfad);

    RadioPerioden = GetProfileInt("Leasingrechner","Perioden",3);
    Modus = GetProfileInt("Leasingrechner","Modus",0);
    ProzentVon = GetProfileInt("Leasingrechner","ProzentVon",1);
    SplittZins = GetProfileInt("Leasingrechner","SplittZins",0);

    That from one Project of mine to read and write to an ini
    hope it helps



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured