im tring to get my program to load when windows starts up. i read that putting a section, a run key and my file name that i want loaded into the win.ini file that my program would run at startup. the problem is that i can create an ini file and write to all ini files so far that ive tried except the win.ini file. when i try to write to it all i get is a change in the registry an i only noticed that when i had ntregmon on. i looked at the win.ini file and nothing new was written to it. any suggestion?
smurf
Since you mentioned ntregmon, I am assuming Windows NT
is the OS you are running. Therefore:
From the API reference for WriteProfileString\WritePrivateProfileString:
Windows NT
Windows NT maps most .INI file references to the registry,
using the mapping defined under the following registry key:
HKEY_LOCAL_MACHINE\Software\Microsoft\
Windows NT\CurrentVersion\IniFileMapping
When the operation has been mapped, the WriteProfileString
function writes information to the registry, not to the
initialization file; the change in the storage location
has no effect on the function's behavior.
From the API reference for GetProfileString\GetPrivateProfileString:
Windows NT: Calls to profile functions may be mapped to the
registry instead of to the initialization files. This mapping
occurs when the initialization file and section are specified
in the registry under the following keys:
HKEY_LOCAL_MACHINE\Software\Microsoft\
Windows NT\CurrentVersion\IniFileMapping
When the operation has been mapped, the GetProfileString
function retrieves information from the registry, not
from the initialization file; the change in the storage
location has no effect on the function's behavior.
[\code]
it's better to use the /run registry keys
e.g.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run