Computing.Net > Forums > Programming > WriteProfileString not working in V

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

WriteProfileString not working in V

Reply to Message Icon

Name: finleh
Date: March 4, 2009 at 22:54:26 Pacific
OS: Windows Vista
Subcategory: C/C++
Comment:

Hi,

anyone knows how Vista is handling the WriteProfileString call? The MSDN help says the string is written to the registry OR to the .INI file, but does not mention how the selection is made. Running in XP and using VC++ 6.0, I get the string in myappl.INI, but when moving to Vista and VS 2008, I can find no trace of what WriteProfileString might have done, nothing in the registry and nothing in any *.INI file. Is this function working in Vista at all?



Sponsored Link
Ads by Google

Response Number 1
Name: lucas999
Date: March 5, 2009 at 09:52:46 Pacific
Reply:

You can ask on
Professional Win32 api Group
for source code of any Win32 api... (C)


0

Response Number 2
Name: Razor2.3
Date: March 5, 2009 at 15:33:24 Pacific
Reply:

I ran the following chunk of code on Win7 x64, and it behaves exactly as one would expect. Namely, the write fails if you're not an Administrator, or if UAC is turned on. Otherwise, the text is written to win.ini.

#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <tchar.h>
#include <iostream>

int _tmain(int argc, _TCHAR* argv[]) {
	char c[256];
	GetProfileStringA("Test1", "Test2", 0, c, 256);
	std::cout << c << std::endl;
	int r = WriteProfileStringA("Test1","Test2","Test3");
	std::cout << "Write " << (r ? "Okay" : "Failed") << std::endl;
	return r;
}


0

Response Number 3
Name: finleh
Date: March 5, 2009 at 23:58:49 Pacific
Reply:

Interesting test, but why is the text not put in the registry, as MSDN documentation suggests?. In my case, the XP version does not write to win.INI but to Winnct.INI, Winnct being the name of my application. In Vista I run as administrator, but still nothing seems to work. If I move the exe file from XP to Vista, it works ok, and the Winnct.ini is then stored in C:\Users\lmflho\AppData\Local\VirtualStore\Windows\
To me, this looks as if Visual Studio 2008 is somehow different to VC++ 6.0 in handling WriteProfileString.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Find all the file from a ... create a batch file



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: WriteProfileString not working in V

FC command does NOT work in a batch www.computing.net/answers/programming/fc-command-does-not-work-in-a-batch/17859.html

exe file not working www.computing.net/answers/programming/exe-file-not-working-/18453.html

Java not working in D drive www.computing.net/answers/programming/java-not-working-in-d-drive/6193.html