-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappbarwidget.cpp
More file actions
38 lines (29 loc) · 855 Bytes
/
appbarwidget.cpp
File metadata and controls
38 lines (29 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "appbarwidget.h"
//QLibrary *AppDock::shellLib;
AppBar::AppBar(QWidget *parent) : QWidget(parent)
{
m_hwnd = (HWND)winId();
memset(&m_abd, 0, sizeof(APPBARDATA));
m_abd.cbSize = sizeof(APPBARDATA);
m_abd.hWnd = m_hwnd;
}
void AppBar::registerAppBar()
{
m_abd.uCallbackMessage = RegisterWindowMessage(L"AppBarMessage");
SHAppBarMessage(ABM_NEW, &m_abd);
//设置应用栏位置和大小
m_abd.uEdge = ABE_TOP; // 顶部
m_abd.rc = {0, 0, GetSystemMetrics(SM_CXSCREEN), 40}; // 高度40像素
SHAppBarMessage(ABM_SETPOS, &m_abd);
setGeometry(m_abd.rc.left, m_abd.rc.top,
m_abd.rc.right - m_abd.rc.left,
m_abd.rc.bottom - m_abd.rc.top);
}
void AppBar::unregisterAppBar()
{
SHAppBarMessage(ABM_REMOVE, &m_abd);
}
AppBar::~AppBar()
{
unregisterAppBar();
}