Trying to use SHCreateShellItem, having #include issues

Posted by dreamlax on Stack Overflow See other posts from Stack Overflow or by dreamlax
Published on 2010-03-29T07:49:58Z Indexed on 2010/03/29 7:53 UTC
Read the original article Hit count: 301

Filed under:
|
|

There is a function in called SHCreateShellItem which is declared in <shlobj.h>, but it has been #ifdef'd out based on whether or not _WIN32_IE is greater than or equal to 0x601 (if it is, then the declaration is present). However, even when I define _WIN32_IE to 0x601 before I include <shlobj.h>, MSVC++ still complains that SHCreateShellItem is undeclared.

For example, I cannot get the following to compile:

#define _WIN32_IE 0x601
#include <shlobj.h>

int someFunction (LPITEMIDLIST parent, LPITEMIDLIST child)
{
    HRESULT result;
    IShellItem *shellObj;

    result = SHCreateShellItem (parent, NULL, child, &shellObj);
    if (SUCCEEDED(result))
    {
        // do stuff
    }

    return SUCCEEDED(result);
}

Do I need to define _WIN32_IE in a different way?

© Stack Overflow or respective owner

Related posts about win32

Related posts about Windows