brsfolder.c 15.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 * Copyright 1999 Juergen Schmied
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 18 19
 *
 * FIXME:
 *  - many memory leaks
20
 *  - many flags unimplemented
21 22
 */

23 24 25
#include <stdlib.h>
#include <string.h>

26 27
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
28
#include "wine/debug.h"
29
#include "undocshell.h"
30
#include "shlguid.h"
31 32
#include "pidl.h"
#include "shell32_main.h"
33
#include "shellapi.h"
34
#include "shresdef.h"
35

36
WINE_DEFAULT_DEBUG_CHANNEL(shell);
37

38
static HWND		hwndTreeView;
39
static LPBROWSEINFOW	lpBrowseInfo;
40 41
static LPITEMIDLIST	pidlRet;

42
static void FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST  lpifq, HTREEITEM hParent, IEnumIDList* lpe);
43
static HTREEITEM InsertTreeViewItem(IShellFolder * lpsf, LPCITEMIDLIST pidl, LPCITEMIDLIST pidlParent, IEnumIDList* pEnumIL, HTREEITEM hParent);
44 45 46 47 48 49 50 51 52 53 54

#define SUPPORTEDFLAGS (BIF_STATUSTEXT | \
                        BIF_BROWSEFORCOMPUTER | \
                        BIF_RETURNFSANCESTORS | \
                        BIF_RETURNONLYFSDIRS | \
                        BIF_BROWSEINCLUDEFILES)

static inline DWORD BrowseFlagsToSHCONTF(UINT ulFlags)
{
    return SHCONTF_FOLDERS | (ulFlags & BIF_BROWSEINCLUDEFILES ? SHCONTF_NONFOLDERS : 0);
}
55

56
static void InitializeTreeView(HWND hwndParent, LPCITEMIDLIST root)
57 58
{
	HIMAGELIST	hImageList;
59
	IShellFolder *	lpsf;
60
	HRESULT	hr;
61 62 63 64
	IEnumIDList * pEnumIL = NULL;
	LPITEMIDLIST parentofroot;
	parentofroot = ILClone(root);
	ILRemoveLastID(parentofroot);
65

66
	hwndTreeView = GetDlgItem (hwndParent, IDD_TREEVIEW);
67
	Shell_GetImageList(NULL, &hImageList);
68

69
	TRACE("dlg=%p tree=%p\n", hwndParent, hwndTreeView );
70 71

	if (hImageList && hwndTreeView)
72
	  TreeView_SetImageList(hwndTreeView, hImageList, 0);
73

74
	if (_ILIsDesktop (root)) {
75 76 77 78 79 80
	   hr = SHGetDesktopFolder(&lpsf);
	} else {
	   IShellFolder *	lpsfdesktop;

	   hr = SHGetDesktopFolder(&lpsfdesktop);
	   if (SUCCEEDED(hr)) {
81
	      hr = IShellFolder_BindToObject(lpsfdesktop, parentofroot, 0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf);
82 83 84
	      IShellFolder_Release(lpsfdesktop);
	   }
	}
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
	if (SUCCEEDED(hr))
	{
	    IShellFolder * pSFRoot;
	    if (_ILIsPidlSimple(root))
	    {
	        pSFRoot = lpsf;
	        IShellFolder_AddRef(pSFRoot);
	    }
	    else
	        hr = IShellFolder_BindToObject(lpsf,ILFindLastID(root),0,&IID_IShellFolder,(LPVOID *)&pSFRoot);
	    if (SUCCEEDED(hr))
	    {
	        hr = IShellFolder_EnumObjects(
	            pSFRoot,
	            hwndParent,
	            BrowseFlagsToSHCONTF(lpBrowseInfo->ulFlags),
	            &pEnumIL);
	        IShellFolder_Release(pSFRoot);
	    }
	}
105 106

	if (SUCCEEDED(hr) && hwndTreeView)
107 108 109 110 111
	{
	  TreeView_DeleteAllItems(hwndTreeView);
	  TreeView_Expand(hwndTreeView,
	                  InsertTreeViewItem(lpsf, _ILIsPidlSimple(root) ? root : ILFindLastID(root), parentofroot, pEnumIL,  TVI_ROOT),
	                  TVE_EXPAND);
112
	}
113

114
	if (SUCCEEDED(hr))
115 116
	  IShellFolder_Release(lpsf);

117
	TRACE("done\n");
118 119
}

