本文整理汇总了C++中SHAppBarMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ SHAppBarMessage函数的具体用法?C++ SHAppBarMessage怎么用?C++ SHAppBarMessage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SHAppBarMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoGetBestSize
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);
}
示例2: SHAppBarMessage
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
}
示例3: ExecuteBang
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);
}
示例4: test_appbarget
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;
}
示例5: testwindow_setpos
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);
}
示例6: hippo_platform_impl_get_screen_info
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
}
}
}
示例7: GetWindowRect
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);
}
示例8: AppBar_QueryPos
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;
}
示例9: GetTaskbarPos
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;
}
示例10: sizeof
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);
}
示例11: Show_HideTask
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);
}
}
示例12: Docking_AdjustPosition
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);
}
}
示例13: Main_OnActivate
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;
}
}
示例14: Update
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;
}
示例15: SetTaskbarState
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);
}