views:

229

answers:

2

Hi everybody

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

A: 

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++...

rudigrobler
+1  A: 

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%28VS.85%29.aspx

Jk