120
static int GetIcon(LPITEMIDLIST lpi, UINT uFlags)
121 122
{
	SHFILEINFOW    sfi;
123
	SHGetFileInfoW((LPCWSTR)lpi, 0 ,&sfi, sizeof(SHFILEINFOW), uFlags);
124 125 126
	return sfi.iIcon;
}

127
static void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq, LPTVITEMW lpTV_ITEM)
128 129 130 131 132 133 134 135 136 137
{
	LPITEMIDLIST pidlDesktop = NULL;

	TRACE("%p %p\n",lpifq, lpTV_ITEM);

	if (!lpifq)
	{
	    pidlDesktop = _ILCreateDesktop();
	    lpifq = pidlDesktop;
	}
138 139 140 141

	lpTV_ITEM->iImage = GetIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
	lpTV_ITEM->iSelectedImage = GetIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_OPENICON);

142 143 144
	if (pidlDesktop)
	    ILFree(pidlDesktop);

145 146 147 148 149 150 151 152
	return;
}

typedef struct tagID
{
   LPSHELLFOLDER lpsfParent;
   LPITEMIDLIST  lpi;
   LPITEMIDLIST  lpifq;
153
   IEnumIDList*  pEnumIL;
154 155
} TV_ITEMDATA, *LPTV_ITEMDATA;

156
static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName)
157
{
158
	BOOL   bSuccess=TRUE;
159 160
	STRRET str;

161
	TRACE("%p %p %lx %p\n", lpsf, lpi, dwFlags, lpFriendlyName);
162
	if (SUCCEEDED(IShellFolder_GetDisplayNameOf(lpsf, lpi, dwFlags, &str)))
163
	{
164
	  if (FAILED(StrRetToStrNW(lpFriendlyName, MAX_PATH, &str, lpi)))
165 166 167
	  {
	      bSuccess = FALSE;
	  }
168 169 170 171
	}
	else
	  bSuccess = FALSE;

172
	TRACE("-- %s\n", debugstr_w(lpFriendlyName));
173 174 175
	return bSuccess;
}

176
static HTREEITEM InsertTreeViewItem(IShellFolder * lpsf, LPCITEMIDLIST pidl, LPCITEMIDLIST pidlParent, IEnumIDList* pEnumIL, HTREEITEM hParent)
177
{
178 179 180
	TVITEMW 	tvi;
	TVINSERTSTRUCTW	tvins;
	WCHAR		szBuff[MAX_PATH];
181
	LPTV_ITEMDATA	lptvid=0;
182

183
	tvi.mask  = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
184

185 186
	tvi.cChildren= pEnumIL ? 1 : 0;
	tvi.mask |= TVIF_CHILDREN;
187

188 189
	if (!(lptvid = (LPTV_ITEMDATA)SHAlloc(sizeof(TV_ITEMDATA))))
	    return NULL;
190

191 192
	if (!GetName(lpsf, pidl, SHGDN_NORMAL, szBuff))
	    return NULL;
193

194 195 196
	tvi.pszText    = szBuff;
	tvi.cchTextMax = MAX_PATH;
	tvi.lParam = (LPARAM)lptvid;
197

198 199 200 201 202 203
	IShellFolder_AddRef(lpsf);
	lptvid->lpsfParent = lpsf;
	lptvid->lpi	= ILClone(pidl);
	lptvid->lpifq	= pidlParent ? ILCombine(pidlParent, pidl) : ILClone(pidl);
	lptvid->pEnumIL = pEnumIL;
	GetNormalAndSelectedIcons(lptvid->lpifq, &tvi);
204

205 206 207
	tvins.DUMMYUNIONNAME.item         = tvi;
	tvins.hInsertAfter = NULL;
	tvins.hParent      = hParent;
208

209 210
	return (HTREEITEM)TreeView_InsertItemW(hwndTreeView, &tvins);
}
211

