void cPlugin::Unload(void) { auto pm = cPluginManager::Get(); pm->RemovePluginCommands(this); pm->RemovePluginConsoleCommands(this); pm->RemoveHooks(this); OnDisable(); m_Status = cPluginManager::psUnloaded; m_LoadError.clear(); }
void FLiveEditor::ShutdownModule() { RemoveHooks(); delete ObjectCreationListener; ObjectCreationListener = NULL; delete ObjectDeletionListener; ObjectDeletionListener = NULL; FLiveEditorManager::Shutdown(); }
extern "C" __declspec(dllexport) int __cdecl OverlayHelperProcessMain(unsigned int magic, HANDLE parent) { int retval = 0; if (GetOverlayMagicVersion() != magic) { return OVERLAY_HELPER_ERROR_DLL_MAGIC_MISMATCH; } HANDLE pcheckHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) OverlayHelperProcessParentDeathThread, reinterpret_cast<void *>(parent), 0, NULL); if (pcheckHandle == 0) { return OVERLAY_HELPER_ERROR_DLL_PDEATH_THREAD_ERROR; } PrepareD3D9(); PrepareDXGI(); InstallHooks(); while (1) { MSG msg; BOOL ret; ret = GetMessage(&msg, NULL, 0, 0); // The ret variable is set to 0 on WM_QUIT, // and -1 on error. if (ret == 0) { retval = 0; break; } else if (ret == -1) { retval = -1001; break; } if (msg.message == WM_CLOSE) { retval = 0; break; } TranslateMessage(&msg); DispatchMessage(&msg); } RemoveHooks(); return retval; }
void cPluginManager::RemovePlugin(cPlugin * a_Plugin) { for (PluginMap::iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr) { if (itr->second == a_Plugin) { m_Plugins.erase(itr); break; } } RemovePluginCommands(a_Plugin); RemovePluginConsoleCommands(a_Plugin); RemoveHooks(a_Plugin); if (a_Plugin != NULL) { a_Plugin->OnDisable(); } delete a_Plugin; }
void FLiveEditorListenServer::ShutdownModule() { #if !UE_BUILD_SHIPPING RemoveHooks(); #endif }
// Used to update the tracking info to account for a change in the top-level menu HRESULT CMenuFocusManager::UpdateFocus() { HRESULT hr; StackEntry * old = m_current; TRACE("UpdateFocus\n"); // Assign the new current item if (m_bandCount > 0) m_current = &(m_bandStack[m_bandCount - 1]); else m_current = NULL; // Remove the menu capture if necesary if (!m_current || m_current->type != MenuPopupEntry) { SetMenuCapture(NULL); if (old && old->type == MenuPopupEntry && m_PreviousForeground) { ::SetForegroundWindow(m_PreviousForeground); m_PreviousForeground = NULL; } } // Obtain the top-level window for the new active menu if (m_current && m_current->type != TrackedMenuEntry) { hr = m_current->mb->_GetTopLevelWindow(&(m_current->hwnd)); if (FAILED_UNEXPECTEDLY(hr)) return hr; } // Refresh the parent pointer if (m_bandCount >= 2) { m_parent = &(m_bandStack[m_bandCount - 2]); _ASSERT(m_parent->type != TrackedMenuEntry); } else { m_parent = NULL; } // Refresh the menubar pointer, if applicable if (m_bandCount >= 1 && m_bandStack[0].type == MenuBarEntry) { m_menuBar = &(m_bandStack[0]); } else { m_menuBar = NULL; } // Remove the old hooks if the menu type changed, or we don't have a menu anymore if (old && (!m_current || old->type != m_current->type)) { if (m_current && m_current->type != TrackedMenuEntry) { DisableMouseTrack(m_current->hwnd, FALSE); } hr = RemoveHooks(); if (FAILED_UNEXPECTEDLY(hr)) return hr; } // And place new ones if necessary if (m_current && (!old || old->type != m_current->type)) { hr = PlaceHooks(); if (FAILED_UNEXPECTEDLY(hr)) return hr; } // Give the user a chance to move the mouse to the new menu if (m_parent) { DisableMouseTrack(m_parent->hwnd, TRUE); } if (m_current && m_current->type == MenuPopupEntry) { if (m_captureHwnd == NULL) { // We need to restore the capture after a non-shell submenu or context menu is shown StackEntry * topMenu = m_bandStack; if (topMenu->type == MenuBarEntry) topMenu++; // Get the top-level window from the top popup CComPtr<IServiceProvider> bandSite; CComPtr<IOleWindow> deskBar; hr = topMenu->mb->GetSite(IID_PPV_ARG(IServiceProvider, &bandSite)); if (FAILED(hr)) goto NoCapture; hr = bandSite->QueryService(SID_SMenuPopup, IID_PPV_ARG(IOleWindow, &deskBar)); if (FAILED(hr)) goto NoCapture; CComPtr<IOleWindow> deskBarSite; hr = IUnknown_GetSite(deskBar, IID_PPV_ARG(IOleWindow, &deskBarSite)); if (FAILED(hr)) goto NoCapture; // FIXME: Find the correct place for this HWND hWndOwner; hr = deskBarSite->GetWindow(&hWndOwner); if (FAILED(hr)) goto NoCapture; m_PreviousForeground = ::GetForegroundWindow(); if (m_PreviousForeground != hWndOwner) ::SetForegroundWindow(hWndOwner); else m_PreviousForeground = NULL; // Get the HWND of the top-level window HWND hWndSite; hr = deskBar->GetWindow(&hWndSite); if (FAILED(hr)) goto NoCapture; SetMenuCapture(hWndSite); } NoCapture: if (!m_parent || m_parent->type == MenuBarEntry) { if (old && old->type == TrackedMenuEntry) { // FIXME: Debugging code, probably not right POINT pt2; RECT rc2; GetCursorPos(&pt2); ScreenToClient(m_current->hwnd, &pt2); GetClientRect(m_current->hwnd, &rc2); if (PtInRect(&rc2, pt2)) SendMessage(m_current->hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(pt2.x, pt2.y)); else SendMessage(m_current->hwnd, WM_MOUSELEAVE, 0, 0); } } } _ASSERT(!m_parent || m_parent->type != TrackedMenuEntry); return S_OK; }