I port my application in vc++ 2005 to vc++ 2008 -registry entry code could not work properly.
-
I port my application in vc++ 2005 to vc++ 2008. it works proper other than registry entry code. Is this is bug of visual studio 2008?
-
I port my application in vc++ 2005 to vc++ 2008. it works proper other than registry entry code. Is this is bug of visual studio 2008?
Have you tried debugging? Did the registry function succeed? Did you checked the return value?
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
Have you tried debugging? Did the registry function succeed? Did you checked the return value?
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
Thanks for your replay. It works in xp But shows problem in vista.
-
Thanks for your replay. It works in xp But shows problem in vista.
vicky00000 wrote:
It works in xp But shows problem in vista.
I am sorry, I forgot my telescope today and am unable to see your monitor. Can you please elaborate more on what the problem exactly is? How exactly are you dealing with the registry and what exactly does the registry function returns?
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
vicky00000 wrote:
It works in xp But shows problem in vista.
I am sorry, I forgot my telescope today and am unable to see your monitor. Can you please elaborate more on what the problem exactly is? How exactly are you dealing with the registry and what exactly does the registry function returns?
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
Thanks for your replay. I wrote an applcation in vc++ 2005,in which I create a new registry key and set some value. This one work proper in xp and vista. I port the same code to vc++ 2008. It works in xp, but not in vista. I hope you can understand my problem. Thanks.
-
Thanks for your replay. I wrote an applcation in vc++ 2005,in which I create a new registry key and set some value. This one work proper in xp and vista. I port the same code to vc++ 2008. It works in xp, but not in vista. I hope you can understand my problem. Thanks.
vicky00000 wrote:
I wrote an applcation in vc++ 2005,in which I create a new registry key and set some value. This one work proper in xp and vista. I port the same code to vc++ 2008. It works in xp, but not in vista.
Aren't you using some function which would create the new registry key? What is that function returning when you say it wasn't working?
vicky00000 wrote:
I hope you can understand my problem.
I bet nobody can.
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
vicky00000 wrote:
I wrote an applcation in vc++ 2005,in which I create a new registry key and set some value. This one work proper in xp and vista. I port the same code to vc++ 2008. It works in xp, but not in vista.
Aren't you using some function which would create the new registry key? What is that function returning when you say it wasn't working?
vicky00000 wrote:
I hope you can understand my problem.
I bet nobody can.
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
Thanks for ur replay. long lRet = RegCreateKeyEx(HKEY_LOCAL_MACHINE,_T("Some Path"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisposition); lRet is 5 in the case vc++ 2008 and in the case vc++ 2005 lRet is 0
-
Thanks for ur replay. long lRet = RegCreateKeyEx(HKEY_LOCAL_MACHINE,_T("Some Path"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisposition); lRet is 5 in the case vc++ 2008 and in the case vc++ 2005 lRet is 0
vicky00000 wrote:
lRet is 5 in the case vc++ 2008 and in the case vc++ 2005 lRet is 0
The documentation for RegCreateEx says a non-zero value is returned, when the function fails. 5 is a non-zero value AFAIK. The documentation also says: use FormatMessage()[^] with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
Thanks for ur replay. long lRet = RegCreateKeyEx(HKEY_LOCAL_MACHINE,_T("Some Path"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisposition); lRet is 5 in the case vc++ 2008 and in the case vc++ 2005 lRet is 0
I would suspect it's an access denied error since you're writing to HKEY_LOCAL_MACHINE. Your app needs to run with elevated privileges to do that. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I would suspect it's an access denied error since you're writing to HKEY_LOCAL_MACHINE. Your app needs to run with elevated privileges to do that. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Mark Salsbery, Yes, this is access denied error, could you please explain how to overcome this problem. Thanks in advance.
-
Mark Salsbery, Yes, this is access denied error, could you please explain how to overcome this problem. Thanks in advance.
Writing to HKEY_LOCAL_MACHINE requires the code to run with administrator rights/elevated privileges. Does it work if you run your app as an administrator? Why do you need to write to HKEY_LOCAL_MACHINE? That should generally only be done at install time (running elevated). If you have common application data that needs to be shared between users, then you should store that at the recommended application shared data folder, not in the registry. Unless, of course, all users of your app have no problem running the app as an administrator. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Writing to HKEY_LOCAL_MACHINE requires the code to run with administrator rights/elevated privileges. Does it work if you run your app as an administrator? Why do you need to write to HKEY_LOCAL_MACHINE? That should generally only be done at install time (running elevated). If you have common application data that needs to be shared between users, then you should store that at the recommended application shared data folder, not in the registry. Unless, of course, all users of your app have no problem running the app as an administrator. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Thanks for your valuable suggetion. With the help of your valuable suggetion i solve my problem by set UAC. please go through the MSDN link [http://msdn2.microsoft.com/en-us/library/bb384691.aspx">http://msdn2.microsoft.com/en-us/library/bb384608.aspx http://msdn2.microsoft.com/en-us/library/bb384691.aspx](http://msdn2.microsoft.com/en-us/library/bb384608.aspx<br mode=) [ [http://msdn2.microsoft.com/en-us/library/bb384691.aspx" target="_blank" title="New Window">^](http://msdn2.microsoft.com/en-us/library/bb384608.aspx<br mode=)] To set this linker option in the Visual Studio development environment Open the project's Property Pages dialog box. Expand the Configuration Properties node. Expand the Linker node. Select the Manifest File property page. Modify the Enable User Account Control (UAC), UAC Execution Level, and UAC Bypass UI Protection properties. To set this linker option programmatically See EnableUAC(), UACExecutionLevel(), and UACUIAccess(). Thanks to all and code project with regards vicky00000
-
Thanks for your valuable suggetion. With the help of your valuable suggetion i solve my problem by set UAC. please go through the MSDN link [http://msdn2.microsoft.com/en-us/library/bb384691.aspx">http://msdn2.microsoft.com/en-us/library/bb384608.aspx http://msdn2.microsoft.com/en-us/library/bb384691.aspx](http://msdn2.microsoft.com/en-us/library/bb384608.aspx<br mode=) [ [http://msdn2.microsoft.com/en-us/library/bb384691.aspx" target="_blank" title="New Window">^](http://msdn2.microsoft.com/en-us/library/bb384608.aspx<br mode=)] To set this linker option in the Visual Studio development environment Open the project's Property Pages dialog box. Expand the Configuration Properties node. Expand the Linker node. Select the Manifest File property page. Modify the Enable User Account Control (UAC), UAC Execution Level, and UAC Bypass UI Protection properties. To set this linker option programmatically See EnableUAC(), UACExecutionLevel(), and UACUIAccess(). Thanks to all and code project with regards vicky00000
Awesome! Thanks for the update! Cheers, Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: