//--------------------------------------------------------------------------- void __fastcall TRecent::SetRegistryKey(const String &Value) { if(Value != FRegistryKey) { RemoveMenuItems();//Remove shown menu items FRegistryKey = Value;//Change used registry key ReadFromRegistry();//Read data from new key in registry ShowMenuItems();//Show menu items } }
STDMETHODIMP HXPluginManager::Init(IUnknown* pContext) { HXLOGL3(HXLOG_CORE, "HXPluginManager::Init()"); HX_RESULT result = HXR_FAIL; if( SUCCEEDED( result = RegisterContext( pContext ) ) ) { result = ReadFromRegistry(); } return result; }
CParentWnd::CParentWnd() { // OutputDebugStringOutput only at first // Get any settings from the registry SetDefaults(); ReadFromRegistry(); // After this call we may output to the debug file OpenDebugFile(); DebugPrintVersion(DBGVersionBanner); // Force the system riched20 so we don't load office's version. (void) LoadFromSystemDir(_T("riched20.dll")); // STRING_OK // Second part is to load rundll32.exe // Don't plan on unloading this, so don't care about the return value (void) LoadFromSystemDir(_T("rundll32.exe")); // STRING_OK // Load DLLS and get functions from them ImportProcs(); // Initialize objects for theming InitializeGDI(); m_cRef = 1; m_hwinEventHook = SetWinEventHook( EVENT_OBJECT_REORDER, EVENT_OBJECT_REORDER, NULL, &MyWinEventProc, GetCurrentProcessId(), NULL, NULL); ForceOutlookMAPI(0 != RegKeys[regkeyFORCEOUTLOOKMAPI].ulCurDWORD); ForceSystemMAPI(0 != RegKeys[regkeyFORCESYSTEMMAPI].ulCurDWORD); LoadAddIns(); // Notice we never create a window here! TRACE_CONSTRUCTOR(CLASS); } // CParentWnd::CParentWnd
//--------------------------------------------------------------------------- //Called by user to indicate that file have been used void __fastcall TRecent::FileUsed(const String &FileName) { if(FMaxFiles) { RemoveMenuItems();//Remove shown menu items ReadFromRegistry();//Read data to get changes made by other version of program int Index = FileIndex(FileName);//Get index of FileName in list if(Index == -1)//If FileName not in list { if(FileList.size() == static_cast<unsigned>(FMaxFiles))//If list is full FileList.pop_back();//Erase last file name in list } else FileList.erase(FileList.begin() + Index);//Remove FileName from list FileList.push_front(std::pair<String, TActionClientItem*>(FileName, NULL));//Add FileName to start of list SaveToRegistry();//Write new file list to registry ShowMenuItems();//Show new list of menu items } //Add Filename to recent documents list in the start menu if(FAddToRecentDocs) SHAddToRecentDocs(SHARD_PATH, FileName.c_str()); }
//--------------------------------------------------------------------------- //Constructor initialzes values and allocates memory __fastcall TRecent::TRecent(TComponent* Owner) : TComponent(Owner), FEnabled(true), FMaxFiles(9), FOnLoadFile(NULL), FFileMenu(NULL), FAddToRecentDocs(true), Seperator1(NULL), Seperator2(NULL), FMaxPathLen(50) { ReadFromRegistry();//Read file names from registry }