mercredi 5 août 2015

I use CRegKey to open some, but this m_hKey != 0


I want to get JDk path by the Registry, this path is HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.8, when i use CRegKey.open(HKEY_LOCAL_MACHINE, L"SOFTWARE\JavaSoft\Java Development Kit\1.8"), it throw expression m_hKey != 0. so what's happend ? how to fix this bug? Here is my code:

    // Get Java environment variable install path
CRegKey key;
wchar_t JavaHome[40];
ULONG szJavaHome = 40;
bool res = key.Open(HKEY_LOCAL_MACHINE, L"SOFTWARE\\JavaSoft\\Java Development Kit\\1.8");
if (key.m_hKey == 0)
    MessageBox(L"11");
restrul = key.QueryStringValue(L"JavaHome", JavaHome, &szJavaHome);

Thanks ~



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire