Write to registry
- Issue
- Build
- Bjarne Anker
- PowerBuilder
- Tuesday, 20 February 2018 09:06 AM UTC
Hi.
I need to write to the HKEY_CLASSES_ROOT part in the windows registry from our PB 2017 application.
When I use RegistrySet("HKEY_CLASSES_ROOT\mykey","MyValue",RegString!,"MyValue"), it returns -1.
If I change to HKEY_CURRENT_USER, it works fine.
So I guess it has to do with permissions, and I can edit the HKEY_CLASSES_ROOT part when I run regedit.exe.
I this a known limitation in PB 2017? And is there a workaround, besides running the application as administrator?
And is perhaps the solution to use RegValueSetEx from "advapi32.dll" declared in Local External Functions?
It would be great if anyone has a working example of this. I cannot seem to find the values for the registry parts (RegValueSetEx expects a long value for HKEY_CLASSES_ROOT) or the correct parameters to write to registry using external functions.
It is not an option to run our application as administrator, even if it will write to the HKEY_CLASSES_ROOT just fine.
Br,
Bjarne Anker
Maritech Systems AS
Norway
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.