212 213 214
static void FillTreeView(IShellFolder * lpsf, LPITEMIDLIST  pidl, HTREEITEM hParent, IEnumIDList* lpe)
{
	HTREEITEM	hPrev = 0;
215
	LPITEMIDLIST	pidlTemp = 0;
216 217 218
	ULONG		ulFetched;
	HRESULT		hr;
	HWND		hwnd=GetParent(hwndTreeView);
219

220 221
	TRACE("%p %p %x\n",lpsf, pidl, (INT)hParent);
	SetCapture(GetParent(hwndTreeView));
222
	SetCursor(LoadCursorA(0, (LPSTR)IDC_WAIT));
223

224 225 226 227 228
	while (NOERROR == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched))
	{
	    ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER;
	    IEnumIDList* pEnumIL = NULL;
	    IShellFolder* pSFChild = NULL;
229
	    IShellFolder_GetAttributesOf(lpsf, 1, (LPCITEMIDLIST*)&pidlTemp, &ulAttrs);
230 231 232 233
	    if (ulAttrs & SFGAO_FOLDER)
	    {
	        hr = IShellFolder_BindToObject(lpsf,pidlTemp,NULL,&IID_IShellFolder,(LPVOID*)&pSFChild);
	        if (SUCCEEDED(hr))
234
                {
235
	            hr = IShellFolder_EnumObjects(pSFChild, hwnd, BrowseFlagsToSHCONTF(lpBrowseInfo->ulFlags), &pEnumIL);
236 237 238 239 240 241 242 243 244 245
                    if (SUCCEEDED(hr))
                    {
                        if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) || FAILED(IEnumIDList_Reset(pEnumIL)))
                        {
                            IEnumIDList_Release(pEnumIL);
                            pEnumIL = NULL;
                        }
                    }
                    IShellFolder_Release(pSFChild);
                }
246
	    }
247 248 249

	    if (!(hPrev = InsertTreeViewItem(lpsf, pidlTemp, pidl, pEnumIL, hParent)))
	        goto Done;
250
	    SHFree(pidlTemp);  /* Finally, free the pidl that the shell gave us... */
251
	    pidlTemp=NULL;
252 253 254 255
	}

Done:
	ReleaseCapture();
256
	SetCursor(LoadCursorW(0, (LPWSTR)IDC_ARROW));
257

258
	if (pidlTemp)
259
	  SHFree(pidlTemp);
260 261
}

262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
static inline BOOL PIDLIsType(LPCITEMIDLIST pidl, PIDLTYPE type)
{
    LPPIDLDATA data = _ILGetDataPointer(pidl);
    if (!data)
        return FALSE;
    return (data->type == type);
}

static void BrsFolder_CheckValidSelection(HWND hWndTree, LPTV_ITEMDATA lptvid)
{
    LPCITEMIDLIST pidl = lptvid->lpi;
    BOOL bEnabled = TRUE;
    DWORD dwAttributes;
    if ((lpBrowseInfo->ulFlags & BIF_BROWSEFORCOMPUTER) &&
        !PIDLIsType(pidl, PT_COMP))
        bEnabled = FALSE;
    if (lpBrowseInfo->ulFlags & BIF_RETURNFSANCESTORS)
    {
        dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
281
        if (FAILED(IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1, (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes)) ||
282 283 284 285 286 287
            !dwAttributes)
            bEnabled = FALSE;
    }
    if (lpBrowseInfo->ulFlags & BIF_RETURNONLYFSDIRS)
    {
        dwAttributes = SFGAO_FOLDER | SFGAO_FILESYSTEM;
288
        if (FAILED(IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1, (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes)) ||
289 290 291 292 293 294
            (dwAttributes != (SFGAO_FOLDER | SFGAO_FILESYSTEM)))
            bEnabled = FALSE;
    }
    SendMessageW(hWndTree, BFFM_ENABLEOK, 0, (LPARAM)bEnabled);
}

