From: kathy on
In my code, I try to use the SHGetFolderPath(). I already include the
header file "ShlObj.h". But when I try to build it, I got:

c:\temp\MyCode\MyCodeDlg.cpp(277): error C3861: 'SHGetFolderPath':
identifier not found, even with argument-dependent lookup

From: Vipin on

define _WIN32_IE=0x500 in your preprocessor defines and add shell32.lib in
your linker libraries list.

Then in your code:-
have this

#include <shlobj.h>

void main()
{
ShGetFolderPath(...);

}

Make sure your platform sdk header files precede in the include path order
and the sdk library path also precedes the library path

Also remember using ShGetFolderPath would make your programs non-functional
on operating systems
like 98, so you had better do like this

#define _WIN32_IE 0x5000
#include <shlobj.h>
typedef SHFOLDERAPI (*pfnSHGetFolderPathA)(HWND hwnd, int csidl, HANDLE
hToken, DWORD dwFlags, LPSTR pszPath);
typedef SHFOLDERAPI (*pfnSHGetFolderPathA)(HWND hwnd, int csidl, HANDLE
hToken, DWORD dwFlags, LPWSTR pszPath);

main()
{
HMODULE hmod = LoadLibrary(_T("shell32.dll"));
pfnSHGetFolderPathA ptr = (pfnSHGetFolderPathA) GetProceAddress(hmod ,
"SHGetFolderPathA");
if(ptr)
ptr(...)
else // on unsupported operating systems
{

}
}

--
Vipin Aravind
Microsoft - MVP

"kathy" <yqin_99(a)yahoo.com> wrote in message
news:1137431711.947332.46610(a)g49g2000cwa.googlegroups.com...
> In my code, I try to use the SHGetFolderPath(). I already include the
> header file "ShlObj.h". But when I try to build it, I got:
>
> c:\temp\MyCode\MyCodeDlg.cpp(277): error C3861: 'SHGetFolderPath':
> identifier not found, even with argument-dependent lookup
>


From: kathy on
"Make sure your platform sdk header files precede in the include path
order
and the sdk library path also precedes the library path "

How to do this?

From: Vipin on
For vs .net2003 , it is tools->options->projects->vc++ directories->Show
directories for: Library files.

Add the new path at the end of the list and move them up the list using the
up arrow.

--
Vipin Aravind
Microsoft - MVP

"kathy" <yqin_99(a)yahoo.com> wrote in message
news:1137438857.898289.301820(a)g47g2000cwa.googlegroups.com...
> "Make sure your platform sdk header files precede in the include path
> order
> and the sdk library path also precedes the library path "
>
> How to do this?
>


From: kathy on
thanks