问题描述
我有一个使用ini文件的程序.该文件应位于C:/Windows中-因此我将GetPrivateProfileString api函数的最后一个参数设置为"myfile.ini"(没有完整路径,因为:初始化文件的名称.如果此参数不包含完整文件,文件的路径,系统将在Windows目录中搜索文件.
但是我有一个问题,因为功能有时会从主窗口读取,有时会从VirtualStore读取.我认为这取决于我如何运行应用程序(是否以管理员身份)-但我不确定.
我想在Windows目录中包含此ini文件,并使它每次都能工作(在Windows Vista和7上)-有可能吗?还是我必须将该ini文件保存在其他地方?
感谢您的帮助,
I have a program which use ini file. That file should be in C:/Windows - so I use GetPrivateProfileString api function with last parameter set to ''myfile.ini'' (without full path because: "The name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory. "
But I have a problem, because function sometimes reads from main Window, sometimes from VirtualStore.. I think it depends on how I run application (as admin or not) - but I''m not sure.
I want to have this ini file in Windows dir and makes it works every time (on Windows Vista and 7) - is it possible? Or I have to save that ini file somewhere else ?
Thanks for your help,
推荐答案
这篇关于如何确定程序是否以管理员身份启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!