How to use VirtualDesktopManager interface?

358 Views Asked by At

I'm trying to find out if a window belongs to the current virtual desktop.

I found the VirtualDesktopManager class form the winapi, but even though it is supposed to be in the "shobjidl.h" header according to here, when I compile the code it throws this error:

85:5: error: 'VirtualDesktopManager' was not declared in this scope

important piece of my code:


    #include <shobjidl.h>

    ...

    BOOL is_on_current_desktop = FALSE;
    VirtualDesktopManager g_pvdm;
    g_pvdm.IsWindowOnCurrentVirtualDesktop(hwnd, &is_on_current_desktop);  // hwnd is a window handle acquired previously
    g_pvdm.Release();

How could I make this work?

1

There are 1 best solutions below

1
On BEST ANSWER

Apparently this interface was not included in the "shobjidl.h" header in mingw64 which I was using, running it in Visual Studio it finds it. So the issue was in the header.