295
static LRESULT MsgNotify(HWND hWnd,  UINT CtlID, LPNMHDR lpnmh)
296
{
297
	NMTREEVIEWW	*pnmtv   = (NMTREEVIEWW *)lpnmh;
298
	LPTV_ITEMDATA	lptvid;  /* Long pointer to TreeView item data */
299
	IShellFolder *	lpsf2=0;
300

301

302
	TRACE("%p %x %p msg=%x\n", hWnd,  CtlID, lpnmh, pnmtv->hdr.code);
303 304 305

	switch (pnmtv->hdr.idFrom)
	{ case IDD_TREEVIEW:
306
	    switch (pnmtv->hdr.code)
307 308
	    {
	      case TVN_DELETEITEMA:
309
	      case TVN_DELETEITEMW:
310 311 312 313 314 315 316 317
                TRACE("TVN_DELETEITEMA/W\n");
	        lptvid=(LPTV_ITEMDATA)pnmtv->itemOld.lParam;
	        IShellFolder_Release(lptvid->lpsfParent);
	        if (lptvid->pEnumIL)
	          IEnumIDList_Release(lptvid->pEnumIL);
	        SHFree(lptvid->lpi);
	        SHFree(lptvid->lpifq);
	        SHFree(lptvid);
318
	        break;
319

320 321
	      case TVN_ITEMEXPANDINGA:
	      case TVN_ITEMEXPANDINGW:
322 323
		{
                  TRACE("TVN_ITEMEXPANDINGA/W\n");
324 325
		  if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE))
	            break;
326

327
	          lptvid=(LPTV_ITEMDATA)pnmtv->itemNew.lParam;
328
	          if (SUCCEEDED(IShellFolder_BindToObject(lptvid->lpsfParent, lptvid->lpi,0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf2)))
329
	          { FillTreeView( lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem, lptvid->pEnumIL);
330 331 332 333
	          }
	          TreeView_SortChildren(hwndTreeView, pnmtv->itemNew.hItem, FALSE);
		}
	        break;
334 335
	      case TVN_SELCHANGEDA:
	      case TVN_SELCHANGEDW:
336 337
	        lptvid=(LPTV_ITEMDATA)pnmtv->itemNew.lParam;
		pidlRet = lptvid->lpifq;
338 339
		if (lpBrowseInfo->lpfn)
		   (lpBrowseInfo->lpfn)(hWnd, BFFM_SELCHANGED, (LPARAM)pidlRet, lpBrowseInfo->lParam);
340
		BrsFolder_CheckValidSelection(hWnd, lptvid);
341 342 343
	        break;

	      default:
344
	        WARN("unhandled (%d)\n", pnmtv->hdr.code);
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
		break;
	    }
	    break;

	  default:
	    break;
	}

	return 0;
}


/*************************************************************************
 *             BrsFolderDlgProc32  (not an exported API function)
 */
360
static INT_PTR CALLBACK BrsFolderDlgProc(HWND hWnd, UINT msg, WPARAM wParam,
361
				     LPARAM lParam )
362
{
363
	TRACE("hwnd=%p msg=%04x 0x%08x 0x%08lx\n", hWnd,  msg, wParam, lParam );
364 365 366 367

	switch(msg)
	{ case WM_INITDIALOG:
	    pidlRet = NULL;
368
	    lpBrowseInfo = (LPBROWSEINFOW) lParam;
369 370
	    if (lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS)
	      FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS);
371
	    if (lpBrowseInfo->lpszTitle) {
372
	       SetWindowTextW(GetDlgItem(hWnd, IDD_TITLE), lpBrowseInfo->lpszTitle);
373 374 375 376 377 378
	    } else {
	       ShowWindow(GetDlgItem(hWnd, IDD_TITLE), SW_HIDE);
	    }
	    if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT))
	       ShowWindow(GetDlgItem(hWnd, IDD_STATUS), SW_HIDE);

379
	    InitializeTreeView(hWnd, lpBrowseInfo->pidlRoot);
380

381
	    if (lpBrowseInfo->lpfn)
382 383 384
	       (lpBrowseInfo->lpfn)(hWnd, BFFM_INITIALIZED, 0, lpBrowseInfo->lParam);

	    return TRUE;
385 386

	  case WM_NOTIFY:
387
	    MsgNotify( hWnd, (UINT)wParam, (LPNMHDR)lParam);
388
	    break;
389

390 391 392
	  case WM_COMMAND:
	    switch (wParam)
	    { case IDOK:
393 394
	        pdump ( pidlRet );
	        SHGetPathFromIDListW(pidlRet, lpBrowseInfo->pszDisplayName);
395
	        EndDialog(hWnd, (DWORD) ILClone(pidlRet));
396 397 398
	        return TRUE;

	      case IDCANCEL:
399
	        EndDialog(hWnd, 0);
400 401 402
	        return TRUE;
	    }
	    break;
403 404 405 406 407 408 409 410 411 412 413 414
	case BFFM_SETSTATUSTEXTA:
	   TRACE("Set status %s\n", debugstr_a((LPSTR)lParam));
	   SetWindowTextA(GetDlgItem(hWnd, IDD_STATUS), (LPSTR)lParam);
	   break;
	case BFFM_SETSTATUSTEXTW:
	   TRACE("Set status %s\n", debugstr_w((LPWSTR)lParam));
	   SetWindowTextW(GetDlgItem(hWnd, IDD_STATUS), (LPWSTR)lParam);
	   break;
	case BFFM_ENABLEOK:
	   TRACE("Enable %ld\n", lParam);
	   EnableWindow(GetDlgItem(hWnd, 1), (lParam)?TRUE:FALSE);
	   break;
415 416 417 418
	case BFFM_SETOKTEXT: /* unicode only */
	   TRACE("Set OK text %s\n", debugstr_w((LPWSTR)wParam));
	   SetWindowTextW(GetDlgItem(hWnd, 1), (LPWSTR)wParam);
	   break;
419 420
	case BFFM_SETSELECTIONA:
	   if (wParam)
421
	      FIXME("Set selection %s\n", debugstr_a((LPSTR)lParam));
422
	   else
423
	      FIXME("Set selection %p\n", (void*)lParam);
424 425 426
	   break;
	case BFFM_SETSELECTIONW:
	   if (wParam)
427 428 429 430 431 432 433
	      FIXME("Set selection %s\n", debugstr_w((LPWSTR)lParam));
	   else
	      FIXME("Set selection %p\n", (void*)lParam);
	   break;
	case BFFM_SETEXPANDED: /* unicode only */
	   if (wParam)
	      FIXME("Set expanded %s\n", debugstr_w((LPWSTR)lParam));
434
	   else
435
	      FIXME("Set expanded %p\n", (void*)lParam);
436
	   break;
437
	}
438
	return FALSE;
439 440
}

441 442
static WCHAR swBrowseTempName[] = {'S','H','B','R','S','F','O','R','F','O','L','D','E','R','_','M','S','G','B','O','X',0};

443
/*************************************************************************
444
 * SHBrowseForFolderA [SHELL32.@]
Patrik Stridvall's avatar
Patrik Stridvall committed
445
 * SHBrowseForFolder  [SHELL32.@]
446
 */
447
LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi)
448
{
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
	BROWSEINFOW bi;
	LPITEMIDLIST lpid;
	INT len;
	
	TRACE("(%p{lpszTitle=%s,owner=%p})\n", lpbi,
	    lpbi ? debugstr_a(lpbi->lpszTitle) : NULL, lpbi ? lpbi->hwndOwner : NULL);

	if (!lpbi)
	  return NULL;

	bi.hwndOwner = lpbi->hwndOwner;
	bi.pidlRoot = lpbi->pidlRoot;
	if (lpbi->pszDisplayName)
	{
	  len = MultiByteToWideChar(CP_ACP, 0, lpbi->pszDisplayName, -1, NULL, 0);
	  bi.pszDisplayName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
	  MultiByteToWideChar(CP_ACP, 0, lpbi->pszDisplayName, -1, bi.pszDisplayName, len);
	}
	else
	  bi.pszDisplayName = NULL;
469

470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
	if (lpbi->lpszTitle)
	{
	  len = MultiByteToWideChar(CP_ACP, 0, lpbi->lpszTitle, -1, NULL, 0);
	  bi.lpszTitle = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
	  MultiByteToWideChar(CP_ACP, 0, lpbi->lpszTitle, -1, (LPWSTR)bi.lpszTitle, len);
	}
	else
	  bi.lpszTitle = NULL;

	bi.ulFlags = lpbi->ulFlags;
	bi.lpfn = lpbi->lpfn;
	bi.lParam = lpbi->lParam;
	bi.iImage = lpbi->iImage;
	lpid = (LPITEMIDLIST) DialogBoxParamW(shell32_hInstance,
	                                      swBrowseTempName, lpbi->hwndOwner,
	                                      BrsFolderDlgProc, (INT)&bi);
	if (bi.pszDisplayName)
	{
	  WideCharToMultiByte(CP_ACP, 0, bi.pszDisplayName, -1, lpbi->pszDisplayName, MAX_PATH, 0, NULL);
	  HeapFree(GetProcessHeap(), 0, bi.pszDisplayName);
	}
	if (bi.lpszTitle)
	{
	  HeapFree(GetProcessHeap(), 0, (LPVOID)bi.lpszTitle);
	}
	lpbi->iImage = bi.iImage;
	return lpid;
497
}
498

499

500 501 502 503 504
/*************************************************************************
 * SHBrowseForFolderW [SHELL32.@]
 */
LPITEMIDLIST WINAPI SHBrowseForFolderW (LPBROWSEINFOW lpbi)
{
505 506 507 508 509 510 511 512 513
	TRACE("((%p->{lpszTitle=%s,owner=%p})\n", lpbi,
	    lpbi ? debugstr_w(lpbi->lpszTitle) : NULL, lpbi ? lpbi->hwndOwner : 0);

	if (!lpbi)
	  return NULL;

	return (LPITEMIDLIST) DialogBoxParamW(shell32_hInstance,
	                                      swBrowseTempName, lpbi->hwndOwner,
	                                      BrsFolderDlgProc, (INT)lpbi);
514
}