缩略图工具栏按钮

发布于 2024-08-05 04:28:24 字数 1241 浏览 4 评论 0原文

今天我有另一个具体问题,关于 Windows 7 中的一项新功能,称为缩略图工具栏或 Aero Peek 工具栏(如果有人可能喜欢这样称呼它)。我已经能够为我的应用程序创建一组新的工具栏按钮,每个按钮都有其独特的图标和行为,但我无法向新按钮添加功能,因为新的 THUMBUTTON 结构没有为按钮对象。

这是一个代码片段,向您展示我用来创建按钮的内容:

ITaskbarList4* pitskbar;
HRESULT hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pitskbar));


HWND hwnd = AfxGetMainWnd()->GetSafeHwnd();

DWORD dwMask = THB_BITMAP | THB_FLAGS;

THUMBBUTTON thbButtons[3];
thbButtons[0].dwMask = (THUMBBUTTONMASK)dwMask;
thbButtons[0].iId = 0;
thbButtons[0].iBitmap = 0;
thbButtons[0].dwFlags = THBF_ENABLED;

thbButtons[1].dwMask = (THUMBBUTTONMASK)dwMask;
thbButtons[1].iId = 1;

    .
    .
   <More Button Params>
    .
    .

CImageList m_imglst;
m_imglst.Create(16, 16, ILC_COLOR16, 0, 4);

HICON icon = (HICON)::LoadImage(theApp.m_hInstance, MAKEINTRESOURCE(IDI_ICON_ON), IMAGE_ICON, 16, 16, LR_SHARED);
m_imglst.Add(icon);

    .
    .
   <More Images>
    .
    .

hr = pitskbar->ThumbBarSetImageList(hwnd, m_imglst);

if (SUCCEEDED(hr))
{

    hr = pitskbar->ThumbBarAddButtons(hwnd, ARRAYSIZE(thbButtons), thbButtons);
}



pitskbar->Release();

只要是在问题的上下文中,我将不胜感激任何有用的答案。

问候

Today I have another specific question about a new feature in windows 7 called the thumbnail toolbar or the Aero Peek Toolbar if some might like to call it that way. I have been able to create a new set of toolbar buttons for my application each button with its unique icon and behavior But I haven't been able to add functionality to the new buttons as the new THUMBUTTON structure does not specify any action parameter for a button object.

Here is a code snippet to show you what I've used to create the buttons:

ITaskbarList4* pitskbar;
HRESULT hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pitskbar));


HWND hwnd = AfxGetMainWnd()->GetSafeHwnd();

DWORD dwMask = THB_BITMAP | THB_FLAGS;

THUMBBUTTON thbButtons[3];
thbButtons[0].dwMask = (THUMBBUTTONMASK)dwMask;
thbButtons[0].iId = 0;
thbButtons[0].iBitmap = 0;
thbButtons[0].dwFlags = THBF_ENABLED;

thbButtons[1].dwMask = (THUMBBUTTONMASK)dwMask;
thbButtons[1].iId = 1;

    .
    .
   <More Button Params>
    .
    .

CImageList m_imglst;
m_imglst.Create(16, 16, ILC_COLOR16, 0, 4);

HICON icon = (HICON)::LoadImage(theApp.m_hInstance, MAKEINTRESOURCE(IDI_ICON_ON), IMAGE_ICON, 16, 16, LR_SHARED);
m_imglst.Add(icon);

    .
    .
   <More Images>
    .
    .

hr = pitskbar->ThumbBarSetImageList(hwnd, m_imglst);

if (SUCCEEDED(hr))
{

    hr = pitskbar->ThumbBarAddButtons(hwnd, ARRAYSIZE(thbButtons), thbButtons);
}



pitskbar->Release();

I would appreciate any helpful answer as long as it is in the question's context.

Regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

渡你暖光 2024-08-12 04:28:24

这就是您要找的东西?
“当单击缩略图工具栏中的按钮时,与该缩略图关联的窗口将发送一条 WM_COMMAND 消息,其 wParam 参数的 HIWORD 设置为 THBN_CLICKED,LOWORD 设置为按钮 ID。”
来源: http://msdn.microsoft.com/en -us/library/dd391703(VS.85).aspx

this is what you looking for?
"When a button in a thumbnail toolbar is clicked, the window associated with that thumbnail is sent a WM_COMMAND message with the HIWORD of its wParam parameter set to THBN_CLICKED and the LOWORD to the button ID."
source: http://msdn.microsoft.com/en-us/library/dd391703(VS.85).aspx

桜花祭 2024-08-12 04:28:24

Here is a article on how to do it using the managed wrappers... by having a look at the managed wrapper, you might more easily see how to do it using C++...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文