how to use WriteProfileString and GetProfileString MFC functions???
-
Can someone tell me how to use WriteProfileString and GetProfileString mFC functions???? this is my CODE... it executes....But Data not getting WRITTEN to INI file.... why????????? code: void CFileApp::OnView() { free((void*)m_pszProfileName); m_pszProfileName=_strdup(_T("C:\\MyFile.ini")); WriteProfileString("1", "Name", "MATHEW"); }
-
Can someone tell me how to use WriteProfileString and GetProfileString mFC functions???? this is my CODE... it executes....But Data not getting WRITTEN to INI file.... why????????? code: void CFileApp::OnView() { free((void*)m_pszProfileName); m_pszProfileName=_strdup(_T("C:\\MyFile.ini")); WriteProfileString("1", "Name", "MATHEW"); }
-
Can someone tell me how to use WriteProfileString and GetProfileString mFC functions???? this is my CODE... it executes....But Data not getting WRITTEN to INI file.... why????????? code: void CFileApp::OnView() { free((void*)m_pszProfileName); m_pszProfileName=_strdup(_T("C:\\MyFile.ini")); WriteProfileString("1", "Name", "MATHEW"); }
anna mathew wrote:
WriteProfileString
As I told to you many, many, many, many, many times,
WriteProfileString
writes to the registry (from this [^] MSDN page)Remarks The entries are stored as follows: * In Windows NT, the value is stored to a registry key. * In Windows 3.x, the value is stored in the WIN.INI file. * In Windows 95/98, the value is stored in a cached version of WIN.INI.
Use
Win32 API
'sWritePrivateProfileString
instead. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
anna mathew wrote:
WriteProfileString
As I told to you many, many, many, many, many times,
WriteProfileString
writes to the registry (from this [^] MSDN page)Remarks The entries are stored as follows: * In Windows NT, the value is stored to a registry key. * In Windows 3.x, the value is stored in the WIN.INI file. * In Windows 95/98, the value is stored in a cached version of WIN.INI.
Use
Win32 API
'sWritePrivateProfileString
instead. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Ya,... now i know.... thanks...
-
anna mathew wrote:
WriteProfileString
As I told to you many, many, many, many, many times,
WriteProfileString
writes to the registry (from this [^] MSDN page)Remarks The entries are stored as follows: * In Windows NT, the value is stored to a registry key. * In Windows 3.x, the value is stored in the WIN.INI file. * In Windows 95/98, the value is stored in a cached version of WIN.INI.
Use
Win32 API
'sWritePrivateProfileString
instead. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]how can i prevent overwriting to INI file....?? I mean Is There Any WAY TO CHECK IF THE SECTION NAME... [section name] already exists???
-
how can i prevent overwriting to INI file....?? I mean Is There Any WAY TO CHECK IF THE SECTION NAME... [section name] already exists???
Yes, there is
GetPrivateProfileSectionNames
[^]. BTW: Be aware, you're just a step aside the feared RTFM. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
anna mathew wrote:
WriteProfileString
As I told to you many, many, many, many, many times,
WriteProfileString
writes to the registry (from this [^] MSDN page)Remarks The entries are stored as follows: * In Windows NT, the value is stored to a registry key. * In Windows 3.x, the value is stored in the WIN.INI file. * In Windows 95/98, the value is stored in a cached version of WIN.INI.
Use
Win32 API
'sWritePrivateProfileString
instead. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Hi, maybe this is not so simple after all. The MSDN page says that WriteProfileString will write to the application's registry OR .INI file. In my case, when I compile in XP using VisualC++ 6.0 the string is written to C:/WINDOWS/myappl.INI. I can find nothing in the registry. Transferring the project to Vista and using visual Studio 2008, my application does not come up with a remembered string, the default is used instead. Nothing is found in the registry and I have found no myappl.INI file after running the appl a few times with a valid string.
-
Hi, maybe this is not so simple after all. The MSDN page says that WriteProfileString will write to the application's registry OR .INI file. In my case, when I compile in XP using VisualC++ 6.0 the string is written to C:/WINDOWS/myappl.INI. I can find nothing in the registry. Transferring the project to Vista and using visual Studio 2008, my application does not come up with a remembered string, the default is used instead. Nothing is found in the registry and I have found no myappl.INI file after running the appl a few times with a valid string.
In fact what the OP needs could be simply accomplished using
WritePrivateProfileString
. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
In fact what the OP needs could be simply accomplished using
WritePrivateProfileString
. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Hi, yes, I noticed that in the discussion, but I am first trying to understand where the WriteProfileString is actually writing things. The MSDN text is saying this OR that, but not much about what is steering where things go. As I understand it, you should call CWinApp::SetRegistryKey if you want to have things in the registry "Causes application settings to be stored in the registry instead of INI files". I get further confused when the application is not working either way in Vista, no registry and no INI file.