| 77 | } |
| 78 | |
| 79 | bool CColorCopApp::BringExistingInstanceToFront() { |
| 80 | // Locate the existing Color Cop dialog by its default dialog class (#32770) |
| 81 | // and its exact window caption ("Color Cop"). This works because the dialog |
| 82 | // uses the standard Windows dialog class and the caption is fixed in the |
| 83 | // dialog resource. If either changes (e.g., localization or dynamic titles), |
| 84 | // this lookup must be updated. |
| 85 | HWND hWnd = FindWindow(_T("#32770"), _T("Color Cop")); |
| 86 | if (!hWnd) { |
| 87 | TRACE(_T("Unable to find Color Cop window to bring to front\n")); |
| 88 | return false; |
| 89 | } |
| 90 | |
| 91 | AllowSetForegroundWindow(ASFW_ANY); |
| 92 | |
| 93 | if (IsIconic(hWnd)) { |
| 94 | ShowWindow(hWnd, SW_RESTORE); |
| 95 | } else { |
| 96 | ShowWindow(hWnd, SW_SHOWNORMAL); |
| 97 | } |
| 98 | |
| 99 | SetForegroundWindow(hWnd); |
| 100 | BringWindowToTop(hWnd); |
| 101 | |
| 102 | return true; |
| 103 | } |
| 104 | |
| 105 | // uses a Mutex to figure out if there is an instance of color cop running |
| 106 | bool CColorCopApp::InstanceRunning() { |
nothing calls this directly
no outgoing calls
no test coverage detected