CMeter2DGraphModel::CMeter2DGraphModel( const Diagnostic::CUnitKey& aKey, const CECUDeviceView& aDeviceView, IMeter2DGraphUpdateConsumer& aUpdateConsumer ) : CAbstractMeterModel( aKey, aDeviceView, aUpdateConsumer ) { TRACE_FUN( Routine, "CMeter2DGraphModel::CMeter2DGraphModel" ); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// _lastUpdate = 0; _lastUnit = Diagnostic::uCounts; _timeOffset = .0; _timeOffsetIntegrator = 1.; _timeFrame = 30; _timeResolution = 10; _valueFrame = .0; _valueResolution = 5; SetTimeFrame( 30 ); SetTimeResolution( 10 ); SetValueFrame( .0 ); SetValueResolution( 5 ); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// l2max::CVariant timeFrame; l2max::CVariant timeResolution; l2max::CVariant valueResolution; CAppContext::GetInstance()->MainRegistry().Read( registryKey() + V_METER_GRAPH_TIME_FRAME, timeFrame ); if( timeFrame.isValid() ) { SetTimeFrame( timeFrame.toInt() ); } CAppContext::GetInstance()->MainRegistry().Read( registryKey() + V_METER_GRAPH_TIME_RESOLUTION, timeResolution ); if( timeResolution.isValid() ) { SetTimeResolution( timeResolution.toInt() ); } CAppContext::GetInstance()->MainRegistry().Read( registryKey() + V_METER_GRAPH_VALUE_RESOLUTION, valueResolution ); if( valueResolution.isValid() ) { SetValueResolution( valueResolution.toInt() ); } }
LONG UnregisterServer(const CLSID& clsid, // Class ID const char* szVerIndProgID, // Programmatic const char* szProgID) // IDs { LONG lResult = S_OK; // Convert the CLSID into a char. char szCLSID[CLSID_STRING_SIZE]; if (!CLSIDtochar(clsid, szCLSID, sizeof(szCLSID))) return S_FALSE; UnRegisterProxy(); nsCAutoString registryKey("CLSID\\"); registryKey += szCLSID; lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, registryKey.get()); if (lResult == ERROR_SUCCESS || lResult == ERROR_FILE_NOT_FOUND) return lResult; registryKey += "\\LocalServer32"; // Delete only the path for this server. lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, registryKey.get()); if (lResult != ERROR_SUCCESS && lResult != ERROR_FILE_NOT_FOUND) return lResult; // Delete the version-independent ProgID Key. lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szVerIndProgID); if (lResult != ERROR_SUCCESS && lResult != ERROR_FILE_NOT_FOUND) return lResult; lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szProgID); return lResult; }
CMeter2DGraphModel::~CMeter2DGraphModel() { CAppContext::GetInstance()->MainRegistry().Write( registryKey() + V_METER_GRAPH_TIME_FRAME, timeFrame() ); CAppContext::GetInstance()->MainRegistry().Write( registryKey() + V_METER_GRAPH_TIME_RESOLUTION, timeResolution() ); CAppContext::GetInstance()->MainRegistry().Write( registryKey() + V_METER_GRAPH_VALUE_RESOLUTION, valueResolution() ); }
HRESULT RegisterServer(const CLSID& clsid, // Class ID const char* szFriendlyName, // Friendly Name const char* szVerIndProgID, // Programmatic const char* szProgID) // IDs { HMODULE hModule = GetModuleHandle(NULL); char szModuleName[MAX_SIZE]; char szCLSID[CLSID_STRING_SIZE]; nsCAutoString independentProgId(szVerIndProgID); nsCAutoString progId(szProgID); DWORD dwResult = ::GetModuleFileName(hModule, szModuleName, sizeof(szModuleName)/sizeof(char)); if (dwResult == 0) return S_FALSE; nsCAutoString moduleName(szModuleName); nsCAutoString registryKey("CLSID\\"); moduleName += MAPI_STARTUP_ARG; // Convert the CLSID into a char. if (!CLSIDtochar(clsid, szCLSID, sizeof(szCLSID))) return S_FALSE; registryKey += szCLSID; // Add the CLSID to the registry. if (!setKeyAndValue(registryKey, NULL, szFriendlyName)) return S_FALSE; if (!setKeyAndValue(registryKey, "LocalServer32", moduleName.get())) return S_FALSE; // Add the ProgID subkey under the CLSID key. if (!setKeyAndValue(registryKey, "ProgID", szProgID)) return S_FALSE; // Add the version-independent ProgID subkey under CLSID key. if (!setKeyAndValue(registryKey, "VersionIndependentProgID", szVerIndProgID)) return S_FALSE; // Add the version-independent ProgID subkey under HKEY_CLASSES_ROOT. if (!setKeyAndValue(independentProgId, NULL, szFriendlyName)) return S_FALSE; if (!setKeyAndValue(independentProgId, "CLSID", szCLSID)) return S_FALSE; if (!setKeyAndValue(independentProgId, "CurVer", szProgID)) return S_FALSE; // Add the versioned ProgID subkey under HKEY_CLASSES_ROOT. if (!setKeyAndValue(progId, NULL, szFriendlyName)) return S_FALSE; if (!setKeyAndValue(progId, "CLSID", szCLSID)) return S_FALSE; RegisterProxy(); return S_OK; }