void COptionPluginPage::ApplyComboBoxes(void) { for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++) { CModifiedComboBox * ComboBox = cb_iter->second; if (ComboBox->IsChanged()) { int index = ComboBox->GetCurSel(); if (index == CB_ERR) { return; } const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); if (PluginPtr == NULL) { return; } const CPluginList::PLUGIN * Plugin = *PluginPtr; g_Settings->SaveString(cb_iter->first, Plugin->FileName.c_str()); } if (ComboBox->IsReset()) { g_Settings->DeleteSetting(cb_iter->first); ComboBox->SetReset(false); } } }
void COptionPluginPage::ShowAboutButton ( int id ) { CModifiedComboBox * ComboBox = NULL; for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) { if ((int)(cb_iter->second->GetMenu()) != id) { continue; } ComboBox = cb_iter->second; break; } if (ComboBox == NULL) { return; } int index = ComboBox->GetCurSel(); if (index == CB_ERR) { return; } const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); if (PluginPtr == NULL) { return; } const CPluginList::PLUGIN * Plugin = *PluginPtr; if (Plugin == NULL) { return; } //Load the plugin UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS ); HMODULE hLib = LoadLibrary(Plugin->FullPath); SetErrorMode(LastErrorMode); if (hLib == NULL) { return; } //Get DLL about void (__cdecl *DllAbout) ( HWND hWnd ); DllAbout = (void (__cdecl *)(HWND))GetProcAddress( hLib, "DllAbout" ); //call the function from the dll if (DllAbout != NULL) DllAbout(m_hWnd); FreeLibrary(hLib); }
void COptionPluginPage::ApplyComboBoxes ( void ) { for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++) { CModifiedComboBox * ComboBox = cb_iter->second; if (ComboBox->IsChanged()) { int index = ComboBox->GetCurSel(); if (index == CB_ERR) { return; } const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); if (PluginPtr == NULL) { return; } const CPluginList::PLUGIN * Plugin = *PluginPtr; g_Settings->SaveString(cb_iter->first,Plugin->FileName.c_str()); switch (Plugin->Info.Type) { case PLUGIN_TYPE_RSP: g_Settings->SaveBool(Plugin_RSP_Changed,true); break; case PLUGIN_TYPE_GFX: g_Settings->SaveBool(Plugin_GFX_Changed,true); break; case PLUGIN_TYPE_AUDIO: g_Settings->SaveBool(Plugin_AUDIO_Changed,true); break; case PLUGIN_TYPE_CONTROLLER: g_Settings->SaveBool(Plugin_CONT_Changed,true); break; default: g_Notify->BreakPoint(__FILE__,__LINE__); } } if (ComboBox->IsReset()) { g_Settings->DeleteSetting(cb_iter->first); ComboBox->SetReset(false); } } }
void COptionPluginPage::PluginItemChanged(int id, int AboutID, bool bSetChanged) { CModifiedComboBox * ComboBox = NULL; for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter++) { if ((int)(cb_iter->second->GetMenu()) != id) { continue; } ComboBox = cb_iter->second; break; } if (ComboBox == NULL) { return; } int index = ComboBox->GetCurSel(); if (index == CB_ERR) { return; } const CPluginList::PLUGIN ** PluginPtr = (const CPluginList::PLUGIN **)ComboBox->GetItemDataPtr(index); if (PluginPtr) { const CPluginList::PLUGIN * Plugin = *PluginPtr; if (Plugin) { ::EnableWindow(GetDlgItem(AboutID), Plugin->AboutFunction); } } if (bSetChanged) { ComboBox->SetChanged(true); SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0); } }