How to create a window that behaves like taskbar?

432 Views Asked by At

I want to ask how to create a window that behaves like taskbar (shell_traywnd)? In a windows app called Enable Viacam (camera mouse for disabled people) I saw that the app creates a taskbar-like window on the top of the screen (see the image below) which pulls all other windows underneath it. Enable_Viacam's window (top of screen)

I used Winspector software to examine this Enable Viacam's window to see its WS_/WS_EX_ properties so that I would try emulate it, but calling CreateWindowEx with those properties didn't give me the wanted result..

Here's my attempt (message loop & window procedure not shown here)

    hwnd = CreateWindowEx(
    WS_EX_TOOLWINDOW | WS_EX_TOPMOST | WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_CONTROLPARENT,
    "#32770","Window",
    WS_OVERLAPPEDWINDOW | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_BORDER | DS_3DLOOK,
    0, /* x */
    0, /* y */
    GetSystemMetrics(SM_CXSCREEN), /* width */
    50, /* height */
    NULL,NULL,hInstance,NULL);

Any ideas greatly appreciated, thank you!

1

There are 1 best solutions below

0
On

Apparently this window type is called an appbar I created window with style WS_EX_TOOLWINDOW and WS_POPUP and followed that MSDN link

My code now is

APPBARDATA abd = {0};
abd.cbSize = sizeof(APPBARDATA);
abd.hWnd = hwnd;
abd.uCallbackMessage = 888;

SHAppBarMessage(ABM_NEW, &abd);

abd.uEdge = ABE_TOP;
abd.rc.left = 0;
abd.rc.right = GetSystemMetrics(SM_CXSCREEN);
abd.rc.top = 0;
abd.rc.bottom = height;
SHAppBarMessage(ABM_QUERYPOS, &abd);

abd.rc.bottom = abd.rc.top + height;
SHAppBarMessage(ABM_SETPOS, &abd);

Have fun coding guys