BOOL CToolbarHelper::Release(BOOL bClearDropBtns) { if (HookWindow(NULL) && ScHookWindow(NULL)) { if (bClearDropBtns) { // iterate the buttons the hard way POSITION pos = m_mapTHButtons.GetStartPosition(); while (pos) { THButton dm = { 0 }; UINT nCmdID = 0; m_mapTHButtons.GetNextAssoc(pos, nCmdID, dm); ClearDropButton(nCmdID, FALSE); } } m_pToolbar = NULL; m_mapTHButtons.RemoveAll(); m_tt.DestroyWindow(); return TRUE; } return FALSE; }
void CToolbarHelper::InitTooltips() { if (!m_tt.Create(GetCWnd(), TTS_ALWAYSTIP)) return; // hook the toolbar for mouse messages VERIFY(ScHookWindow(m_pToolbar->GetSafeHwnd())); // turn off default tooltips m_pToolbar->SetBarStyle(m_pToolbar->GetBarStyle() & ~CBRS_TOOLTIPS); // and activate it m_tt.Activate(TRUE); // set up tools for each of the toolar buttons int nBtnCount = m_pToolbar->GetToolBarCtrl().GetButtonCount(); for (int nBtn = 0; nBtn < nBtnCount; nBtn++) { if (m_pToolbar->GetItemID(nBtn) != ID_SEPARATOR) { CRect rBtn; m_pToolbar->GetItemRect(nBtn, rBtn); m_tt.AddTool(m_pToolbar, LPSTR_TEXTCALLBACK, rBtn, m_pToolbar->GetItemID(nBtn)); } } }
BOOL CTrayIcon::AddToTray() { NOTIFYICONDATA_TI nid; nid.cbSize = sizeof(nid); nid.hWnd = GetSafeHwnd(); nid.uID = GetDlgCtrlID(); nid.uFlags = NIF_MESSAGE | NIF_ICON; nid.uCallbackMessage = WM_TINOTIFY; nid.hIcon = m_hIcon; if (!m_sTip.IsEmpty()) { nid.uFlags |= NIF_TIP; //fabio_2005 #if _MSC_VER >= 1400 _tcsncpy_s(nid.szTip, (LPTSTR)(LPCTSTR)m_sTip, sizeof(nid.szTip)/sizeof(TCHAR)); #else _tcsncpy(nid.szTip, (LPTSTR)(LPCTSTR)m_sTip, sizeof(nid.szTip)/sizeof(TCHAR)); #endif nid.szTip[sizeof(nid.szTip)/sizeof(TCHAR)-1] = (TCHAR)0; } // create top level parent hook first time around if (!ScIsHooked()) { CWnd* pTLParent = GetTopLevelParent(); if (pTLParent) ScHookWindow(pTLParent->GetSafeHwnd()); } return Shell_NotifyIcon(NIM_ADD, (PNOTIFYICONDATA)&nid); }
void CTimeComboBox::PreSubclassWindow() { CLocalizer::EnableTranslation(*this, FALSE); BuildCombo(); // hook the edit ctrl so we can convert '.' and ',' to ':' CWnd* pEdit = GetDlgItem(1001); if (pEdit) ScHookWindow(pEdit->GetSafeHwnd()); CComboBox::PreSubclassWindow(); }
BOOL CDockManager::Initialize(CWnd* pMainWnd, CWnd* pDockWnd, DM_POS nPos, DM_POS nLastPos, int nWidthDocked, int nWidthDockedMax, int nHeightDocked, int nHeightDockedMax) { if (!HookWindow(*pMainWnd) || !ScHookWindow(*pDockWnd)) return FALSE; m_nLastDockPos = nLastPos; m_nWidthDocked = nWidthDocked; m_nWidthDockedMax = nWidthDockedMax; m_nHeightDocked = nHeightDocked; m_nHeightDockedMax = nHeightDockedMax; return Dock(nPos); }
int CTimeComboBox::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CComboBox::OnCreate(lpCreateStruct) == -1) return -1; CLocalizer::EnableTranslation(*this, FALSE); BuildCombo(); // hook the edit ctrl so we can convert '.' and ',' to ':' CWnd* pEdit = GetDlgItem(1001); if (pEdit) ScHookWindow(pEdit->GetSafeHwnd()); return 0; }