Recommended registry usage
In XP, we used to keep configuration parameters of our application in application specific registry keys under HKLM\Software. The application needs to read and write these values. With the new security model introduced in Vista and Windows 7, these applications won’t work in Vista and Windows 7, unless they are Run “As Administrator”. If the applications are run as normal users, registry writes from these ap开发者_Python百科plications will fail in Window Vista and Windows 7.
What is the recommended way to keep application specific data in registry in Windows Vista & Windows 7, when the application is required to write to registry during the lifetime of the application?.
HKLM is for values that affect all users on the computer. Use a key under HKCU for values that affect only the current user. Your application does not need to be elevated to write under HKCU. If only one person uses each machine (it's on their desk or it's their laptop) this distinction matters very little to you, and lets the app run without elevation.
精彩评论