MCPcopy Create free account
hub / github.com/ColorCop/ColorCop / InitInstance

Method InitInstance

ColorCop/ColorCop.cpp:54–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52// CColorCopApp initialization
53
54BOOL CColorCopApp::InitInstance() {
55 // Enforce single‑instance mode unless explicitly overridden by the
56 // MultipleInstances flag. If another instance is already running,
57 // activate its window and terminate this one immediately.
58 if (!(dlg.m_Appflags & MultipleInstances)) {
59 if (InstanceRunning()) {
60 BringExistingInstanceToFront();
61 return FALSE; // stop launching a second instance
62 }
63 }
64
65 // Initialize and display the main dialog for this instance.
66 dlg.m_PortableMode = m_PortableMode;
67 m_pMainWnd = &dlg;
68
69 int nResponse = dlg.DoModal(); // run the Color Cop dialog modally
70
71 // Persist settings on normal exit paths (OK or Cancel).
72 if (nResponse == IDOK || nResponse == IDCANCEL) {
73 CloseApplication();
74 }
75
76 return FALSE; // terminate the application after the dialog closes
77}
78
79bool CColorCopApp::BringExistingInstanceToFront() {
80 // Locate the existing Color Cop dialog by its default dialog class (#32770)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected