Forum Discussion

Yogesh_C's avatar
Yogesh_C
New Contributor
8 years ago
Solved

Storages.Registry() fails in Non-English Windows OS

Function below runs successfully on English Windows OS, but fails on line

objSectionKey = Storages.Registry(strKey, longRootKey, intRegistryType, blnReadOnly);

on Non-English Windows OS (I am using Windows 7 Russian, and TestComplete v11) with following error...

 

Unable to open the  registry key HKEY_CLASSES_ROOT\Excel.Application\CLSID .
Try to open it in read-only mode.

 

Any help will be appreciated.

 

function DisableExcelApp()
{
    var longRootKey = HKEY_CLASSES_ROOT;
    var strKey = "Excel.Application\\CLSID";
    var strRegName = "(Default)";
    var strRegVal;
    var intRegistryType;
    var blnReadOnly = false;
    var objSectionKey;

    (Sys.OSInfo.Windows64bit) ? (intRegistryType = AQRT_64_BIT) : (intRegistryType = AQRT_32_BIT);

    objSectionKey = Storages.Registry(strKey, longRootKey, intRegistryType, blnReadOnly);

    strRegVal = objSectionKey.GetOptionByIndex(0, "");
    strRegVal = strRegVal + ".Disabled";

    objSectionKey.SetOptionByIndex(0, strRegVal);

    Log.Message("Disabled Excel application.");
} // End DisableExcelApp()

  • I guess TC don't have permissions because of windows7 UAC preferences.

    Run TestComplete  'as Administrator' and try call your function again.

     

2 Replies

  • Bobik's avatar
    Bobik
    Frequent Contributor

    I guess TC don't have permissions because of windows7 UAC preferences.

    Run TestComplete  'as Administrator' and try call your function again.