Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with Registry
Message
Information générale
Forum:
Visual C++
Catégorie:
Autre
Divers
Thread ID:
00639234
Message ID:
00639938
Vues:
19
Thanks Man!, i fixed!, work, but now i try to read a boolean value and obtain a Assert Error, here is the code:

CRegKey oRegKey;
CROLLUPDlg dlg;
HKEY hKeyRoot;
unsigned long nJol;
hKeyRoot = HKEY_LOCAL_MACHINE;
m_pMainWnd = &dlg;
CString cRegistro;
char cCode[20];
char cEnableDHCP[5];
CString cCodeStr;
cRegistro="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\1\\";
nJol=oRegKey.Open(hKeyRoot,cRegistro,KEY_QUERY_VALUE);
if (nJol==0)
{
DWORD dwTamano = sizeof(cCode); <-------- gracias!!
oRegKey.QueryValue(cCode,_T("ServiceName"),&dwTamano); <-------- gracias!!
cRegistro="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\1\\";
nJol=oRegKey.Open(hKeyRoot,cRegistro,KEY_QUERY_VALUE);
cCodeStr=cCode;
cRegistro="SYSTEM\\CONTROLSET001\\SERVICES\\"+cCodeStr+"\\PARAMETERS\\TCPIP\\";
nJol=oRegKey.Open(hKeyRoot,cRegistro,KEY_QUERY_VALUE);
if (nJol==0)
{
dwTamano = sizeof(cEnableDHCP);
oRegKey.QueryValue(cEnableDHCP,_T("EnableDHCP"),&dwTamano); <---- error !!!
}
}

my idea is read the enableDHCP from the card and check the state, in case be 0 turn to 1.

please, in this particular case how i can obtain the boolean value?

Regards

Francisco Morosini

>Hi!
>The third parameter in QueryValue is DWORD*. And specify registry key without the last backslash:
>
>cRegistro="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\1";
>if (nJol==0)
>{
>    DWORD dwCount = sizeof(cCode);
>    oRegKey.QueryValue(cCode,_T("ProductName"),&dwCount);
>}
>
>You could also check the error code returned by QueryValue.
>
>>Hi people!
>>well i have a bit of problem that i might think that someone will
>>come up with a solution.
>>i Spend 1 day and half checking and searching information in www.codeguru.com found value information about the registry. i found many classes for work with registry. i found good one in :http://www.codeguru.com/system/CRegKey.shtml
>>
>>Now, i say that is very good because is done by Microsoft, but the reality is... i dont know how put to works!, i try with trial and error and searching information but i'm lost.
>>
>>i need do in VC++ for performance reasons, because the program is loading in the user login.
>>
>>this is my not working code:
>>(Wizard generate a MFC EXE Dialog Based)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform