void CTesthelpCtrl::OnShowToolTipChanged() { // Activate or DeActivate the ToolTip if(m_ttip.m_hWnd && AmbientUserMode()) { m_ttip.Activate(m_bShowToolTip); SetModifiedFlag(); } }
void CTesthelpCtrl::OnToolTipTextChanged() { // Change the ToolTip's text if(m_ttip.m_hWnd && AmbientUserMode()) { m_ttip.UpdateTipText((LPCTSTR)m_szToolTipText,this); SetModifiedFlag(); } }
int CTimeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (COleControl::OnCreate(lpCreateStruct) == -1) return -1; // Start timer if in user mode and if enabled if (AmbientUserMode() && GetEnabled()) StartTimer(); return 0; }
void CTimeCtrl::OnIntervalChanged() { // Restart timer if it's enabled if (GetEnabled() && AmbientUserMode()) { StopTimer(); StartTimer(); } SetModifiedFlag(TRUE); }
void CTimeCtrl::OnEnabledChanged() { if (AmbientUserMode()) { if (GetEnabled()) { if (GetHwnd() != NULL) StartTimer(); } else StopTimer(); } }
STDMETHODIMP CBar::Detach() { if (!m_bStartedToolBars) return NOERROR; HWND hWndParent = GetDockWindow(); if (NULL == hWndParent) return NOERROR; if (AmbientUserMode() && IsWindow(hWndParent)) DragAcceptFiles(hWndParent, FALSE); BOOL bResult; if (m_pMainProc) { bResult = GetGlobals().m_pmapBar->RemoveKey(hWndParent); assert(bResult); SetWindowLong (hWndParent, GWL_WNDPROC, (long)m_pMainProc); m_pMainProc = NULL; } if (m_pMDIClientProc) { if (AmbientUserMode() && IsWindow(m_hWndMDIClient)) DragAcceptFiles(m_hWndMDIClient, FALSE); bResult = GetGlobals().m_pmapBar->RemoveKey((LPVOID)m_hWndMDIClient); assert(bResult); SetWindowLong (m_hWndMDIClient, GWL_WNDPROC, (long)m_pMDIClientProc); m_pMDIClientProc = NULL; } bResult = GetGlobals().m_pmapAccelator->RemoveKey(GetDockWindow()); m_bStartedToolBars = FALSE; return NOERROR; }
void CFRManagerCtrl::Init(void) { if (AmbientUserMode()) { //CClientDC dc(this); //m_pPicCtlHdc=dc.GetSafeHdc(); //m_pPicCtlHdc=GetDlgItem(IDC_PICCTL)->GetDC()->GetSafeHdc(); GetClientRect(&m_pPicCtlRect); facebase.SetFileName(m_recordPath); if (!facebase.Load()) { MessageBox("好友信息加载失败!"); } } }
void CTimeCtrl::OnAmbientPropertyChange(DISPID dispid) { if (dispid == DISPID_AMBIENT_USERMODE) { // Start or stop the timer if (GetEnabled()) { if (AmbientUserMode()) StartTimer(); else StopTimer(); } InvalidateControl(); } }
LRESULT CTesthelpCtrl::OnHelpCommand(UINT_PTR /*wParam*/, LONG_PTR lParam) { LPHELPINFO hi; // If the control is in a running application // we'll just show context help. hi = (LPHELPINFO)lParam; if( (AmbientUserMode()||IsWindow(m_hWnd)) && m_bUseMyHelp ) { if(m_nUsePopupHelp==0) { CString strPath = AfxGetApp()->m_pszHelpFilePath; strPath += _T("::/popups.txt"); HH_POPUP popup; ZeroMemory(&popup, sizeof(popup)); popup.cbStruct = sizeof(HH_POPUP); popup.idString = IDH_WHATISTHISTHING; popup.clrBackground = (COLORREF)-1; //Default popup.clrForeground = (COLORREF)-1; //Default RECT rDefault = {-1,-1,-1,-1}; //Default popup.rcMargins = rDefault; popup.pt = hi->MousePos; ::HtmlHelp((HWND)hi->hItemHandle, strPath, HH_DISPLAY_TEXT_POPUP, (DWORD_PTR)&popup); return TRUE; } else { AfxGetApp()->HtmlHelp(NULL, HH_DISPLAY_TOC); return TRUE; } } return (LONG)Default(); }
STDMETHODIMP CBar::Attach(OLE_HANDLE hWndParentIn) { if (m_bStartedToolBars) return NOERROR; HWND hWndParent = (HWND)hWndParentIn; if (!IsWindow(hWndParent)) hWndParent = GetDockWindow(); else { m_fInPlaceActive = TRUE; m_bUserMode = 1; m_hWndDock = m_hWndParent = hWndParent; // Create an ActiveBar Window CRect rc; GetClientRect(hWndParent, &rc); m_Size = rc.Size(); if (NULL == m_hWnd) CreateInPlaceWindow(0, 0, FALSE); else SetWindowPos(m_hWnd, NULL, rc.left, rc.top, rc.Width(), rc.Height(), SWP_SHOWWINDOW|SWP_NOACTIVATE); } if (!hWndParent) return E_FAIL; if (AmbientUserMode() && IsWindow(hWndParent)) DragAcceptFiles(hWndParent, TRUE); if (GetAmbientProperty(DISPID_AMBIENT_BACKCOLOR, VT_I4, &m_ocAmbientBackColor)) OleTranslateColor(m_ocAmbientBackColor, NULL, &m_crAmbientBackColor); void* pPrevBar; HWND hWndMdi; TCHAR szBuffer[_MAX_PATH]; DWORD dwResult = GetModuleFileName(NULL, szBuffer, 255); if (dwResult > 0 && lstrlen(szBuffer) > 12 && 0 == lstrcmpi(szBuffer + lstrlen(szBuffer) - 12, _T("iexplore.exe"))) m_bIE = TRUE; const int nLen = 15; TCHAR szClassName[nLen]; if (AmbientUserMode()) { hWndMdi = ::GetWindow(hWndParent, GW_CHILD); if (hWndMdi) { MAKE_TCHARPTR_FROMWIDE(szWindowClass, m_bstrWindowClass); GetClassName(hWndMdi, szClassName, nLen); if (0 == lstrcmpi(szClassName, szWindowClass)) { // // Hook into the MDIClient Form // m_eAppType = eMDIForm; m_hWndMDIClient = hWndMdi; IOleControlSite* pControlSite; HRESULT hResult = m_pClientSite->QueryInterface(IID_IOleControlSite, (void**)&pControlSite); if (SUCCEEDED(hResult)) { LPDISPATCH pDispatch; hResult = pControlSite->GetExtendedControl(&pDispatch); pControlSite->Release(); if (SUCCEEDED(hResult)) { VARIANT vWidth; vWidth.vt = VT_I4; vWidth.lVal = 0; hResult = PropertyPut(pDispatch, L"Width", vWidth); pDispatch->Release(); } } if (AmbientUserMode()) DragAcceptFiles(m_hWndMDIClient, TRUE); if (GetGlobals().m_pmapBar->Lookup((LPVOID)m_hWndMDIClient, pPrevBar)) { TRACE2(1, _T("Window handle already entered Bar: %X hWnd: %X\n"), this, m_hWndMDIClient); return NOERROR; } GetGlobals().m_pmapBar->SetAt((LPVOID)m_hWndMDIClient,(LPVOID)this); m_pMDIClientProc = (WNDPROC)GetWindowLong(m_hWndMDIClient, GWL_WNDPROC); SetWindowLong(m_hWndMDIClient, GWL_WNDPROC, (LONG)MDIClientWindowProc); CacheSmButtonSize(); CRect rcWin; ::GetWindowRect(m_hWndMDIClient, &rcWin); m_nNewCustomizedFloatBandCounter = 0; m_ptNewCustomizedFloatBandPos.x = rcWin.left + 16; m_ptNewCustomizedFloatBandPos.y = rcWin.top + 16; } } } else { // // If we are in design mode check if we are on an MDI Form or not // GetClassName(hWndParent, szClassName, nLen); if (0 == lstrcmpi(szClassName, _T("ThunderMDIForm"))) m_eAppType = eMDIForm; } if (eMDIForm == m_eAppType) { // // Check if two activebars are present // if (GetGlobals().m_pmapBar->Lookup((LPVOID)hWndParent, pPrevBar)) { TRACE2(1, _T("Window handle already entered Bar: %X hWnd: %X\n"), this, hWndParent); return NOERROR; } // // Set the map and subclass the window procedure // GetGlobals().m_pmapBar->SetAt((LPVOID)hWndParent,(LPVOID)this); TRACE2(1, _T("Window handle entered Bar: %X hWnd: %X\n"), this, hWndParent); m_pMainProc = (WNDPROC)GetWindowLong(hWndParent, GWL_WNDPROC); SetWindowLong (hWndParent, GWL_WNDPROC, (LONG)FrameWindowProc); } else { if (VARIANT_TRUE == bpV1.m_vbAlignToForm) { m_eAppType = eSDIForm; // // Check if two activebars are present // if (GetGlobals().m_pmapBar->Lookup((LPVOID)hWndParent, pPrevBar)) { TRACE2(1, _T("Window handle already entered Bar: %X hWnd: %X\n"), this, hWndParent); return NOERROR; } // // Set the map and subclass the window procedure // GetGlobals().m_pmapBar->SetAt((LPVOID)hWndParent,(LPVOID)this); TRACE2(1, _T("Window handle entered Bar: %X hWnd: %X\n"), this, hWndParent); m_pMainProc = (WNDPROC)GetWindowLong(hWndParent, GWL_WNDPROC); SetWindowLong (hWndParent, GWL_WNDPROC, (LONG)FormWindowProc); CRect rcClient; if (GetClientRect(hWndParent, &rcClient) && m_pInPlaceSite) m_pInPlaceSite->OnPosRectChange(&rcClient); } else m_eAppType = eClientArea; CRect rcWin; GetWindowRect(hWndParent, &rcWin); m_nNewCustomizedFloatBandCounter = 0; m_ptNewCustomizedFloatBandPos.x = rcWin.left + 64; m_ptNewCustomizedFloatBandPos.y = rcWin.top + 64; } LPVOID pTmp; if (!GetGlobals().m_pmapAccelator->Lookup((LPVOID)hWndParent, (void*&)pTmp)) GetGlobals().m_pmapAccelator->SetAt(hWndParent, (LPVOID)this); m_bStartedToolBars = TRUE; return NOERROR; }