Thread: Shell functions on Win XP

  1. #1
    Android geek@02's Avatar
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    470

    Shell functions on Win XP

    Hi.
    I've got a book that teaches how to program for Windows 2000 but currently I'm using Windows XP to learn programming. In the "PIDL functions" section of the book under "Shell functions", it's got some code examples that uses Shell functions like SHGetMalloc(), SHGetFolderLocation(). I get errors when compiling thoes codes saying that it doesn't recognize above functions. Is this because I'm using XP so I have to change the code to suit XP?
    Thanks.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Apparently SHGetMalloc is no longer supported; alternative functions are linked to on that msdn page. SHGetFolderLocation should be ok. You are probably either failing to include the proper header, define a required constants or link with a required library. It would be helpful if you could post the exact compiler error(s) - if there aren't too many of them - and the compiler you are using.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Android geek@02's Avatar
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    470
    There was a problem with SHGetFolderLocation(). I tested it again with SHGetSpecialFolderLocation(), and the error went away. But I'm currently not sure whether it's ok to use SHGetSpecialFolderLocation() instead SHGetFolderLocation().

    Also the code got this StrRetToStr() function, which caused,

    error C2039: 'StrRetToStr' : is not a member of '`global namespace''

    The headers seems right. Do you know what's the wrong?
    (I'm using VC++)
    Thanks.

  4. #4
    Android geek@02's Avatar
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    470
    Sorry, another problem in the code.
    The code uses CSIDL values to identify folders. It uses values: CSIDL_PROGRAM_FILES and CSIDL_SYSTEM, which caused,

    error C2065: 'CSIDL_SYSTEM' : undeclared identifier
    error C2065: 'CSIDL_PROGRAM_FILES' : undeclared identifier

    But CSIDL_INTERNET_CACHE and CSIDL_BITBUCKET works fine.
    ?

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    StrRetToStr()
    See down in "Function Information"...it tells you what header to include.
    Also, based on the "Minimum operating systems" required, you'll need the following #define's to hold true:
    _WIN32_WINNT>=0x0500
    _WIN32_IE>=0x0500

    Read more here: Using the Windows Headers

    gg

  6. #6
    Android geek@02's Avatar
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    470
    Thanks. I read "Using the Windows Headers" on MSDN and as it says, I defined _WIN32_WINNT>=0x0501 and WINVER>=0x0501 for XP. But now I get,

    error C2008: '>' : unexpected in macro definition

    for both of them.
    I'm using version 6 of VC++.

    In the page for StrRetToStr, it doen't include XP for minimum OSs. So what must I do ?

    (sorry for bothering again)

  7. #7
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    You've got the wrong book if you're just learning to program.
    Might want to start off with just a simple C or C++ book.
    Code:
    #define _WIN32_WINNT 0x0500
    #define _WIN32_IE 0x0500
    #include ...
    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Win Xp firewall detection
    By wind_addict in forum Windows Programming
    Replies: 1
    Last Post: 04-30-2008, 12:13 PM
  2. Win XP or 2000?
    By andy668 in forum Windows Programming
    Replies: 8
    Last Post: 01-15-2002, 10:15 PM
  3. Win XP Error
    By The15th in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 12-22-2001, 02:25 AM
  4. Win xp professional or professional cowpat
    By Stoned_Coder in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 12-20-2001, 11:22 AM
  5. Win XP
    By Barjor in forum A Brief History of Cprogramming.com
    Replies: 32
    Last Post: 10-27-2001, 02:52 PM