Page 1 of 1

Shell common controls post windows XP

Posted: 26 Nov 2013, 17:58
by tseiler
Inside of CompilerSettings.h there is code that seems to force version 6 of the shell common controls.

I want the newer windows vista open folder dialog to show up. It has other features (such as favorites) that I would want the user to have.

I had trouble with various compilation issues until I defined _WIN32_WINNT to 0x0600 from #define _WIN32_WINNT 0x0501

But now I have another compiler error that says IStream is already defined. Which is defined inside of objidlbase.h

Any ideas how I can get the new common controls dialog to work with Noesis?

The goal is to give the user the ability to select a directory.

Re: Shell common controls post windows XP

Posted: 26 Nov 2013, 20:16
by tseiler
ok. I think I figured it out.

Part of the problem was that, in my cpp file, I had the following:
using namespace Noesis;
using namespace Noesis::Core;
using namespace Noesis::Gui;

I removed them, and then added
#define _WIN32_WINNT 0x0600 in the cpp file.

This was actually two separate issues. One is because IStream was defined by Noesis and also the shell common dialog stuff which resulted in namespace clashes. The other issue was because it couldn't find the GUID for the CLSID_FileOpenDialog because it was #ifdef ed away by the _WIN32_WINNT being 0x0501.

Re: Shell common controls post windows XP

Posted: 26 Nov 2013, 20:39
by jsantos
Hi,

Our code shouldn't be publicly exporting those defines to your code. We should fix it by using the macro NS_BUILD, for example, in CompilerSettings.h:
#ifdef NS_BUILD

    // Force using version 6 of the shell common controls
    #pragma comment(linker, \
        "\"/manifestdependency:type='Win32' "\
        "name='Microsoft.Windows.Common-Controls' "\
        "version='6.0.0.0' "\
        "processorArchitecture='*' "\
        "publicKeyToken='6595b64144ccf1df' "\
        "language='*'\"")

    #ifndef STRICT
        #define STRICT
    #endif

    #ifndef NOMINMAX
        #define NOMINMAX
    #endif

    #ifndef WIN32_LEAN_AND_MEAN
        #define WIN32_LEAN_AND_MEAN
    #endif
    
    #ifndef VC_EXTRALEAN
        #define VC_EXTRALEAN
    #endif

    #ifndef _WIN32_WINNT
        #define _WIN32_WINNT 0x0501
    #endif

    #ifndef PATH_MAX
        #define PATH_MAX 260
    #endif

#endif
That way we don't pollute your program. Could you test if this works for you?

Re: Shell common controls post windows XP

Posted: 02 Dec 2013, 22:46
by tseiler
That solution worked.
I had to move the #pragma comment down a few lines to group it with the others.

Re: Shell common controls post windows XP

Posted: 03 Dec 2013, 16:40
by jsantos
yes, we did a similar thing here. It will be incorporated in the next version.
Thanks!