Windows 7, ITaskbarList3 implementation

Hello all.

I'm trying to add the style of a progressbar win7 application.

Follow the code; I'm using codeblocks with the gcc compiler 4.7.2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <windows.h>
#include <shobjidl.h>

using namespace std;

const IID my_IID_ITaskbarList3 = { 0xea1afb91, 0x9e28, 0x4b86, { 0x90, 0xe9, 0x9e, 0x9f, 0x8a, 0x5e, 0xef, 0xaf } };
const IID my_CLSID_TaskbarList = { 0x56fdf344, 0xfd6d, 0x11d0, { 0x95, 0x8a, 0x00, 0x60, 0x97, 0xc9, 0xa0, 0x90 } };

static ITaskbarList3* ptbl = NULL;

int main()
{
    HRESULT hr;
    hr = CoCreateInstance(my_CLSID_TaskbarList, NULL, CLSCTX_ALL, my_IID_ITaskbarList3, (LPVOID*)&ptbl);
    cout << "CoCreateInstance: " << (hr == S_OK) << endl;
    return 0;
}

There is nothing instantiated. Am I doing something wrong?
I have to link some lib?
I forgot some header?
I forgot to call CoInitialize().
Getting well:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <windows.h>
#include <shobjidl.h>

using namespace std;

const IID my_IID_ITaskbarList3 = { 0xea1afb91, 0x9e28, 0x4b86, { 0x90, 0xe9, 0x9e, 0x9f, 0x8a, 0x5e, 0xef, 0xaf } };
const IID my_CLSID_TaskbarList = { 0x56fdf344, 0xfd6d, 0x11d0, { 0x95, 0x8a, 0x00, 0x60, 0x97, 0xc9, 0xa0, 0x90 } };

static ITaskbarList3* ptbl = NULL;

int main()
{
    CoInitialize(NULL); // <- darned
    HRESULT hr;
    hr = CoCreateInstance(my_CLSID_TaskbarList, NULL, CLSCTX_ALL, my_IID_ITaskbarList3, (LPVOID*)&ptbl);
    cout << "CoCreateInstance: " << (hr == S_OK) << endl;
    return 0;
}
Topic archived. No new replies allowed.