void WXAppBar::SetDockedModeStep1() { // TODO: manage different docking locations on windows APPBARDATA abd; // Set metrics (TOP location only) wxSize proposedSize= DoGetBestSize(); m_X= 0; m_Y= 0; m_Width= GetSystemMetrics(SM_CXSCREEN); m_Height= proposedSize.GetHeight(); // Register appbar abd.cbSize= sizeof(APPBARDATA); abd.hWnd= (HWND) GetHandle(); abd.uCallbackMessage= 12345; //WX_APPBAR_CALLBACK; // TODO: respond to these callback messages SHAppBarMessage (ABM_NEW, &abd); // Set size abd.uEdge= ABE_TOP; abd.rc.left = m_X; abd.rc.top = m_Y; abd.rc.right = m_X + m_Width; abd.rc.bottom = m_Y + m_Height; SHAppBarMessage(ABM_QUERYPOS,&abd); // Correct size if needed m_X= abd.rc.left; m_Y= abd.rc.top; m_Width= abd.rc.right - m_X; // Re-calculate bottom corner abd.rc.bottom = m_Y + m_Height; SHAppBarMessage(ABM_SETPOS, &abd); }
void Nitpick::on_showTaskbarPushbutton_clicked() { #ifdef Q_OS_WIN APPBARDATA abd = { sizeof abd }; UINT uState = (UINT)SHAppBarMessage(ABM_GETSTATE, &abd); LPARAM param = uState & ABS_ALWAYSONTOP; abd.lParam = param; SHAppBarMessage(ABM_SETSTATE, &abd); #endif }
PLUGIN_EXPORT void ExecuteBang(void* data, LPCWSTR args) { Measure* measure = (Measure*)data; APPBARDATA abd = { sizeof abd }; HWND hwnd = FindWindow(L"Shell_traywnd", L""); HWND hwnd2 = FindWindow(L"Shell_SecondaryTrayWnd", L""); if (_wcsicmp(args, L"HIDE") == 0) { if (measure->type == BOTH) { ShowWindow(hwnd, 0); ShowWindow(hwnd2, 0); } else if (measure->type == FIRST) { ShowWindow(hwnd, 0); } else if (measure->type == SECOND) { ShowWindow(hwnd2, 0); } } else if (_wcsicmp(args, L"SHOW") == 0) { if (measure->type == BOTH) { ShowWindow(hwnd, 8); ShowWindow(hwnd2, 8); } else if (measure->type == FIRST) { ShowWindow(hwnd, 8); } else if (measure->type == SECOND) { ShowWindow(hwnd2, 8); } } else if (_wcsicmp(args, L"AUTOHIDE") == 0) { abd.lParam = ABS_AUTOHIDE; SHAppBarMessage(ABM_SETSTATE, &abd); SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd); } else if (_wcsicmp(args, L"ALWAYSSHOW") == 0) { abd.lParam = ABS_ALWAYSONTOP; SHAppBarMessage(ABM_SETSTATE, &abd); SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd); } else RmLogF(measure->rm, LOG_WARNING, L"HideTaskbar: Invalid command: %s", args); }
static void test_appbarget(void) { APPBARDATA abd; HWND hwnd, foregnd, unset_hwnd; UINT_PTR ret; memset(&abd, 0xcc, sizeof(abd)); memset(&unset_hwnd, 0xcc, sizeof(unset_hwnd)); abd.cbSize = sizeof(abd); abd.uEdge = ABE_BOTTOM; hwnd = (HWND)SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd); ok(hwnd == NULL || IsWindow(hwnd), "ret %p which is not a window\n", hwnd); ok(abd.hWnd == unset_hwnd, "hWnd overwritten %p\n",abd.hWnd); if (!pMonitorFromWindow) { win_skip("MonitorFromWindow is not available\n"); } else { /* Presumably one can pass a hwnd with ABM_GETAUTOHIDEBAR to specify a monitor. Pass the foreground window and check */ foregnd = GetForegroundWindow(); if(foregnd) { abd.hWnd = foregnd; hwnd = (HWND)SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd); ok(hwnd == NULL || IsWindow(hwnd), "ret %p which is not a window\n", hwnd); ok(abd.hWnd == foregnd, "hWnd overwritten\n"); if(hwnd) { HMONITOR appbar_mon, foregnd_mon; appbar_mon = pMonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); foregnd_mon = pMonitorFromWindow(foregnd, MONITOR_DEFAULTTONEAREST); ok(appbar_mon == foregnd_mon, "Windows on different monitors\n"); } } } memset(&abd, 0xcc, sizeof(abd)); abd.cbSize = sizeof(abd); ret = SHAppBarMessage(ABM_GETTASKBARPOS, &abd); if(ret) { ok(abd.hWnd == (HWND)0xcccccccc, "hWnd overwritten\n"); ok(abd.uEdge <= ABE_BOTTOM || broken(abd.uEdge == 0xcccccccc), /* Some Win95 and NT4 */ "uEdge not returned\n"); ok(abd.rc.left != 0xcccccccc, "rc not updated\n"); } return; }
static void testwindow_setpos(HWND hwnd) { struct testwindow_info* info = (struct testwindow_info*)GetWindowLongPtrA(hwnd, GWLP_USERDATA); APPBARDATA abd; BOOL ret; ok(info != NULL, "got unexpected ABN_POSCHANGED notification\n"); if (!info || !info->registered) { return; } if (info->to_be_deleted) { win_skip("Some Win95 and NT4 systems send messages to removed taskbars\n"); return; } abd.cbSize = sizeof(abd); abd.hWnd = hwnd; abd.uEdge = info->edge; abd.rc = info->desired_rect; ret = SHAppBarMessage(ABM_QUERYPOS, &abd); ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret); switch (info->edge) { case ABE_BOTTOM: ok(info->desired_rect.top == abd.rc.top, "ABM_QUERYPOS changed top of rect from %i to %i\n", info->desired_rect.top, abd.rc.top); abd.rc.top = abd.rc.bottom - (info->desired_rect.bottom - info->desired_rect.top); break; case ABE_LEFT: ok(info->desired_rect.right == abd.rc.right, "ABM_QUERYPOS changed right of rect from %i to %i\n", info->desired_rect.right, abd.rc.right); abd.rc.right = abd.rc.left + (info->desired_rect.right - info->desired_rect.left); break; case ABE_RIGHT: ok(info->desired_rect.left == abd.rc.left, "ABM_QUERYPOS changed left of rect from %i to %i\n", info->desired_rect.left, abd.rc.left); abd.rc.left = abd.rc.right - (info->desired_rect.right - info->desired_rect.left); break; case ABE_TOP: ok(info->desired_rect.bottom == abd.rc.bottom, "ABM_QUERYPOS changed bottom of rect from %i to %i\n", info->desired_rect.bottom, abd.rc.bottom); abd.rc.bottom = abd.rc.top + (info->desired_rect.bottom - info->desired_rect.top); break; } ret = SHAppBarMessage(ABM_SETPOS, &abd); ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret); info->allocated_rect = abd.rc; MoveWindow(hwnd, abd.rc.left, abd.rc.top, abd.rc.right-abd.rc.left, abd.rc.bottom-abd.rc.top, TRUE); }
static void hippo_platform_impl_get_screen_info(HippoPlatform *platform, HippoRectangle *monitor_rect_p, HippoRectangle *tray_icon_rect_p, HippoOrientation *tray_icon_orientation_p) { APPBARDATA abd; abd.cbSize = sizeof(abd); if (!SHAppBarMessage(ABM_GETTASKBARPOS, &abd)) { g_warning("Failed to get task bar extents"); return; } HippoOrientation orientation; switch (abd.uEdge) { case ABE_BOTTOM: case ABE_TOP: orientation = HIPPO_ORIENTATION_HORIZONTAL; break; case ABE_LEFT: case ABE_RIGHT: orientation = HIPPO_ORIENTATION_VERTICAL; break; default: g_warning("unknown tray icon orientation"); break; } if (tray_icon_orientation_p) *tray_icon_orientation_p = orientation; RECT iconTrayRect; if (!find_icon_tray_rect(&iconTrayRect, orientation)) { // If this starts happening regularly, we can refine // this code to make a better guess at that point. iconTrayRect = abd.rc; } if (tray_icon_rect_p) { tray_icon_rect_p->x = iconTrayRect.left; tray_icon_rect_p->width = iconTrayRect.right - iconTrayRect.left; tray_icon_rect_p->y = iconTrayRect.top; tray_icon_rect_p->height = iconTrayRect.bottom - iconTrayRect.top; } if (monitor_rect_p) { HMONITOR monitor = MonitorFromRect(&iconTrayRect, MONITOR_DEFAULTTONEAREST); MONITORINFO monitorInfo; monitorInfo.cbSize = sizeof(monitorInfo); if (GetMonitorInfo(monitor, &monitorInfo)) { monitor_rect_p->x = monitorInfo.rcWork.left; monitor_rect_p->y = monitorInfo.rcWork.top; monitor_rect_p->width = monitorInfo.rcWork.right - monitorInfo.rcWork.left; monitor_rect_p->height = monitorInfo.rcWork.bottom - monitorInfo.rcWork.top; } else { g_warning("GetMonitorInfo failed"); // Shouldn't happen, don't both with a fallback } } }
UINT appBarMessage(DWORD dwMessage, UINT uEdge=ABE_FLOAT, LPARAM lParam=0, QRect *rc=NULL) { log(L_DEBUG, "AppBar %04X", dwMessage); APPBARDATA abd; abd.cbSize = sizeof(abd); abd.hWnd = pMain->winId(); abd.uCallbackMessage = WM_APPBAR; abd.uEdge = uEdge; if (rc){ abd.rc.left = rc->left(); abd.rc.top = rc->top(); abd.rc.right = rc->right(); abd.rc.bottom = rc->bottom(); }else{ abd.rc.left = 0; abd.rc.top = 0; abd.rc.right = 0; abd.rc.bottom = 0; } abd.lParam = lParam; UINT uRetVal = SHAppBarMessage(dwMessage, &abd); if (rc != NULL) rc->setCoords(abd.rc.left, abd.rc.top, abd.rc.right, abd.rc.bottom); return uRetVal; }
void CCEGLView::centerWindow() { if (! m_hWnd) { return; } RECT rcDesktop, rcWindow; GetWindowRect(GetDesktopWindow(), &rcDesktop); // substract the task bar HWND hTaskBar = FindWindow(TEXT("Shell_TrayWnd"), NULL); if (hTaskBar != NULL) { APPBARDATA abd; abd.cbSize = sizeof(APPBARDATA); abd.hWnd = hTaskBar; SHAppBarMessage(ABM_GETTASKBARPOS, &abd); SubtractRect(&rcDesktop, &rcDesktop, &abd.rc); } GetWindowRect(m_hWnd, &rcWindow); int offsetX = (rcDesktop.right - rcDesktop.left - (rcWindow.right - rcWindow.left)) / 2; offsetX = (offsetX > 0) ? offsetX : rcDesktop.left; int offsetY = (rcDesktop.bottom - rcDesktop.top - (rcWindow.bottom - rcWindow.top)) / 2; offsetY = (offsetY > 0) ? offsetY : rcDesktop.top; SetWindowPos(m_hWnd, 0, offsetX, offsetY, 0, 0, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOZORDER); }
void CAppBar::AppBar_QuerySetPos(UINT uEdge, LPRECT lprc, PAPPBARDATA pabd, BOOL fMove) { int iHeight = 0; int iWidth = 0; // Fill out the APPBARDATA struct and save the edge we're moving to // in the appbar OPTIONS struct. pabd->rc = *lprc; pabd->uEdge = uEdge; m_pOptions->uSide = uEdge; AppBar_QueryPos(&(pabd->rc)); SHAppBarMessage(ABM_SETPOS, pabd); // Tell the system we're moving to this new approved position. if (fMove) { MoveWindow(pabd->hWnd, pabd->rc.left, pabd->rc.top, pabd->rc.right - pabd->rc.left, pabd->rc.bottom - pabd->rc.top, TRUE); } // Save the appbar rect. We use this later when we autohide. If we're // currently hidden, then don't mess with this. if (!m_pOptions->fAutoHide) g_rcAppBar = pabd->rc; }
UINT GetTaskbarPos(HWND hwndTaskbar) { if (hwndTaskbar != NULL) { // See also: Q179908 APPBARDATA abd = {0}; abd.cbSize = sizeof abd; abd.hWnd = hwndTaskbar; SHAppBarMessage(ABM_GETTASKBARPOS, &abd); // SHAppBarMessage may fail to get the rectangle... CRect rcAppBar(abd.rc); if (rcAppBar.IsRectEmpty() || rcAppBar.IsRectNull()) GetWindowRect(hwndTaskbar, &abd.rc); if (abd.rc.top == abd.rc.left && abd.rc.bottom > abd.rc.right) return ABE_LEFT; else if (abd.rc.top == abd.rc.left && abd.rc.bottom < abd.rc.right) return ABE_TOP; else if (abd.rc.top > abd.rc.left) return ABE_BOTTOM; return ABE_RIGHT; } return ABE_BOTTOM; }
BOOL kjm::appBar::regist(HWND hwnd, UINT uCallbackMessage) { m_abd.cbSize = sizeof(m_abd); m_abd.hWnd = hwnd; m_abd.uCallbackMessage = uCallbackMessage; return m_fRegistered = (BOOL)SHAppBarMessage(ABM_NEW, &m_abd); }
void Show_HideTask(bool IsHide) { int nCwdShow = -1; LPARAM lParam; HWND task = FindWindow(_T("Shell_TrayWnd"), NULL); if (IsHide) { lParam = ABS_AUTOHIDE | ABS_ALWAYSONTOP; nCwdShow = SW_HIDE; } else { lParam = ABS_ALWAYSONTOP; nCwdShow = SW_SHOW; } ::ShowWindow(task, nCwdShow); APPBARDATA apBar; memset(&apBar, 0, sizeof(apBar)); apBar.cbSize = sizeof(apBar); apBar.hWnd = task; if (apBar.hWnd != NULL) { apBar.lParam = lParam; SHAppBarMessage(ABM_SETSTATE, &apBar); } }
static void Docking_AdjustPosition(HWND hwnd,RECT *rcDisplay,RECT *rc) { APPBARDATA abd; ZeroMemory(&abd,sizeof(abd)); abd.cbSize=sizeof(abd); abd.hWnd=hwnd; abd.uEdge=docked==DOCKED_LEFT?ABE_LEFT:ABE_RIGHT; abd.rc=*rc; abd.rc.top=rcDisplay->top; abd.rc.bottom=rcDisplay->bottom; if(docked==DOCKED_LEFT) { abd.rc.right=rcDisplay->left+abd.rc.right-abd.rc.left; abd.rc.left=rcDisplay->left; } else { abd.rc.left=rcDisplay->right-(abd.rc.right-abd.rc.left); abd.rc.right=rcDisplay->right; } SHAppBarMessage(ABM_SETPOS,&abd); *rc=abd.rc; { //RECT r; //SetWindowRect(hwnd,&r); //OnMoving(hwnd,&r); } }
void Main_OnActivate(HWND hwnd, UINT state, HWND /* hwndActDeact */, BOOL /* fMinimized */) { APPBARDATA abd; // Always send the activate message to the system abd.cbSize = sizeof(APPBARDATA); abd.hWnd = hwnd; abd.lParam = 0; SHAppBarMessage(ABM_ACTIVATE, &abd); // Now determine if we're getting or losing activation switch (state) { case WA_ACTIVE: case WA_CLICKACTIVE: // If we're gaining activation, make sure we're visible AppBar_UnHide(hwnd); KillTimer(hwnd, IDT_AUTOHIDE); break; case WA_INACTIVE: // If we're losing activation, check to see if we need to autohide. AppBar_Hide(hwnd); break; } }
PLUGIN_EXPORT double Update(void* data) { Measure* measure = (Measure*)data; double currentState = 0.0; APPBARDATA abd = { sizeof abd }; UINT uState = (UINT)SHAppBarMessage(ABM_GETSTATE, &abd); HWND hwnd = FindWindow(L"Shell_traywnd", L""); switch (measure->type) { case BOTH: hwnd = FindWindow(L"Shell_traywnd", L""); break; case FIRST: hwnd = FindWindow(L"Shell_traywnd", L""); break; case SECOND: hwnd = FindWindow(L"Shell_SecondaryTrayWnd", L""); break; } currentState = (uState & ABS_AUTOHIDE) ? 2 : 1; return (!IsWindowVisible(hwnd)) ? -currentState : currentState; }
void SetTaskbarState(int option) { APPBARDATA tbData = APPBARDATA(); tbData.cbSize = sizeof(tbData); tbData.hWnd = FindWindow(TEXT("System_TrayWnd"), 0); tbData.lParam = option; SHAppBarMessage(ABM_SETSTATE, &tbData); }
void WXAppBar::UnSetDockedModeStep2() { // Unregister app bar APPBARDATA abd; abd.cbSize= sizeof(APPBARDATA); abd.hWnd= (HWND) GetHandle(); SHAppBarMessage (ABM_REMOVE, &abd); }
void kjm::appBar::setPos(int uEdge, SIZE size) { m_abd.uEdge = uEdge; m_abd.rc = queryPos(uEdge, size); SHAppBarMessage(ABM_SETPOS, &m_abd); MoveWindow(m_abd.hWnd, m_abd.rc.left, m_abd.rc.top, m_abd.rc.right - m_abd.rc.left, m_abd.rc.bottom - m_abd.rc.top, TRUE); }
static UINT_PTR Docking_Command(HWND hwnd, int cmd) { APPBARDATA abd = {0}; abd.cbSize = sizeof(abd); abd.hWnd = hwnd; abd.uCallbackMessage = WM_DOCKCALLBACK; return SHAppBarMessage(cmd, &abd); }
HWND GetTopmostAutoHideTaskbarForEdge(UINT edge, HMONITOR monitor) { APPBARDATA taskbar_data = { sizeof(APPBARDATA), NULL, 0, edge }; HWND taskbar = reinterpret_cast<HWND>(SHAppBarMessage(ABM_GETAUTOHIDEBAR, &taskbar_data)); return (::IsWindow(taskbar) && (monitor != NULL) && (MonitorFromWindow(taskbar, MONITOR_DEFAULTTONULL) == monitor) && (GetWindowLong(taskbar, GWL_EXSTYLE) & WS_EX_TOPMOST)) ? taskbar : NULL; }
BOOL CAppBar::AppBar_NoAutoHide() { HWND hwndAutoHide; BOOL fSuccess; abd.cbSize = sizeof(APPBARDATA); abd.hWnd = pHandler; abd.uEdge = m_pOptions->uSide; // First let's check to see if we're the appbar attached to the // side of the screen abd.uEdge = m_pOptions->uSide; hwndAutoHide = (HWND) SHAppBarMessage(ABM_GETAUTOHIDEBAR, &abd); if (hwndAutoHide != pHandler) { // DebugMsg(TEXT("ERROR: We're not hidden currently\r\n")); return (FALSE); } // We can autohide or stop autohide on this edge. Set the autohide style. abd.lParam = FALSE; fSuccess = (BOOL) SHAppBarMessage(ABM_SETAUTOHIDEBAR, &abd); if (!fSuccess) { // DebugMsg(TEXT("ERROR: Error trying to set autohidebar.\r\n")); // ErrorHandler(); return (FALSE); } else { // Need to change the appbar to get the screen desktop space // back. Also need to reattach the appbar to that edge of the // screen. m_pOptions->fAutoHide = FALSE; m_pOptions->cxWidth = g_cxWidth; m_pOptions->cyHeight = g_cyHeight; AppBar_SetSide(m_pOptions->uSide); } return (TRUE); }
static void GetTrayWndRect(LPRECT lpTrayRect) { APPBARDATA appBarData; HWND hShellTrayWnd=FindWindowEx(NULL,NULL,TEXT("Shell_TrayWnd"),NULL); if(hShellTrayWnd) { HWND hTrayNotifyWnd=FindWindowEx(hShellTrayWnd,NULL,TEXT("TrayNotifyWnd"),NULL); if(hTrayNotifyWnd) { GetWindowRect(hTrayNotifyWnd,lpTrayRect); return; } } appBarData.cbSize=sizeof(appBarData); if(SHAppBarMessage(ABM_GETTASKBARPOS,&appBarData)) { switch(appBarData.uEdge) { case ABE_LEFT: case ABE_RIGHT: lpTrayRect->top=appBarData.rc.bottom-100; lpTrayRect->bottom=appBarData.rc.bottom-16; lpTrayRect->left=appBarData.rc.left; lpTrayRect->right=appBarData.rc.right; break; case ABE_TOP: case ABE_BOTTOM: lpTrayRect->top=appBarData.rc.top; lpTrayRect->bottom=appBarData.rc.bottom; lpTrayRect->left=appBarData.rc.right-100; lpTrayRect->right=appBarData.rc.right-16; break; } return; } hShellTrayWnd=FindWindowEx(NULL,NULL,TEXT("Shell_TrayWnd"),NULL); if(hShellTrayWnd) { GetWindowRect(hShellTrayWnd,lpTrayRect); if(lpTrayRect->right-lpTrayRect->left>DEFAULT_RECT_WIDTH) lpTrayRect->left=lpTrayRect->right-DEFAULT_RECT_WIDTH; if(lpTrayRect->bottom-lpTrayRect->top>DEFAULT_RECT_HEIGHT) lpTrayRect->top=lpTrayRect->bottom-DEFAULT_RECT_HEIGHT; return; } SystemParametersInfo(SPI_GETWORKAREA,0,lpTrayRect,0); lpTrayRect->left=lpTrayRect->right-DEFAULT_RECT_WIDTH; lpTrayRect->top=lpTrayRect->bottom-DEFAULT_RECT_HEIGHT; }
BOOL CAppBar::AppBar_UnRegister() { abd.cbSize = sizeof(APPBARDATA); abd.hWnd = pHandler; g_fAppRegistered = !SHAppBarMessage(ABM_REMOVE, &abd); return !g_fAppRegistered; }
BOOL CNotifyWindow::Create(char *Subject, char *Subtext, char *Text) { DWORD dwExStyle=WS_EX_TOOLWINDOW | WS_EX_TOPMOST; CRect rcPos(0,0,0,0); if(!WindowBase::Create(NULL,rcPos,"",WS_POPUP,dwExStyle)) return FALSE; m_Image = new CxImage(); _LoadIconFromResource(m_Image, "PNG", CXIMAGE_FORMAT_PNG, IDB_NOTIFYWINDOWBACK); HDC hdc; long h1, h2; hdc = ::GetDC(NULL); h1 = -MulDiv(12, GetDeviceCaps(hdc, LOGPIXELSY), 72); h2 = -MulDiv(9, GetDeviceCaps(hdc, LOGPIXELSY), 72); ::ReleaseDC(NULL, hdc); m_SubjectFont = CreateFont(h1, 0, 0, 0, FW_BOLD, FALSE, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, "Arial"); m_TextFont = CreateFont(h2, 0, 0, 0, FW_NORMAL, FALSE, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, "Tahoma"); m_Subject = new Buffer(); m_Subject->Append(Subject); m_Text = new Buffer(); m_Text->Append(Text); m_Subtext = new Buffer(); if (*Subtext) { m_Subtext->Append("("); m_Subtext->Append(Subtext); m_Subtext->Append(")"); } APPBARDATA abd; memset(&abd, 0, sizeof(APPBARDATA)); abd.cbSize = sizeof(APPBARDATA); SHAppBarMessage(ABM_GETTASKBARPOS, &abd); ::GetWindowRect(GetDesktopWindow(), &m_Rect); if (abd.uEdge == ABE_BOTTOM) m_Rect.bottom -= (abd.rc.bottom - abd.rc.top); if (abd.uEdge == ABE_RIGHT) m_Rect.right -= (abd.rc.right - abd.rc.left); m_Rect.top = m_Rect.bottom - m_Image->GetHeight(); m_Rect.left = m_Rect.right - m_Image->GetWidth(); memcpy(&m_ShowRect, &m_Rect, sizeof(RECT)); m_ShowRect.top = m_Rect.bottom; SetWindowPos(NULL, &m_ShowRect, SWP_SHOWWINDOW | SWP_NOACTIVATE); SetTimer(1, 100); return TRUE; }
CRect CCherryNotificationDialog::GetAnchorRect(UINT nWidth, UINT nHeight) { CRect rect; APPBARDATA appBarData; appBarData.cbSize = sizeof(APPBARDATA); if (!SHAppBarMessage(ABM_GETTASKBARPOS, &appBarData)) return rect; // TASKBAR 가 위치한 모니터의 핸들 얻어옴 HMONITOR hMonitor = MonitorFromRect(&appBarData.rc, MONITOR_DEFAULTTOPRIMARY); MONITORINFO monitorInfo; monitorInfo.cbSize = sizeof(MONITORINFO); GetMonitorInfo(hMonitor, &monitorInfo); CRect workRect(monitorInfo.rcWork); CPoint point; switch (appBarData.uEdge) { case ABE_LEFT: rect.SetRect( appBarData.rc.right, appBarData.rc.bottom - SCROLLBAR_WIDTH - nHeight, appBarData.rc.right + nWidth, appBarData.rc.bottom - SCROLLBAR_WIDTH); break; case ABE_TOP: rect.SetRect( appBarData.rc.right - SCROLLBAR_WIDTH - nWidth, appBarData.rc.bottom, appBarData.rc.right - SCROLLBAR_WIDTH, appBarData.rc.bottom + nHeight); break; case ABE_RIGHT: rect.SetRect( appBarData.rc.left - nWidth, appBarData.rc.bottom - SCROLLBAR_WIDTH - nHeight, appBarData.rc.left, appBarData.rc.bottom - SCROLLBAR_WIDTH); break; case ABE_BOTTOM: rect.SetRect( appBarData.rc.right - SCROLLBAR_WIDTH - nWidth, appBarData.rc.top - nHeight, appBarData.rc.right - SCROLLBAR_WIDTH, appBarData.rc.top); break; } return rect; }
static void Docking_PosCommand(HWND hwnd, LPRECT rc, bool query) { APPBARDATA abd = {0}; abd.cbSize = sizeof(abd); abd.hWnd = hwnd; abd.uEdge = docked == DOCKED_LEFT ? ABE_LEFT : ABE_RIGHT; abd.rc = *rc; SHAppBarMessage(query ? ABM_QUERYPOS : ABM_SETPOS, &abd); *rc = abd.rc; }