CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14
  1. #1
    Join Date
    Jun 2015
    Posts
    5

    Getting IFileDialog to work in VC++ 2005

    I'm trying to get at these newer libraries that seem to be available as early as VC++ 2005, like IFileDialog. Unfortunately, even when I #include <Shobjidl.h>, I get told that IFileDialog isn't defined. I assume I don't have it yet. How do I get it?
    Does it matter that I'm running WinXP?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Getting IFileDialog to work in VC++ 2005

    As stated in MSDN
    Minimum supported client is Windows*Vista [desktop apps only]
    See https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx
    Victor Nijegorodov

  3. #3
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,241

    Re: Getting IFileDialog to work in VC++ 2005

    Quote Originally Posted by DeptOfMeteors View Post
    I'm trying to get at these newer libraries that seem to be available as early as VC++ 2005, like IFileDialog. Unfortunately, even when I #include <Shobjidl.h>, I get told that IFileDialog isn't defined. I assume I don't have it yet.
    Don't just assume, verify!
    If cannot find IFileDialog in Shobjidl.h install a newer SDK.

    Quote Originally Posted by DeptOfMeteors
    How do I get it?
    Pretty easy, from Microsoft Download Center: http://www.microsoft.com/en-us/downl....aspx?id=14477.

    Quote Originally Posted by DeptOfMeteors
    Does it matter that I'm running WinXP?
    Yes, it does. IFileDialog is supported on Windows Vista/Server 2008 and newer systems (as already Victor pointed).
    Click https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx and don't forget to read Requirements in the bottom of the page.
    Last edited by ovidiucucu; June 21st, 2015 at 03:20 AM.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  4. #4
    Join Date
    Jun 2015
    Posts
    5

    Re: Getting IFileDialog to work in VC++ 2005

    So it sounds like what you're telling me is that I'm paralysed until I upgrade.
    The reason I wanted that class is I want a directory browser, which the old CFileDialog didn't afford. Is there an alternative for XP?

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Getting IFileDialog to work in VC++ 2005

    Quote Originally Posted by DeptOfMeteors View Post
    So it sounds like what you're telling me is that I'm paralysed until I upgrade.
    Not sure what you mean by "paralysed." The said functionality is implemented in Windows Vista+. So you can (most probably) program it in Windows XP alright, but you cannot test is there, as it just does not exist in XP (well, you cannot test daddy's Mersedes features while sitting in mom's Chevy, right? ). A very common situation for supporting a family of OSs, I would say.

    In case you're not willing to upgrade, you always can install another Windows version in a virtualization system like Virtual Box or VMware and test your app there. Afraid, you have to buy that other Windows version anyway because of legal matters, or maybe you download a test-purpose-only OS image from MS. Read the license terms to see if it allows what you want.

    The reason I wanted that class is I want a directory browser, which the old CFileDialog didn't afford. Is there an alternative for XP?
    Can you imagine what installing a piece of Windows Vista into XP would look like? If you want to make use of Windows Vista function, you need Windows Vista or any other Windows version compatible with the function.
    Last edited by Igor Vartanov; June 22nd, 2015 at 11:00 AM.
    Best regards,
    Igor

  6. #6
    Join Date
    Jun 2015
    Posts
    5

    Re: Getting IFileDialog to work in VC++ 2005

    Quote Originally Posted by Igor Vartanov View Post
    Can you imagine what installing a piece of Windows Vista into XP would look like? If you want to make use of Windows Vista function, you need Windows Vista or any other Windows version compatible with the function.
    All I'm imagining is code from an XP-compatible SDK that can browse directories in the same way I can already browse files. It's not hard to imagine Win3.11 having such a thing, but I'd settle for it realized in XP.

  7. #7
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Getting IFileDialog to work in VC++ 2005

    Okay, what you have is:

    IFileDialog interface

    Requirements

    Minimum supported client
    Windows Vista [desktop apps only]
    Minimum supported server Windows Server 2008 [desktop apps only]
    Header Shobjidl.h
    IDL Shobjidl.idl
    Best regards,
    Igor

  8. #8
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Getting IFileDialog to work in VC++ 2005

    Quote Originally Posted by DeptOfMeteors View Post
    So it sounds like what you're telling me is that I'm paralysed until I upgrade.
    The reason I wanted that class is I want a directory browser, which the old CFileDialog didn't afford. Is there an alternative for XP?
    For a directory browse dialog, what you need is SHBrowseForFolder api (available in XP and newer).

  9. #9
    Join Date
    Jun 2015
    Posts
    5

    Re: Getting IFileDialog to work in VC++ 2005

    Quote Originally Posted by Arjay View Post
    For a directory browse dialog, what you need is SHBrowseForFolder api (available in XP and newer).
    Ok, unfortunately, when I try that (after "#include <Shlobj.h>") it can't find that function. From there I installed the SDK given above, but it still doesn't work.

  10. #10
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,923

    Re: Getting IFileDialog to work in VC++ 2005

    What error are you receiving? Are you receiving a compile or link error? ShBrowseForFolder requires shell32.lib.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  11. #11
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Getting IFileDialog to work in VC++ 2005

    Quote Originally Posted by DeptOfMeteors View Post
    Ok, unfortunately, when I try that (after "#include <Shlobj.h>") it can't find that function.
    Strange! I use SHBrowseForFolder since the Windows 98/NT and never had any problem!

    Quote Originally Posted by DeptOfMeteors View Post
    From there I installed the SDK given above, but it still doesn't work.
    You don't need any additional SDK to use SHBrowseForFolder.
    Victor Nijegorodov

  12. #12
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: Getting IFileDialog to work in VC++ 2005

    Quote Originally Posted by Arjay View Post
    For a directory browse dialog, what you need is SHBrowseForFolder api (available in XP and newer).
    I'm pretty sure this function even existed back in Win95

  13. #13
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Getting IFileDialog to work in VC++ 2005

    Quote Originally Posted by OReubens View Post
    I'm pretty sure this function even existed back in Win95
    Exactly! From my MSDN from october 2000:
    Requirements
    Version 4.00 and later of Shell32.dll
    and Version 4.00 means:
    Microsoft® Windows® 95/Windows NT® 4.0.
    Victor Nijegorodov

  14. #14
    Join Date
    Jun 2015
    Posts
    5

    Re: Getting IFileDialog to work in VC++ 2005

    Oops! It looks like I spelled it wrong. It works now, thanks.
    Although, now that I've started using it, I'm sort of wishing I hadn't figured it out.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured