IShellFolder::BindToObject works fine in Visual C ++, but
I have problem with this method in MASM (it always fails).
Where I was wrong?


Code (C++):
----------------------------------------------------------------------------------

LPSHELLFOLDER pDTFolder;
LPSHELLFOLDER pSubFolder;
LPITEMIDLIST pidl;
HRESULT hr;

hr = SHGetDesktopFolder(&pDTFolder);
if (SUCCEEDED(hr))
{
hr = SHGetSpecialFolderLocation(NULL, CSIDL_NETWORK,
&pidl);

if (SUCCEEDED(hr))
{
//>>>>>>>>>>>>>>>>> BindToObject

hr = pDTFolder->BindToObject(pidl, NULL,
IID_IShellFolder, (void**)&pSubFolder);
}
}

***************************************************
***************************************************

Code (MASM):
---------------------------------------------------------------------------------

.data

IID_IShellFolder GUID sIID_IShellFolder

pDTFolder DWORD NULL
pSubFolder DWORD NULL
pidl DWORD NULL

.code

; Some code ......

invoke SHGetDesktopFolder, addr pDTFolder
test eax, eax

.IF SUCCEEDED

invoke SHGetSpecialFolderLocation, NULL,
CSIDL_NETWORK, addr pidl
test eax, eax

.IF SUCCEEDED

;>>>>>>>>>>>>>>>>> BindToObject

coinvoke pDTFolder, IShellFolder, BindToObject, \
pidl, NULL, addr IID_IShellFolder, \
addr pSubFolder
.ENDIF

.ENDIF
Posted on 2001-11-23 06:19:14 by Hans
Just copied your code fragment in my sample prog. It works perfectly, no errors.
Posted on 2001-11-23 09:20:38 by japheth