I'm trying to work with the OpenWithProgids key of an extension using TRegistry. I don't see that TRegistry can write these values (which require a type of REG_NONE.) I know that I could just use the API RegSetValueEx function to set these, but I'm wondering if I'm missing something in TRegistry that can do it.
It is true that TRegistry
has no direct support for REG_NONE
values. However, with the protected hack, you can trick it into creating zero-length binary REG_NONE
values:
type
TRegistryHack = class(TRegistry);
....
TRegistryHack(Registry).PutData(ValueName, nil, 0, rdUnknown);
You need to use the protected hack to gain access to PutData
which is a protected member. A cleaner approach would be to use a class helper or true class derived from TRegistry
, but you get the idea.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With