Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get Values Error in my procedure(registry)
Message
De
02/02/2004 13:44:37
 
 
À
31/01/2004 09:03:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00872652
Message ID:
00873065
Vues:
25
>Fred Can you check this for me Please, I am having problem with my get valuesprocedure from registry..(Thank you)
>
>I am able to write the string value to registry, But when i am trying read the value back it is only showing [ ] on the form.
>
>Can you please tell me do i need to add something to my get_value procedure to the following:
>
>?"["+get_value("options1")+"]"
>
>I am attaching the code Please Help:
>***********************************************************************
>#define PATH_TO_MY_SUBKEY "Software\aaa_test"
>
>#define HKEY_CLASSES_ROOT ( 2147483648 )
>#define HKEY_CURRENT_USER ( 2147483649 )
>#define HKEY_LOCAL_MACHINE ( 2147483650 )
>#define HKEY_USERS ( 2147483651 )
>
>DECLARE long RegCreateKeyA in advapi32 AS RegCreate long hkey, string subkey, long @phkey
>* Creates or opens registry subkey
>DECLARE long RegOpenKeyA in advapi32 AS RegOpen long hkey, string subkey, long @phkey
>* Opens registry subkey
>
>#define REG_SZ ( 1 ) && Unicode nul terminated string
>
>#define REG_DWORD ( 4 ) && 32-bit number
>
>
>DECLARE long RegSetValueEx in advapi32 AS RegSetValue;
>long hkey, string value, long reserved, long type, string data, long data_size
>* Creates or changes registry value
>
>DECLARE long RegQueryValueEx in advapi32 AS RegGetValue;
>long hkey, string value, long @reserved, long @type, string @data, long @data_size
>* Loads registry value
>
>
>do set_value with "options1", "HiEveryone"
>?"["+get_value("options1")+"]"
>
>
>PROCEDURE set_value
>PARAMETERS opt_name, value
>
>aaa = 0
>IF RegCreate(HKEY_LOCAL_MACHINE, PATH_TO_MY_SUBKEY, @aaa)=0
>=RegSetValue(aaa, m.opt_name, 0, REG_SZ, m.value, LEN(m.value)+1)
>=RegClose(aaa)
>RETURN .T.
>ENDIF
>RETURN .F.
>
>
>PROCEDURE get_value
>LPARAMETERS opt_name
>
>aaa = 0
>res = 0
>type = 0
>data = SPACE(101)
>data_size = 100
>IF RegOpen(HKEY_LOCAL_MACHINE, PATH_TO_MY_SUBKEY, @aaa)=0
>=RegGetValue(m.aaa, m.opt_name, @res, @type, @data, @data_size)
>=RegClose(m.aaa)
>ENDIF
>RETURN LEFT(m.data, m.data_size-1)
>**************************************************************************
>Thank you very much for your help.


Sorry, I don't do registry stuff. I've always considered it not a very good idea to store user items in the registry (or really anything for that matter). It's locked down here at work so I can't write to it anyways to test.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform