| 186 | } |
| 187 | |
| 188 | void BaseContextMenu::ShowClassicContextMenu(const wuxc::MenuFlyout &flyout, POINT pt) |
| 189 | { |
| 190 | const auto guard = wil::scope_exit([this] |
| 191 | { |
| 192 | CleanupClassicContextMenu(); |
| 193 | }); |
| 194 | |
| 195 | if (const auto menu = BuildClassicContextMenu(flyout)) |
| 196 | { |
| 197 | SetLastError(NO_ERROR); |
| 198 | const unsigned int item = TrackPopupMenu(menu, TPM_RETURNCMD | TPM_LEFTALIGN, pt.x, pt.y, 0, m_WindowHandle, nullptr); |
| 199 | if (item) |
| 200 | { |
| 201 | TriggerClassicContextMenuItem(item); |
| 202 | } |
| 203 | else if (const DWORD lastErr = GetLastError(); lastErr != NO_ERROR) // can return 0 if the menu is dismissed |
| 204 | { |
| 205 | HresultHandle(HRESULT_FROM_WIN32(lastErr), spdlog::level::warn, L"Failed to open context menu."); |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | void BaseContextMenu::MoveHiddenWindow(RECT &rect) |
| 211 | { |
nothing calls this directly
no outgoing calls
no test coverage detected