SHGetKnownFolderPath problem

This is a discussion on SHGetKnownFolderPath problem within the Windows Programming forums, part of the Platform Specific Boards category; Hi, i am developing an application for Windows Vista/XP with Visual Studio 2005 Express Edition under Windows Xp with the ...

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    42

    SHGetKnownFolderPath problem

    Hi,

    i am developing an application for Windows Vista/XP with Visual Studio 2005 Express Edition under Windows Xp with the Microsoft platform SDK v6.0 installed.

    When i start debug the application under windows xp i get error message before even the application gui is loaded:

    "Can't find DLL entry point SHGetFolderPathA in shell32.dll "

    Does that mean that i can't develop Vista application under Windows XP ?

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    SHGetKnownFolderPath is only supported by vista - you cannot use it on XP, so if you plan to write application for both OSes - use SHGetFolderPath call when on XP
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    42
    Actually before the call to ( SHGetKnownFolderPath ) or ( SHGetFolderPath ) i am checking the OS, if it is Windows Xp then call ( SHGetFolderPath ), if it is Windows Vista then call ( SHGetKnownFolderPath ).

    I placed a breakpoint before the call to ( SHGetFolderPath ) or to ( SHGetKnownFolderPath ), but the problem is that the previous error occures even before executing the code above!

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,768
    You can't call any Vista API on XP at all. If you even include them in the code, the program won't start! You need to make a Vista-only EXE.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    42
    Quote Originally Posted by Elysia View Post
    You can't call any Vista API on XP at all. If you even include them in the code, the program won't start! You need to make a Vista-only EXE.
    Do you mean that i should recompile the project under Windows Vista?

  6. #6
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,768
    Yep, and provide a version for XP and below, too. You can use defines.
    Vista version will only run on Vista.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    I assume you're looking for your executable's residing folder? I always use the below since it works from win98 to vista. Deprecation doesn't concern me, so long as the code works. I don't even know how much one should bend to vista, especially considering ms is working on another platform release in early 09'.

    Code:
     char Path[MAX_PATH];    /* GetCurDirect */
     GetModuleFileName(NULL, Path, MAX_PATH);
     getDrivePath=Path; /* string */
     string::size_type loc= getDrivePath.find_last_of("\\");
     getDrivePath.erase(loc+1);   /* Retain full pathway  */

  8. #8
    Registered User
    Join Date
    Apr 2007
    Posts
    137
    Quote Originally Posted by Elysia View Post
    If you even include them in the code, the program won't start! You need to make a Vista-only EXE.
    Nonsense.
    You just have to call dynamically the apis.
    It has always been like that for 13 years with 9x-NT

  9. #9
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,768
    Dynamic works, static doesn't. That's the thing.
    But dynamic is trickier to use.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Elysia View Post
    Dynamic works, static doesn't. That's the thing.
    But dynamic is trickier to use.
    It is indeed a bit trickier, but the since you still have to deal with the two different variants of code, it's probably not much harder to use the dynamic version than it is to produce two different binaries and deal with the consequences of that.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  11. #11
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    Elysia is correct. It's a Vista only function. The minimum OS requirement as indicated in this link is Windows Vista.

    Also, this link indicates that it it's not available in XP
    Last edited by BobS0327; 04-05-2008 at 07:54 PM.

  12. #12
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,768
    Argh. Once again, Microsoft and their stupid API. Why the heaps of trouble to install a game?
    Just provide one API, InstallGame or something that they call with the name and some details, and poof, finished!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 04:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21