SHBindToParent: Undeclared Identifier!

SHBindToParent: Undeclared Identifier!

Post by Xeno » Sat, 08 Jul 2000 04:00:00



Hi,

I wrote a simple application to enumerate all the subfolders and files under
a certain folder.  I included all the relevant headers and libs (i.e
shlobj.h, shell32.h/lib, and shlwapi.h/lib).  I'm using a Win 2000 Server.
Most of the Shell functions seem to work, but the compiler doesn't seem to
find SHBindToParent or SHGetFolderLocation functions, both of which are
defined in the shlobj.h header (the one on the Win2K at least, not NT 4.0).
I'm using the shell code in an MFC program.

here's a snippet of the function, of course, it doesn't work as advertised
yet:

BOOL CADUApp::EnumFolders()
{
 LPMALLOC pMalloc = NULL;
    IShellFolder *psfParent = NULL;
    LPITEMIDLIST pidlSystem = NULL;
    LPCITEMIDLIST pidlRelative = NULL;
    STRRET strDispName;
    TCHAR szDisplayName[MAX_PATH];
    HRESULT hr;

    hr = SHGetMalloc(&pMalloc);

    hr = SHGetFolderLocation(NULL, CSIDL_SYSTEM, NULL, NULL, &pidlSystem);

    hr = SHBindToParent(pidlSystem, IID_IShellFolder, (void **) &psfParent,
&pidlRelative);

    if(SUCCEEDED(hr))
    {
        hr = psfParent->GetDisplayNameOf(pidlRelative, SHGDN_NORMAL,
&strDispName);
        hr = StrRetToBuf(&strDispName, pidlSystem, szDisplayName,
sizeof(szDisplayName));
        file://cout << "SHGDN_NORMAL - " <<szDisplayName << '\n';
    }

    psfParent->Release();
    pMalloc->Free(pidlSystem);
    pMalloc->Release();

    return 0;

Quote:}

Any help is highly appreciated.

Xenon

 
 
 

SHBindToParent: Undeclared Identifier!

Post by Matthew Elli » Sat, 08 Jul 2000 04:00:00



Quote:> Hi,

> I wrote a simple application to enumerate all the subfolders and files
under
> a certain folder.  I included all the relevant headers and libs (i.e
> shlobj.h, shell32.h/lib, and shlwapi.h/lib).  I'm using a Win 2000 Server.
> Most of the Shell functions seem to work, but the compiler doesn't seem to
> find SHBindToParent or SHGetFolderLocation functions, both of which are
> defined in the shlobj.h header (the one on the Win2K at least, not NT
4.0).
> I'm using the shell code in an MFC program.

You need the latest Platform SDK and need to define WINVER=0x500 or
_WINNT_WIN32=0x500 before including windows.h.

Matt


 
 
 

1. SHGetFolderPath - why is it an 'undeclared identifier'?

Hi all,

I am confounded as to why my VC++ v6.0sp5 is having a compiler error
'undeclared identifier' on my use of the shell function SHGetFolderPath.
This function is explicitly documented on MSDN, and is supposedly defined in
ShlObj.h.  In my version of ShlObj.h it is not defined - only
SHGetSpecialFolderPath is.  Btw, SHGetSpecialFolderPath works, although it
returns 1 when I expect NOERROR/0.

In case file versions may be interesting:
ShlObj.h: 1998.Apr.24 00:00
Shell32.Lib: 1998.May.13 00:00
ShFolder.dll: 2001.May.08 04:00, v5.0.2920.0

Some other details:
W2Ksp1
IEv5.5sp2

Thanks in advance for your assistance.

David

2. DOS and UNIX, anything better tha vi available?

3. OBJECT-IDENTIFIER (not OBJECT IDENTIFIER)

4. where is Microsoft?

5. HELP !!! `netJobRing' undeclared ??

6. Delete FP2K and the Presonal Web Server

7. Undeclared var compiler errors

8. How to open 15" monitor case?

9. Undeclared variables in scc_maybe.c

10. Fingerprint scanner/identifier

11. Returning unique identifier: Excel VBA

12. Creating unique identifiers for files ?

13. compressed file identifier.. where?