nk51
asked on
How to use the function KeyExists ?
I have to use the function KeyExists to determinate if a Key
exist in the registry.
I test the function with an existing key but the function doesn't find it.
Why?????
My code:
In the interface of the unit 'fmMain':
const
//Registry
Cle : String = 'Software\ANCV\Commande cheques vacance'; //sous HKEY_CURRENT_USER
The procedure using the function KeyExists:
procedure TfmMain.FormCreate(Sender: TObject);
var index : integer;
regHKeyCurrentUser : TRegIniFile;
begin
regHKeyCurrentUser:=TRegIn iFile.Crea te('HKEY_C URRENT_USE R');
if not RegHKeyCurrentUser.KeyExis ts(cle)
then
begin
The key cle exist in the registry but KeyExists return false.What's the problem ?
exist in the registry.
I test the function with an existing key but the function doesn't find it.
Why?????
My code:
In the interface of the unit 'fmMain':
const
//Registry
Cle : String = 'Software\ANCV\Commande cheques vacance'; //sous HKEY_CURRENT_USER
The procedure using the function KeyExists:
procedure TfmMain.FormCreate(Sender:
var index : integer;
regHKeyCurrentUser : TRegIniFile;
begin
regHKeyCurrentUser:=TRegIn
if not RegHKeyCurrentUser.KeyExis
then
begin
The key cle exist in the registry but KeyExists return false.What's the problem ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Blackman
You and I posted at the same time (I'm not repetitive!). Do you know why his code doesn't work?
nk51: Es-tu ABSOLUMENT certain que le string et le cle correspond?
Edo
You and I posted at the same time (I'm not repetitive!). Do you know why his code doesn't work?
nk51: Es-tu ABSOLUMENT certain que le string et le cle correspond?
Edo
I've never had great succes with TRegIniFile, so I have always used TRegistry..
ASKER
Thanks, it better works with Tregistry.
Thanks to Edo too.
Thanks to Edo too.
Si tu ne fais pas de changement de win3.1 je suggere d'utiliser TRegistry au lieu de TRegIniFile. De tout facon, je crois que tu as besoin de specifier le path au complet, non?
(If you are not updating/upgrading from 3.1 I suggest using TRegistry. Anyway, don't you need to specify the whole path?).
Regards,
Edo