在Win2K怎样让WriteProfileString写的字符不存于注册表,而在.INI在MSDN规定:
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, the value is stored in a cached version of WIN.INI. 在Win的各种版本中如何控制呢?
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, the value is stored in a cached version of WIN.INI. 在Win的各种版本中如何控制呢?
用WritePrivateProfileString函数最后的一个参数指定文件名!
WriteProfileString()用来写注册表;
WritePrivateProfileString()用来写INI文件。
LPCTSTR lpAppName, // section name
LPCTSTR lpKeyName, // key name
LPCTSTR lpString, // string to add
LPCTSTR lpFileName // initialization file
);《摘自MSDN》
SetRegistryKey(_T("your company name"));
它的作用是告诉程序WriteProfileString()/GetProfileString(),WriteProfileInt()/GetProfileInt()的究竟在注册表还是ini文件里操作。如果有这行代码,它们就在注册表里\\hkey_current_user\software\your company name\下操作,如果把这行代码去掉,则程序在系统目录下生成同名的ini文件,并在这里操作。