Winecfg -> browse for folder

Rolf Kalbermatter rolf.kalbermatter at citeng.com
Wed Nov 24 15:45:38 CST 2004


Robert van Herk <robert at robertvanherk.nl> wrote:

>Also, I am having some troubles into tricking the SHBrowseForFolder 
>thingy into using a different root folder, since I guess I need to use 
>SHParseDisplayName 
>(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shparsedisplayname.asp) 
>for that, but that doesn't seem to be implemented in Wine.

This shouldn't be to difficult I guess. There are helper functions in
shell32.pidl.c which should be close to what this function does actually. 

Something like this in pidl.c should do the trick:

HRESULT WINAPI SHParseDisplayNameW(LPCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl,
                                   SFGAOF sfgaoIn, SFGAOF *psfgaoOut)

{
	LPSHELLFOLDER sf;
	HRESULT ret = E_FAIL;

	TRACE("%s %p 0x%08lx\n", debugstr_w(pszName), ppidl, attributes ? *attributes : 0);

	if (SUCCEEDED (SHGetDesktopFolder(&sf)))
	{
	  ret = IShellFolder_ParseDisplayName(sf, 0, pbc, (LPOLESTR)pszName, NULL, ppidl, &sfgaoIn);
	  if (succeeded && psfgaoOut)
	    *psfgaoOut = sfgaoIn;
	  IShellFolder_Release(sf);
	}
	return ret;
}

Or you could probably use SHILCreateFromPathW() too for your purposes, which is similar.

>Finally, I don't know how to free PIDLS. In the MSDN documentation they 
>use C++ calls for that, but I don't know how to port that to C.

ILFree() exported as ordinal 155 from shell32 should be the function to use.
It was undocumented in Windows for a long time but exists in shell32 since
at least Win95.

Rolf Kalbermatter
 





More information about the wine-devel mailing list