| 279 | // CColorCopDlg message handlers |
| 280 | |
| 281 | BOOL CColorCopDlg::OnInitDialog() { |
| 282 | CDialog::OnInitDialog(); |
| 283 | |
| 284 | SetupSystemMenu(); // add about and always on top to the system menu |
| 285 | |
| 286 | LoadPersistentVariables(); |
| 287 | ToggleOnTop(false); // make always on top, unless save file said not to |
| 288 | |
| 289 | SetupWindowRects(); |
| 290 | TestForExpand(); // do not call this before SetupWindowRects(); |
| 291 | |
| 292 | if (!m_ToolTip.Create(this)) { |
| 293 | TRACE(_T("Unable to create a tool tip obj")); |
| 294 | } else { |
| 295 | m_ToolTip.AddTool(&m_ExpandDialog, IDS_EXPANDEDDIALOG); |
| 296 | m_ToolTip.AddTool(&m_ColorPick, IDS_CUSTOM_COLOR); |
| 297 | m_ToolTip.AddTool(this, _T(""), &buttonrect, 1); |
| 298 | m_ToolTip.SetDelayTime(TTDT_INITIAL, 200); |
| 299 | m_ToolTip.Activate(TRUE); |
| 300 | m_ToolTip.SendMessage(TTM_SETMAXTIPWIDTH, 0, 300); |
| 301 | } |
| 302 | |
| 303 | nTrayNotificationMsg_ = RegisterWindowMessage(kpcTrayNotificationMsg_); |
| 304 | |
| 305 | // application variables |
| 306 | m_isMagPlusDown = m_isMagMinusDown = m_oldColorSaved = FALSE; |
| 307 | m_bCalcColorPal = m_isEyedropping = m_isMagnifying = FALSE; |
| 308 | bMinimized_ = false; |
| 309 | pTrayIcon_ = nullptr; |
| 310 | |
| 311 | // small icon |
| 312 | hIcon_ = (HICON)::LoadImage( |
| 313 | AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, |
| 314 | GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0); |
| 315 | |
| 316 | // large icon |
| 317 | m_hIcon = (HICON)::LoadImage( |
| 318 | AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, |
| 319 | GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0); |
| 320 | |
| 321 | SetIcon(hIcon_, FALSE); // small icon 16x16 |
| 322 | SetIcon(m_hIcon, TRUE); // big icon 32x32 |
| 323 | |
| 324 | bRelativePosition = false; |
| 325 | m_MagDrop = false; |
| 326 | |
| 327 | // |
| 328 | // -------- Centralized pApp handling -------- |
| 329 | // |
| 330 | if (CWinApp* pApp = AfxGetApp()) { |
| 331 | // Load common cursors/icons once |
| 332 | m_hMagCursor = pApp->LoadCursor(IDC_MEDIUM_MAGNIFY); |
| 333 | m_hHandCursor = pApp->LoadCursor(IDC_HANDPOINTER); |
| 334 | m_hMoveCursor = pApp->LoadCursor(IDC_CURMOVE); |
| 335 | m_hBlank = pApp->LoadIcon(IDI_BLANK); |
| 336 | m_hStandardCursor = pApp->LoadStandardCursor(IDC_ARROW); |
| 337 | |
| 338 | m_Magnifier.SetIcon(m_hMagCursor); |