1 /***********************************************************************\ 2 * shlobj.d * 3 * * 4 * Windows API header module * 5 * * 6 * Translated from MinGW API for MS-Windows 4.0 * 7 * * 8 * Placed into public domain * 9 \***********************************************************************/ 10 module windows.shlobj; 11 pragma(lib, "shell32"); 12 nothrow: 13 // TODO: fix bitfields 14 // TODO: CMIC_VALID_SEE_FLAGS 15 // SHGetFolderPath in shfolder.dll on W9x, NT4, also in shell32.dll on W2K 16 17 import windows.commctrl, windows.ole2, windows.shlguid, windows.shellapi; 18 private import windows.prsht, windows.unknwn, windows.w32api, windows.winbase, 19 windows.winnt, windows.winuser, windows.wtypes, windows.objfwd, windows.objidl; 20 private import windows.winnetwk; // for NETRESOURCE 21 private import windows.oaidl : VARIANT; 22 23 24 // FIXME: clean up Windows version support 25 26 align(1): 27 28 const BIF_RETURNONLYFSDIRS = 1; 29 const BIF_DONTGOBELOWDOMAIN = 2; 30 const BIF_STATUSTEXT = 4; 31 const BIF_RETURNFSANCESTORS = 8; 32 const BIF_EDITBOX = 16; 33 const BIF_VALIDATE = 32; 34 const BIF_NEWDIALOGSTYLE = 64; 35 const BIF_BROWSEINCLUDEURLS = 128; 36 const BIF_USENEWUI = BIF_EDITBOX | BIF_NEWDIALOGSTYLE; 37 const BIF_BROWSEFORCOMPUTER = 0x1000; 38 const BIF_BROWSEFORPRINTER = 0x2000; 39 const BIF_BROWSEINCLUDEFILES = 0x4000; 40 const BIF_SHAREABLE = 0x8000; 41 const BFFM_INITIALIZED = 1; 42 const BFFM_SELCHANGED = 2; 43 const BFFM_VALIDATEFAILEDA = 3; 44 const BFFM_VALIDATEFAILEDW = 4; 45 const BFFM_SETSTATUSTEXTA = WM_USER + 100; 46 const BFFM_ENABLEOK = WM_USER + 101; 47 const BFFM_SETSELECTIONA = WM_USER + 102; 48 const BFFM_SETSELECTIONW = WM_USER + 103; 49 const BFFM_SETSTATUSTEXTW = WM_USER + 104; 50 const BFFM_SETOKTEXT = WM_USER + 105; 51 const BFFM_SETEXPANDED = WM_USER + 106; 52 53 version(Unicode) { 54 alias BFFM_SETSTATUSTEXTW BFFM_SETSTATUSTEXT; 55 alias BFFM_SETSELECTIONW BFFM_SETSELECTION; 56 alias BFFM_VALIDATEFAILEDW BFFM_VALIDATEFAILED; 57 } else { 58 alias BFFM_SETSTATUSTEXTA BFFM_SETSTATUSTEXT; 59 alias BFFM_SETSELECTIONA BFFM_SETSELECTION; 60 alias BFFM_VALIDATEFAILEDA BFFM_VALIDATEFAILED; 61 } 62 63 const DVASPECT_SHORTNAME = 2; 64 65 enum SHARD { 66 SHARD_PIDL = 1, 67 SHARD_PATHA, 68 SHARD_PATHW, 69 SHARD_APPIDINFO, 70 SHARD_APPIDINFOIDLIST, 71 SHARD_LINK, 72 SHARD_APPIDINFOLINK, 73 SHARD_SHELLITEM, // = 8 74 SHARD_PATH = (_WIN32_UNICODE ? SHARD_PATHW : SHARD_PATHA) 75 } 76 77 const SHCNE_RENAMEITEM = 1; 78 const SHCNE_CREATE = 2; 79 const SHCNE_DELETE = 4; 80 const SHCNE_MKDIR = 8; 81 const SHCNE_RMDIR = 16; 82 const SHCNE_MEDIAINSERTED = 32; 83 const SHCNE_MEDIAREMOVED = 64; 84 const SHCNE_DRIVEREMOVED = 128; 85 const SHCNE_DRIVEADD = 256; 86 const SHCNE_NETSHARE = 512; 87 const SHCNE_NETUNSHARE = 1024; 88 const SHCNE_ATTRIBUTES = 2048; 89 const SHCNE_UPDATEDIR = 4096; 90 const SHCNE_UPDATEITEM = 8192; 91 const SHCNE_SERVERDISCONNECT = 16384; 92 const SHCNE_UPDATEIMAGE = 32768; 93 const SHCNE_DRIVEADDGUI = 65536; 94 const SHCNE_RENAMEFOLDER = 0x20000; 95 const SHCNE_FREESPACE = 0x40000; 96 const SHCNE_ASSOCCHANGED = 0x8000000; 97 const SHCNE_DISKEVENTS = 0x2381F; 98 const SHCNE_GLOBALEVENTS = 0xC0581E0; 99 const SHCNE_ALLEVENTS = 0x7FFFFFFF; 100 const SHCNE_INTERRUPT = 0x80000000; 101 102 const SHCNF_IDLIST = 0; 103 const SHCNF_PATHA = 1; 104 const SHCNF_PRINTERA = 2; 105 const SHCNF_DWORD = 3; 106 const SHCNF_PATHW = 5; 107 const SHCNF_PRINTERW = 6; 108 const SHCNF_TYPE = 0xFF; 109 const SHCNF_FLUSH = 0x1000; 110 const SHCNF_FLUSHNOWAIT = 0x2000; 111 112 version(Unicode) { 113 alias SHCNF_PATHW SHCNF_PATH; 114 alias SHCNF_PRINTERW SHCNF_PRINTER; 115 } else { 116 alias SHCNF_PATHA SHCNF_PATH; 117 alias SHCNF_PRINTERA SHCNF_PRINTER; 118 } 119 120 enum SFGAOF : DWORD { 121 SFGAO_CANCOPY = DROPEFFECT.DROPEFFECT_COPY, 122 SFGAO_CANMOVE = DROPEFFECT.DROPEFFECT_MOVE, 123 SFGAO_CANLINK = DROPEFFECT.DROPEFFECT_LINK, 124 SFGAO_CANRENAME = 0x00000010L, 125 SFGAO_CANDELETE = 0x00000020L, 126 SFGAO_HASPROPSHEET = 0x00000040L, 127 SFGAO_DROPTARGET = 0x00000100L, 128 SFGAO_CAPABILITYMASK = 0x00000177L, 129 SFGAO_ISSLOW = 0x00004000L, 130 SFGAO_GHOSTED = 0x00008000L, 131 SFGAO_LINK = 0x00010000L, 132 SFGAO_SHARE = 0x00020000L, 133 SFGAO_READONLY = 0x00040000L, 134 SFGAO_HIDDEN = 0x00080000L, 135 SFGAO_DISPLAYATTRMASK = (SFGAO_ISSLOW | SFGAO_GHOSTED | SFGAO_LINK 136 | SFGAO_SHARE | SFGAO_READONLY | SFGAO_HIDDEN), 137 SFGAO_FILESYSANCESTOR = 0x10000000L, 138 SFGAO_FOLDER = 0x20000000L, 139 SFGAO_FILESYSTEM = 0x40000000L, 140 SFGAO_HASSUBFOLDER = 0x80000000L, 141 SFGAO_CONTENTSMASK = 0x80000000L, 142 SFGAO_VALIDATE = 0x01000000L, 143 SFGAO_REMOVABLE = 0x02000000L, 144 SFGAO_COMPRESSED = 0x04000000L 145 } 146 const STRRET_WSTR = 0; 147 const STRRET_OFFSET = 1; 148 const STRRET_CSTR = 2; 149 150 enum { 151 SHGDFIL_FINDDATA = 1, 152 SHGDFIL_NETRESOURCE, 153 SHGDFIL_DESCRIPTIONID 154 } 155 156 enum { 157 SHDID_ROOT_REGITEM = 1, 158 SHDID_FS_FILE, 159 SHDID_FS_DIRECTORY, 160 SHDID_FS_OTHER, 161 SHDID_COMPUTER_DRIVE35, 162 SHDID_COMPUTER_DRIVE525, 163 SHDID_COMPUTER_REMOVABLE, 164 SHDID_COMPUTER_FIXED, 165 SHDID_COMPUTER_NETDRIVE, 166 SHDID_COMPUTER_CDROM, 167 SHDID_COMPUTER_RAMDISK, 168 SHDID_COMPUTER_OTHER, 169 SHDID_NET_DOMAIN, 170 SHDID_NET_SERVER, 171 SHDID_NET_SHARE, 172 SHDID_NET_RESTOFNET, 173 SHDID_NET_OTHER 174 } 175 176 const TCHAR[] REGSTR_PATH_EXPLORER = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"; 177 const TCHAR[] REGSTR_PATH_SPECIAL_FOLDERS=REGSTR_PATH_EXPLORER ~ "\\Shell Folders"; 178 179 enum { 180 CSIDL_DESKTOP = 0, 181 CSIDL_INTERNET, 182 CSIDL_PROGRAMS, 183 CSIDL_CONTROLS, 184 CSIDL_PRINTERS, 185 CSIDL_PERSONAL, 186 CSIDL_FAVORITES, 187 CSIDL_STARTUP, 188 CSIDL_RECENT, 189 CSIDL_SENDTO, 190 CSIDL_BITBUCKET, 191 CSIDL_STARTMENU, // = 11 192 CSIDL_MYMUSIC = 13, 193 CSIDL_MYVIDEO, // = 14 194 CSIDL_DESKTOPDIRECTORY = 16, 195 CSIDL_DRIVES, 196 CSIDL_NETWORK, 197 CSIDL_NETHOOD, 198 CSIDL_FONTS, 199 CSIDL_TEMPLATES, 200 CSIDL_COMMON_STARTMENU, 201 CSIDL_COMMON_PROGRAMS, 202 CSIDL_COMMON_STARTUP, 203 CSIDL_COMMON_DESKTOPDIRECTORY, 204 CSIDL_APPDATA, 205 CSIDL_PRINTHOOD, 206 CSIDL_LOCAL_APPDATA, 207 CSIDL_ALTSTARTUP, 208 CSIDL_COMMON_ALTSTARTUP, 209 CSIDL_COMMON_FAVORITES, 210 CSIDL_INTERNET_CACHE, 211 CSIDL_COOKIES, 212 CSIDL_HISTORY, 213 CSIDL_COMMON_APPDATA, 214 CSIDL_WINDOWS, 215 CSIDL_SYSTEM, 216 CSIDL_PROGRAM_FILES, 217 CSIDL_MYPICTURES, 218 CSIDL_PROFILE, 219 CSIDL_SYSTEMX86, 220 CSIDL_PROGRAM_FILESX86, 221 CSIDL_PROGRAM_FILES_COMMON, 222 CSIDL_PROGRAM_FILES_COMMONX86, 223 CSIDL_COMMON_TEMPLATES, 224 CSIDL_COMMON_DOCUMENTS, 225 CSIDL_COMMON_ADMINTOOLS, 226 CSIDL_ADMINTOOLS, 227 CSIDL_CONNECTIONS, // = 49 228 CSIDL_COMMON_MUSIC = 53, 229 CSIDL_COMMON_PICTURES, 230 CSIDL_COMMON_VIDEO, 231 CSIDL_RESOURCES, 232 CSIDL_RESOURCES_LOCALIZED, 233 CSIDL_COMMON_OEM_LINKS, 234 CSIDL_CDBURN_AREA, // = 59 235 CSIDL_COMPUTERSNEARME = 61, 236 CSIDL_FLAG_DONT_VERIFY = 0x4000, 237 CSIDL_FLAG_CREATE = 0x8000, 238 CSIDL_FLAG_MASK = 0xFF00 239 } 240 241 const TCHAR[] 242 CFSTR_SHELLIDLIST = "Shell IDList Array", 243 CFSTR_SHELLIDLISTOFFSET = "Shell Object Offsets", 244 CFSTR_NETRESOURCES = "Net Resource", 245 CFSTR_FILECONTENTS = "FileContents", 246 CFSTR_FILENAMEA = "FileName", 247 CFSTR_FILENAMEMAPA = "FileNameMap", 248 CFSTR_FILEDESCRIPTORA = "FileGroupDescriptor", 249 CFSTR_INETURLA = "UniformResourceLocator", 250 CFSTR_SHELLURL = CFSTR_INETURLA, 251 CFSTR_FILENAMEW = "FileNameW", 252 CFSTR_FILENAMEMAPW = "FileNameMapW", 253 CFSTR_FILEDESCRIPTORW = "FileGroupDescriptorW", 254 CFSTR_INETURLW = "UniformResourceLocatorW"; 255 256 version(Unicode) { 257 alias CFSTR_FILENAMEW CFSTR_FILENAME; 258 alias CFSTR_FILENAMEMAPW CFSTR_FILENAMEMAP; 259 alias CFSTR_FILEDESCRIPTORW CFSTR_FILEDESCRIPTOR; 260 alias CFSTR_INETURLW CFSTR_INETURL; 261 } else { 262 alias CFSTR_FILENAMEA CFSTR_FILENAME; 263 alias CFSTR_FILENAMEMAPA CFSTR_FILENAMEMAP; 264 alias CFSTR_FILEDESCRIPTORA CFSTR_FILEDESCRIPTOR; 265 alias CFSTR_INETURLA CFSTR_INETURL; 266 } 267 const TCHAR[] 268 CFSTR_PRINTERGROUP = "PrinterFriendlyName", 269 CFSTR_INDRAGLOOP = "InShellDragLoop", 270 CFSTR_PASTESUCCEEDED = "Paste Succeeded", 271 CFSTR_PERFORMEDDROPEFFECT = "Performed DropEffect", 272 CFSTR_PREFERREDDROPEFFECT = "Preferred DropEffect"; 273 274 const CMF_NORMAL=0; 275 const CMF_DEFAULTONLY=1; 276 const CMF_VERBSONLY=2; 277 const CMF_EXPLORE=4; 278 const CMF_NOVERBS=8; 279 const CMF_CANRENAME=16; 280 const CMF_NODEFAULT=32; 281 const CMF_INCLUDESTATIC=64; 282 const CMF_RESERVED=0xffff0000; 283 const GCS_VERBA=0; 284 const GCS_HELPTEXTA=1; 285 const GCS_VALIDATEA=2; 286 const GCS_VERBW=4; 287 const GCS_HELPTEXTW=5; 288 const GCS_VALIDATEW=6; 289 const GCS_UNICODE=4; 290 291 version(Unicode) { 292 alias GCS_VERBW GCS_VERB; 293 alias GCS_HELPTEXTW GCS_HELPTEXT; 294 alias GCS_VALIDATEW GCS_VALIDATE; 295 } else { 296 alias GCS_VERBA GCS_VERB; 297 alias GCS_HELPTEXTA GCS_HELPTEXT; 298 alias GCS_VALIDATEA GCS_VALIDATE; 299 } 300 301 const TCHAR[] 302 CMDSTR_NEWFOLDER = "NewFolder", 303 CMDSTR_VIEWLIST = "ViewList", 304 CMDSTR_VIEWDETAILS = "ViewDetails"; 305 306 const CMIC_MASK_HOTKEY = SEE_MASK_HOTKEY; 307 const CMIC_MASK_ICON = SEE_MASK_ICON; 308 const CMIC_MASK_FLAG_NO_UI = SEE_MASK_FLAG_NO_UI; 309 const CMIC_MASK_MODAL = 0x80000000; 310 // TODO: This isn't defined anywhere in MinGW. 311 //const CMIC_VALID_SEE_FLAGS=SEE_VALID_CMIC_FLAGS; 312 313 const GIL_OPENICON = 1; 314 const GIL_FORSHELL = 2; 315 const GIL_SIMULATEDOC = 1; 316 const GIL_PERINSTANCE = 2; 317 const GIL_PERCLASS = 4; 318 const GIL_NOTFILENAME = 8; 319 const GIL_DONTCACHE = 16; 320 321 const FVSIF_RECT = 1; 322 const FVSIF_PINNED = 2; 323 const FVSIF_NEWFAILED = 0x8000000; 324 const FVSIF_NEWFILE = 0x80000000; 325 const FVSIF_CANVIEWIT = 0x40000000; 326 327 const CDBOSC_SETFOCUS = 0; 328 const CDBOSC_KILLFOCUS = 1; 329 const CDBOSC_SELCHANGE = 2; 330 const CDBOSC_RENAME = 3; 331 332 const FCIDM_SHVIEWFIRST = 0; 333 const FCIDM_SHVIEWLAST = 0x7fff; 334 const FCIDM_BROWSERFIRST = 0xa000; 335 const FCIDM_BROWSERLAST = 0xbf00; 336 const FCIDM_GLOBALFIRST = 0x8000; 337 const FCIDM_GLOBALLAST = 0x9fff; 338 const FCIDM_MENU_FILE = FCIDM_GLOBALFIRST; 339 const FCIDM_MENU_EDIT = FCIDM_GLOBALFIRST+0x0040; 340 const FCIDM_MENU_VIEW = FCIDM_GLOBALFIRST+0x0080; 341 const FCIDM_MENU_VIEW_SEP_OPTIONS = FCIDM_GLOBALFIRST+0x0081; 342 const FCIDM_MENU_TOOLS = FCIDM_GLOBALFIRST+0x00c0; 343 const FCIDM_MENU_TOOLS_SEP_GOTO = FCIDM_GLOBALFIRST+0x00c1; 344 const FCIDM_MENU_HELP = FCIDM_GLOBALFIRST+0x0100; 345 const FCIDM_MENU_FIND = FCIDM_GLOBALFIRST+0x0140; 346 const FCIDM_MENU_EXPLORE = FCIDM_GLOBALFIRST+0x0150; 347 const FCIDM_MENU_FAVORITES = FCIDM_GLOBALFIRST+0x0170; 348 const FCIDM_TOOLBAR = FCIDM_BROWSERFIRST; 349 const FCIDM_STATUS = FCIDM_BROWSERFIRST+1; 350 351 const SBSP_DEFBROWSER = 0; 352 const SBSP_SAMEBROWSER = 1; 353 const SBSP_NEWBROWSER = 2; 354 const SBSP_DEFMODE = 0; 355 const SBSP_OPENMODE = 16; 356 const SBSP_EXPLOREMODE = 32; 357 const SBSP_ABSOLUTE = 0; 358 const SBSP_RELATIVE = 0x1000; 359 const SBSP_PARENT = 0x2000; 360 const SBSP_INITIATEDBYHLINKFRAME = 0x80000000; 361 const SBSP_REDIRECT = 0x40000000; 362 363 enum { 364 FCW_STATUS=1, 365 FCW_TOOLBAR, 366 FCW_TREE 367 } 368 369 const FCT_MERGE=1; 370 const FCT_CONFIGABLE=2; 371 const FCT_ADDTOEND=4; 372 373 const SVSI_DESELECT=0; 374 const SVSI_SELECT=1; 375 const SVSI_EDIT=3; 376 const SVSI_DESELECTOTHERS=4; 377 const SVSI_ENSUREVISIBLE=8; 378 const SVSI_FOCUSED=16; 379 380 const SVGIO_BACKGROUND=0; 381 const SVGIO_SELECTION=1; 382 const SVGIO_ALLVIEW=2; 383 384 const UINT SV2GV_CURRENTVIEW=-1; 385 const UINT SV2GV_DEFAULTVIEW=-2; 386 387 alias DWORD SHGDNF; 388 389 struct CIDA { 390 UINT cidl; 391 UINT[1] aoffset; 392 } 393 alias CIDA* LPIDA; 394 395 struct SHITEMID { 396 USHORT cb; 397 BYTE[1] abID; 398 } 399 alias SHITEMID* LPSHITEMID; 400 alias const(SHITEMID)* LPCSHITEMID; 401 402 struct ITEMIDLIST { 403 SHITEMID mkid; 404 } 405 alias ITEMIDLIST* LPITEMIDLIST; 406 alias const(ITEMIDLIST)* LPCITEMIDLIST; 407 408 alias int function(HWND, UINT, LPARAM, LPARAM) BFFCALLBACK; 409 410 struct BROWSEINFOA { 411 HWND hwndOwner; 412 LPCITEMIDLIST pidlRoot; 413 LPSTR pszDisplayName; 414 LPCSTR lpszTitle; 415 UINT ulFlags; 416 BFFCALLBACK lpfn; 417 LPARAM lParam; 418 int iImage; 419 } 420 alias BROWSEINFOA* PBROWSEINFOA, LPBROWSEINFOA; 421 422 struct BROWSEINFOW { 423 HWND hwndOwner; 424 LPCITEMIDLIST pidlRoot; 425 LPWSTR pszDisplayName; 426 LPCWSTR lpszTitle; 427 UINT ulFlags; 428 BFFCALLBACK lpfn; 429 LPARAM lParam; 430 int iImage; 431 } 432 alias BROWSEINFOW* PBROWSEINFOW, LPBROWSEINFOW; 433 434 struct CMINVOKECOMMANDINFO { 435 DWORD cbSize = this.sizeof; 436 DWORD fMask; 437 HWND hwnd; 438 LPCSTR lpVerb; 439 LPCSTR lpParameters; 440 LPCSTR lpDirectory; 441 int nShow; 442 DWORD dwHotKey; 443 HANDLE hIcon; 444 } 445 alias CMINVOKECOMMANDINFO* LPCMINVOKECOMMANDINFO; 446 447 struct DROPFILES { 448 DWORD pFiles; 449 POINT pt; 450 BOOL fNC; 451 BOOL fWide; 452 } 453 alias DROPFILES* LPDROPFILES; 454 455 enum SHGNO { 456 SHGDN_NORMAL = 0, 457 SHGDN_INFOLDER, 458 SHGDN_FOREDITING = 0x1000, 459 SHGDN_INCLUDE_NONFILESYS = 0x2000, 460 SHGDN_FORADDRESSBAR = 0x4000, 461 SHGDN_FORPARSING = 0x8000 462 } 463 464 enum SHCONTF { 465 SHCONTF_FOLDERS = 32, 466 SHCONTF_NONFOLDERS = 64, 467 SHCONTF_INCLUDEHIDDEN = 128, 468 SHCONTF_INIT_ON_FIRST_NEXT = 256, 469 SHCONTF_NETPRINTERSRCH = 512, 470 SHCONTF_SHAREABLE = 1024, 471 SHCONTF_STORAGE = 2048 472 } 473 474 struct STRRET { 475 UINT uType; 476 union { 477 LPWSTR pOleStr; 478 UINT uOffset; 479 char[MAX_PATH] cStr; 480 } 481 } 482 alias STRRET* LPSTRRET; 483 484 enum FD_FLAGS { 485 FD_CLSID = 1, 486 FD_SIZEPOINT = 2, 487 FD_ATTRIBUTES = 4, 488 FD_CREATETIME = 8, 489 FD_ACCESSTIME = 16, 490 FD_WRITESTIME = 32, 491 FD_FILESIZE = 64, 492 FD_LINKUI = 0x8000 493 } 494 495 struct FILEDESCRIPTORA { 496 DWORD dwFlags; 497 CLSID clsid; 498 SIZEL sizel; 499 POINTL pointl; 500 DWORD dwFileAttributes; 501 FILETIME ftCreationTime; 502 FILETIME ftLastAccessTime; 503 FILETIME ftLastWriteTime; 504 DWORD nFileSizeHigh; 505 DWORD nFileSizeLow; 506 CHAR[MAX_PATH] cFileName; 507 } 508 alias FILEDESCRIPTORA* LPFILEDESCRIPTORA; 509 510 struct FILEDESCRIPTORW { 511 DWORD dwFlags; 512 CLSID clsid; 513 SIZEL sizel; 514 POINTL pointl; 515 DWORD dwFileAttributes; 516 FILETIME ftCreationTime; 517 FILETIME ftLastAccessTime; 518 FILETIME ftLastWriteTime; 519 DWORD nFileSizeHigh; 520 DWORD nFileSizeLow; 521 WCHAR[MAX_PATH] cFileName; 522 } 523 alias FILEDESCRIPTORW* LPFILEDESCRIPTORW; 524 525 struct FILEGROUPDESCRIPTORA { 526 UINT cItems; 527 FILEDESCRIPTORA[1] fgd; 528 } 529 alias FILEGROUPDESCRIPTORA* LPFILEGROUPDESCRIPTORA; 530 531 struct FILEGROUPDESCRIPTORW { 532 UINT cItems; 533 FILEDESCRIPTORW[1] fgd; 534 } 535 alias FILEGROUPDESCRIPTORW* LPFILEGROUPDESCRIPTORW; 536 537 enum SLR_FLAGS { 538 SLR_NO_UI = 1, 539 SLR_ANY_MATCH = 2, 540 SLR_UPDATE = 4, 541 SLR_NOUPDATE = 8, 542 SLR_NOSEARCH = 16, 543 SLR_NOTRACK = 32, 544 SLR_NOLINKINFO = 64, 545 SLR_INVOKE_MSI = 128 546 } 547 548 enum SLGP_FLAGS { 549 SLGP_SHORTPATH=1, 550 SLGP_UNCPRIORITY=2, 551 SLGP_RAWPATH=4 552 } 553 554 alias PBYTE LPVIEWSETTINGS; 555 556 enum FOLDERFLAGS { 557 FWF_AUTOARRANGE = 1, 558 FWF_ABBREVIATEDNAMES = 2, 559 FWF_SNAPTOGRID = 4, 560 FWF_OWNERDATA = 8, 561 FWF_BESTFITWINDOW = 16, 562 FWF_DESKTOP = 32, 563 FWF_SINGLESEL = 64, 564 FWF_NOSUBFOLDERS = 128, 565 FWF_TRANSPARENT = 256, 566 FWF_NOCLIENTEDGE = 512, 567 FWF_NOSCROLL = 0x400, 568 FWF_ALIGNLEFT = 0x800, 569 FWF_SINGLECLICKACTIVATE = 0x8000 570 } 571 572 enum FOLDERVIEWMODE { 573 FVM_ICON = 1, 574 FVM_SMALLICON, 575 FVM_LIST, 576 FVM_DETAILS 577 } 578 579 struct FOLDERSETTINGS { 580 UINT ViewMode; 581 UINT fFlags; 582 } 583 alias FOLDERSETTINGS* LPFOLDERSETTINGS; 584 alias const(FOLDERSETTINGS)* LPCFOLDERSETTINGS; 585 586 struct FVSHOWINFO { 587 DWORD cbSize = this.sizeof; 588 HWND hwndOwner; 589 int iShow; 590 DWORD dwFlags; 591 RECT rect; 592 LPUNKNOWN punkRel; 593 OLECHAR[MAX_PATH] strNewFile; 594 } 595 alias FVSHOWINFO* LPFVSHOWINFO; 596 597 struct NRESARRAY { 598 UINT cItems; 599 NETRESOURCE[1] nr; 600 } 601 alias NRESARRAY* LPNRESARRAY; 602 603 enum { 604 SBSC_HIDE, 605 SBSC_SHOW, 606 SBSC_TOGGLE, 607 SBSC_QUERY 608 } 609 610 enum { 611 SBCMDID_ENABLESHOWTREE, 612 SBCMDID_SHOWCONTROL, 613 SBCMDID_CANCELNAVIGATION, 614 SBCMDID_MAYSAVECHANGES, 615 SBCMDID_SETHLINKFRAME, 616 SBCMDID_ENABLESTOP, 617 SBCMDID_OPTIONS 618 } 619 enum SVUIA_STATUS { 620 SVUIA_DEACTIVATE, 621 SVUIA_ACTIVATE_NOFOCUS, 622 SVUIA_ACTIVATE_FOCUS, 623 SVUIA_INPLACEACTIVATE 624 } 625 626 static if (_WIN32_IE >= 0x500) { 627 628 struct EXTRASEARCH 629 { 630 GUID guidSearch; 631 WCHAR[80] wszFriendlyName; 632 WCHAR[2084] wszUrl; 633 } 634 alias EXTRASEARCH* LPEXTRASEARCH; 635 636 alias DWORD SHCOLSTATEF; 637 638 struct SHCOLUMNID { 639 GUID fmtid; 640 DWORD pid; 641 } 642 alias SHCOLUMNID* LPSHCOLUMNID; 643 alias const(SHCOLUMNID)* LPCSHCOLUMNID; 644 645 struct SHELLDETAILS { 646 int fmt; 647 int cxChar; 648 STRRET str; 649 } 650 alias SHELLDETAILS* LPSHELLDETAILS; 651 652 struct PERSIST_FOLDER_TARGET_INFO 653 { 654 LPITEMIDLIST pidlTargetFolder; 655 WCHAR[MAX_PATH] szTargetParsingName; 656 WCHAR[MAX_PATH] szNetworkProvider; 657 DWORD dwAttributes; 658 int csidl; 659 } 660 661 enum SHGFP_TYPE { 662 SHGFP_TYPE_CURRENT = 0, 663 SHGFP_TYPE_DEFAULT = 1, 664 } 665 666 } 667 668 interface IEnumIDList : IUnknown { 669 HRESULT Next(ULONG, LPITEMIDLIST*, ULONG*); 670 HRESULT Skip(ULONG); 671 HRESULT Reset(); 672 HRESULT Clone(IEnumIDList*); 673 } 674 alias IEnumIDList LPENUMIDLIST; 675 676 interface IObjMgr : IUnknown { 677 HRESULT Append(IUnknown); 678 HRESULT Remove(IUnknown); 679 } 680 681 interface IContextMenu : IUnknown { 682 HRESULT QueryContextMenu(HMENU, UINT, UINT, UINT, UINT); 683 HRESULT InvokeCommand(LPCMINVOKECOMMANDINFO); 684 HRESULT GetCommandString(UINT, UINT, PUINT, LPSTR, UINT); 685 } 686 alias IContextMenu LPCONTEXTMENU; 687 688 interface IContextMenu2 : IContextMenu { 689 HRESULT HandleMenuMsg(UINT, WPARAM, LPARAM); 690 }; 691 alias IContextMenu2 LPCONTEXTMENU2; 692 693 static if (_WIN32_IE >= 0x500) { 694 align(8) { 695 struct SHCOLUMNINIT { 696 ULONG dwFlags; 697 ULONG dwReserved; 698 WCHAR[MAX_PATH] wszFolder; 699 } 700 alias SHCOLUMNINIT* LPSHCOLUMNINIT; 701 alias const(SHCOLUMNINIT)* LPCSHCOLUMNINIT; 702 703 struct SHCOLUMNDATA { 704 ULONG dwFlags; 705 DWORD dwFileAttributes; 706 ULONG dwReserved; 707 WCHAR *pwszExt; 708 WCHAR[MAX_PATH] wszFile; 709 } 710 alias SHCOLUMNDATA* LPSHCOLUMNDATA; 711 alias const(SHCOLUMNDATA)* LPCSHCOLUMNDATA; 712 } 713 714 const MAX_COLUMN_NAME_LEN = 80; 715 const MAX_COLUMN_DESC_LEN = 128; 716 717 align(1) struct SHCOLUMNINFO { 718 SHCOLUMNID scid; 719 VARTYPE vt; 720 DWORD fmt; 721 UINT cChars; 722 DWORD csFlags; 723 WCHAR[MAX_COLUMN_NAME_LEN] wszTitle; 724 WCHAR[MAX_COLUMN_DESC_LEN] wszDescription; 725 } 726 alias SHCOLUMNINFO* LPSHCOLUMNINFO; 727 alias const(SHCOLUMNINFO)* LPCSHCOLUMNINFO; 728 729 enum SHCOLSTATE { 730 SHCOLSTATE_TYPE_STR = 0x00000001, 731 SHCOLSTATE_TYPE_INT = 0x00000002, 732 SHCOLSTATE_TYPE_DATE = 0x00000003, 733 SHCOLSTATE_TYPEMASK = 0x0000000f, 734 SHCOLSTATE_ONBYDEFAULT = 0x00000010, 735 SHCOLSTATE_SLOW = 0x00000020, 736 SHCOLSTATE_EXTENDED = 0x00000040, 737 SHCOLSTATE_SECONDARYUI = 0x00000080, 738 SHCOLSTATE_HIDDEN = 0x00000100, 739 SHCOLSTATE_PREFER_VARCMP = 0x00000200 740 } 741 742 interface IColumnProvider : IUnknown { 743 HRESULT Initialize(LPCSHCOLUMNINIT); 744 HRESULT GetColumnInfo(DWORD, SHCOLUMNINFO*); 745 HRESULT GetItemData(LPCSHCOLUMNID, LPCSHCOLUMNDATA, VARIANT*); 746 } 747 }/* _WIN32_IE >= 0x500 */ 748 749 interface IQueryInfo : IUnknown { 750 HRESULT GetInfoTip(DWORD, WCHAR**); 751 HRESULT GetInfoFlags(DWORD*); 752 } 753 754 interface IShellExtInit : IUnknown { 755 HRESULT Initialize(LPCITEMIDLIST, LPDATAOBJECT, HKEY); 756 } 757 alias IShellExtInit LPSHELLEXTINIT; 758 759 interface IShellPropSheetExt : IUnknown { 760 HRESULT AddPages(LPFNADDPROPSHEETPAGE, LPARAM); 761 HRESULT ReplacePage(UINT, LPFNADDPROPSHEETPAGE, LPARAM); 762 } 763 alias IShellPropSheetExt LPSHELLPROPSHEETEXT; 764 765 interface IExtractIconA : IUnknown { 766 HRESULT GetIconLocation(UINT, LPSTR, UINT, int*, PUINT); 767 HRESULT Extract(LPCSTR, UINT, HICON*, HICON*, UINT); 768 }; 769 alias IExtractIconA LPEXTRACTICONA; 770 771 interface IExtractIconW : IUnknown { 772 HRESULT GetIconLocation(UINT, LPWSTR, UINT, int*, PUINT); 773 HRESULT Extract(LPCWSTR, UINT, HICON*, HICON*, UINT); 774 } 775 alias IExtractIconW LPEXTRACTICONW; 776 777 version(Unicode) { 778 alias IExtractIconW IExtractIcon; 779 alias LPEXTRACTICONW LPEXTRACTICON; 780 } else { 781 alias IExtractIconA IExtractIcon; 782 alias LPEXTRACTICONA LPEXTRACTICON; 783 } 784 785 interface IShellLinkA : IUnknown { 786 HRESULT GetPath(LPSTR, int, WIN32_FIND_DATAA*, DWORD); 787 HRESULT GetIDList(LPITEMIDLIST*); 788 HRESULT SetIDList(LPCITEMIDLIST); 789 HRESULT GetDescription(LPSTR, int); 790 HRESULT SetDescription(LPCSTR); 791 HRESULT GetWorkingDirectory(LPSTR, int); 792 HRESULT SetWorkingDirectory(LPCSTR); 793 HRESULT GetArguments(LPSTR, int); 794 HRESULT SetArguments(LPCSTR); 795 HRESULT GetHotkey(PWORD); 796 HRESULT SetHotkey(WORD); 797 HRESULT GetShowCmd(int*); 798 HRESULT SetShowCmd(int); 799 HRESULT GetIconLocation(LPSTR, int, int*); 800 HRESULT SetIconLocation(LPCSTR, int); 801 HRESULT SetRelativePath(LPCSTR , DWORD); 802 HRESULT Resolve(HWND, DWORD); 803 HRESULT SetPath(LPCSTR); 804 } 805 806 interface IShellLinkW : IUnknown { 807 HRESULT GetPath(LPWSTR, int, WIN32_FIND_DATAW*, DWORD); 808 HRESULT GetIDList(LPITEMIDLIST*); 809 HRESULT SetIDList(LPCITEMIDLIST); 810 HRESULT GetDescription(LPWSTR, int); 811 HRESULT SetDescription(LPCWSTR); 812 HRESULT GetWorkingDirectory(LPWSTR, int); 813 HRESULT SetWorkingDirectory(LPCWSTR); 814 HRESULT GetArguments(LPWSTR, int); 815 HRESULT SetArguments(LPCWSTR); 816 HRESULT GetHotkey(PWORD); 817 HRESULT SetHotkey(WORD); 818 HRESULT GetShowCmd(int*); 819 HRESULT SetShowCmd(int); 820 HRESULT GetIconLocation(LPWSTR, int, int*); 821 HRESULT SetIconLocation(LPCWSTR, int); 822 HRESULT SetRelativePath(LPCWSTR , DWORD); 823 HRESULT Resolve(HWND, DWORD); 824 HRESULT SetPath(LPCWSTR); 825 } 826 827 828 interface IShellFolder : IUnknown { 829 HRESULT ParseDisplayName(HWND, LPBC, LPOLESTR, PULONG, LPITEMIDLIST*, PULONG); 830 HRESULT EnumObjects(HWND, DWORD, LPENUMIDLIST*); 831 HRESULT BindToObject(LPCITEMIDLIST, LPBC, REFIID, PVOID*); 832 HRESULT BindToStorage(LPCITEMIDLIST, LPBC, REFIID, PVOID*); 833 HRESULT CompareIDs(LPARAM, LPCITEMIDLIST, LPCITEMIDLIST); 834 HRESULT CreateViewObject(HWND, REFIID, PVOID*); 835 HRESULT GetAttributesOf(UINT, LPCITEMIDLIST*, PULONG); 836 HRESULT GetUIObjectOf(HWND, UINT, LPCITEMIDLIST*, REFIID, PUINT, PVOID*); 837 HRESULT GetDisplayNameOf(LPCITEMIDLIST, DWORD, LPSTRRET); 838 HRESULT SetNameOf(HWND, LPCITEMIDLIST, LPCOLESTR, DWORD, LPITEMIDLIST*); 839 } 840 alias IShellFolder LPSHELLFOLDER; 841 842 static if (_WIN32_IE >= 0x500) { 843 844 interface IEnumExtraSearch: IUnknown { 845 HRESULT Next(ULONG, LPEXTRASEARCH*, ULONG*); 846 HRESULT Skip(ULONG); 847 HRESULT Reset(); 848 HRESULT Clone(IEnumExtraSearch*); 849 } 850 alias IEnumExtraSearch LPENUMEXTRASEARCH; 851 852 interface IShellFolder2 : IShellFolder { 853 HRESULT ParseDisplayName(HWND, LPBC, LPOLESTR, PULONG, LPITEMIDLIST*, PULONG); 854 HRESULT EnumObjects(HWND, DWORD, LPENUMIDLIST*); 855 HRESULT BindToObject(LPCITEMIDLIST, LPBC, REFIID, PVOID*); 856 HRESULT BindToStorage(LPCITEMIDLIST, LPBC, REFIID, PVOID*); 857 HRESULT CompareIDs(LPARAM, LPCITEMIDLIST, LPCITEMIDLIST); 858 HRESULT CreateViewObject(HWND, REFIID, PVOID*); 859 HRESULT GetAttributesOf(UINT, LPCITEMIDLIST*, PULONG); 860 HRESULT GetUIObjectOf(HWND, UINT, LPCITEMIDLIST*, REFIID, PUINT, PVOID*); 861 HRESULT GetDisplayNameOf(LPCITEMIDLIST, DWORD, LPSTRRET); 862 HRESULT SetNameOf(HWND, LPCITEMIDLIST, LPCOLESTR, DWORD, LPITEMIDLIST*); 863 HRESULT GetDefaultSearchGUID(GUID*); 864 HRESULT EnumSearches(IEnumExtraSearch*); 865 HRESULT GetDefaultColumn(DWORD, ULONG*, ULONG*); 866 HRESULT GetDefaultColumnState(UINT, SHCOLSTATEF*); 867 HRESULT GetDetailsEx(LPCITEMIDLIST, const(SHCOLUMNID)*, VARIANT*); 868 HRESULT GetDetailsOf(LPCITEMIDLIST, UINT, SHELLDETAILS*); 869 HRESULT MapColumnToSCID(UINT, SHCOLUMNID*); 870 } 871 alias IShellFolder2 LPSHELLFOLDER2; 872 873 } /* _WIN32_IE >= 0x500 */ 874 875 interface ICopyHook : IUnknown { 876 UINT CopyCallback(HWND, UINT, UINT, LPCSTR, DWORD, LPCSTR, DWORD); 877 } 878 alias ICopyHook LPCOPYHOOK; 879 880 interface IFileViewerSite : IUnknown { 881 HRESULT SetPinnedWindow(HWND); 882 HRESULT GetPinnedWindow(HWND*); 883 } 884 alias IFileViewerSite LPFILEVIEWERSITE; 885 886 interface IFileViewer : IUnknown { 887 HRESULT ShowInitialize(LPFILEVIEWERSITE); 888 HRESULT Show(LPFVSHOWINFO); 889 HRESULT PrintTo(LPSTR, BOOL); 890 } 891 alias IFileViewer LPFILEVIEWER; 892 893 interface IFileSystemBindData : IUnknown { 894 HRESULT SetFindData(const(WIN32_FIND_DATAW)*); 895 HRESULT GetFindData(WIN32_FIND_DATAW*); 896 } 897 898 interface IPersistFolder : IPersist { 899 HRESULT GetClassID(CLSID*); 900 HRESULT Initialize(LPCITEMIDLIST); 901 } 902 alias IPersistFolder LPPERSISTFOLDER; 903 904 static if (_WIN32_IE >= 0x400 || _WIN32_WINNT >= 0x500) { 905 906 interface IPersistFolder2 : IPersistFolder { 907 HRESULT GetClassID(CLSID*); 908 HRESULT Initialize(LPCITEMIDLIST); 909 HRESULT GetCurFolder(LPITEMIDLIST*); 910 } 911 alias IPersistFolder2 LPPERSISTFOLDER2; 912 913 }/* _WIN32_IE >= 0x400 || _WIN32_WINNT >= 0x500 */ 914 915 static if (_WIN32_IE >= 0x500) { 916 917 interface IPersistFolder3 : IPersistFolder2 { 918 HRESULT GetClassID(CLSID*); 919 HRESULT Initialize(LPCITEMIDLIST); 920 HRESULT GetCurFolder(LPITEMIDLIST*); 921 HRESULT InitializeEx(IBindCtx, LPCITEMIDLIST, const(PERSIST_FOLDER_TARGET_INFO)*); 922 HRESULT GetFolderTargetInfo(PERSIST_FOLDER_TARGET_INFO*); 923 } 924 alias IPersistFolder3 LPPERSISTFOLDER3; 925 926 } /* _WIN32_IE >= 0x500 */ 927 928 alias IShellBrowser LPSHELLBROWSER; 929 alias IShellView LPSHELLVIEW; 930 931 interface IShellBrowser : IOleWindow { 932 HRESULT GetWindow(HWND*); 933 HRESULT ContextSensitiveHelp(BOOL); 934 HRESULT InsertMenusSB(HMENU, LPOLEMENUGROUPWIDTHS); 935 HRESULT SetMenuSB(HMENU, HOLEMENU, HWND); 936 HRESULT RemoveMenusSB(HMENU); 937 HRESULT SetStatusTextSB(LPCOLESTR); 938 HRESULT EnableModelessSB(BOOL); 939 HRESULT TranslateAcceleratorSB(LPMSG, WORD); 940 HRESULT BrowseObject(LPCITEMIDLIST, UINT); 941 HRESULT GetViewStateStream(DWORD, LPSTREAM*); 942 HRESULT GetControlWindow(UINT, HWND*); 943 HRESULT SendControlMsg(UINT, UINT, WPARAM, LPARAM, LRESULT*); 944 HRESULT QueryActiveShellView(LPSHELLVIEW*); 945 HRESULT OnViewWindowActive(LPSHELLVIEW); 946 HRESULT SetToolbarItems(LPTBBUTTON, UINT, UINT); 947 } 948 949 interface IShellView : IOleWindow { 950 HRESULT GetWindow(HWND*); 951 HRESULT ContextSensitiveHelp(BOOL); 952 HRESULT TranslateAccelerator(LPMSG); 953 //[No] #ifdef _FIX_ENABLEMODELESS_CONFLICT 954 //[No] STDMETHOD(EnableModelessSV)(THIS_ BOOL) PURE; 955 //[Yes] #else 956 HRESULT EnableModeless(BOOL); 957 //[Yes] #endif 958 HRESULT UIActivate(UINT); 959 HRESULT Refresh(); 960 HRESULT CreateViewWindow(IShellView, LPCFOLDERSETTINGS, LPSHELLBROWSER, RECT*, HWND*); 961 HRESULT DestroyViewWindow(); 962 HRESULT GetCurrentInfo(LPFOLDERSETTINGS); 963 HRESULT AddPropertySheetPages(DWORD, LPFNADDPROPSHEETPAGE, LPARAM); 964 HRESULT SaveViewState(); 965 HRESULT SelectItem(LPCITEMIDLIST, UINT); 966 HRESULT GetItemObject(UINT, REFIID, PVOID*); 967 } 968 969 interface ICommDlgBrowser : IUnknown { 970 HRESULT OnDefaultCommand(IShellView); 971 HRESULT OnStateChange(IShellView, ULONG); 972 HRESULT IncludeObject(IShellView, LPCITEMIDLIST); 973 } 974 alias ICommDlgBrowser LPCOMMDLGBROWSER; 975 976 alias GUID SHELLVIEWID; 977 978 struct SV2CVW2_PARAMS { 979 DWORD cbSize = this.sizeof; 980 IShellView psvPrev; 981 FOLDERSETTINGS *pfs; 982 IShellBrowser psbOwner; 983 RECT *prcView; 984 const(SHELLVIEWID)* pvid; 985 HWND hwndView; 986 } 987 alias SV2CVW2_PARAMS* LPSV2CVW2_PARAMS; 988 989 interface IShellView2 : IShellView { 990 HRESULT GetWindow(HWND*); 991 HRESULT ContextSensitiveHelp(BOOL); 992 HRESULT TranslateAccelerator(LPMSG); 993 //[No] #ifdef _FIX_ENABLEMODELESS_CONFLICT 994 //[No] STDMETHOD(EnableModelessSV)(THIS_ BOOL) PURE; 995 //[Yes] #else 996 HRESULT EnableModeless(BOOL); 997 //[Yes] #endif 998 HRESULT UIActivate(UINT); 999 HRESULT Refresh(); 1000 HRESULT CreateViewWindow(IShellView, LPCFOLDERSETTINGS, LPSHELLBROWSER, RECT*, HWND*); 1001 HRESULT DestroyViewWindow(); 1002 HRESULT GetCurrentInfo(LPFOLDERSETTINGS); 1003 HRESULT AddPropertySheetPages(DWORD, LPFNADDPROPSHEETPAGE, LPARAM); 1004 HRESULT SaveViewState(); 1005 HRESULT SelectItem(LPCITEMIDLIST, UINT); 1006 HRESULT GetItemObject(UINT, REFIID, PVOID*); 1007 HRESULT GetView(SHELLVIEWID*, ULONG); 1008 HRESULT CreateViewWindow2(LPSV2CVW2_PARAMS); 1009 } 1010 1011 interface IShellExecuteHookA : IUnknown { 1012 HRESULT Execute(LPSHELLEXECUTEINFOA); 1013 } 1014 1015 interface IShellExecuteHookW : IUnknown { 1016 HRESULT Execute(LPSHELLEXECUTEINFOW); 1017 } 1018 1019 interface IShellIcon : IUnknown { 1020 HRESULT GetIconOf(LPCITEMIDLIST, UINT, PINT); 1021 } 1022 alias IShellIcon LPSHELLICON; 1023 1024 struct SHELLFLAGSTATE { 1025 short _bf; 1026 /* 1027 BOOL fShowAllObjects : 1; 1028 BOOL fShowExtensions : 1; 1029 BOOL fNoConfirmRecycle : 1; 1030 BOOL fShowSysFiles : 1; 1031 BOOL fShowCompColor : 1; 1032 BOOL fDoubleClickInWebView : 1; 1033 BOOL fDesktopHTML : 1; 1034 BOOL fWin95Classic : 1; 1035 BOOL fDontPrettyPath : 1; 1036 BOOL fShowAttribCol : 1; 1037 BOOL fMapNetDrvBtn : 1; 1038 BOOL fShowInfoTip : 1; 1039 BOOL fHideIcons : 1; 1040 UINT fRestFlags : 3; 1041 */ 1042 @property bool fShowAllObjects() { return cast(bool) (_bf & 0x0001); } 1043 @property bool fShowExtensions() { return cast(bool) (_bf & 0x0002); } 1044 @property bool fNoConfirmRecycle() { return cast(bool) (_bf & 0x0004); } 1045 @property bool fShowSysFiles() { return cast(bool) (_bf & 0x0008); } 1046 @property bool fShowCompColor() { return cast(bool) (_bf & 0x0010); } 1047 @property bool fDoubleClickInWebView() { return cast(bool) (_bf & 0x0020); } 1048 @property bool fDesktopHTML() { return cast(bool) (_bf & 0x0040); } 1049 @property bool fWin95Classic() { return cast(bool) (_bf & 0x0080); } 1050 @property bool fDontPrettyPath() { return cast(bool) (_bf & 0x0100); } 1051 @property bool fShowAttribCol() { return cast(bool) (_bf & 0x0200); } 1052 @property bool fMapNetDrvBtn() { return cast(bool) (_bf & 0x0400); } 1053 @property bool fShowInfoTip() { return cast(bool) (_bf & 0x0800); } 1054 @property bool fHideIcons() { return cast(bool) (_bf & 0x1000); } 1055 @property ubyte fRestFlags() { return cast(ubyte) (_bf >> 13); } 1056 1057 @property bool fShowAllObjects(bool f) { _bf = cast(ushort) ((_bf & ~0xFFFE) | f); return f; } 1058 @property bool fShowExtensions(bool f) { _bf = cast(ushort) ((_bf & ~0xFFFD) | (f << 1)); return f; } 1059 @property bool fNoConfirmRecycle(bool f) { _bf = cast(ushort) ((_bf & ~0xFFFB) | (f << 2)); return f; } 1060 @property bool fShowSysFiles(bool f) { _bf = cast(ushort) ((_bf & ~0xFFF8) | (f << 3)); return f; } 1061 @property bool fShowCompColor(bool f) { _bf = cast(ushort) ((_bf & ~0xFFEF) | (f << 4)); return f; } 1062 @property bool fDoubleClickInWebView(bool f) { _bf = cast(ushort) ((_bf & ~0xFFDF) | (f << 5)); return f; } 1063 @property bool fDesktopHTML(bool f) { _bf = cast(ushort) ((_bf & ~0xFFBF) | (f << 6)); return f; } 1064 @property bool fWin95Classic(bool f) { _bf = cast(ushort) ((_bf & ~0xFF8F) | (f << 7)); return f; } 1065 @property bool fDontPrettyPath(bool f) { _bf = cast(ushort) ((_bf & ~0xFEFF) | (f << 8)); return f; } 1066 @property bool fShowAttribCol(bool f) { _bf = cast(ushort) ((_bf & ~0xFDFF) | (f << 9)); return f; } 1067 @property bool fMapNetDrvBtn(bool f) { _bf = cast(ushort) ((_bf & ~0xFBFF) | (f << 10)); return f; } 1068 @property bool fShowInfoTip(bool f) { _bf = cast(ushort) ((_bf & ~0xF8FF) | (f << 11)); return f; } 1069 @property bool fHideIcons(bool f) { _bf = cast(ushort) ((_bf & ~0xEFFF) | (f << 12)); return f; } 1070 @property ubyte fRestFlags(ubyte f) { _bf = cast(ushort) ((_bf & ~0x1FFF) | (f << 13)); return cast(ubyte) (f & 7); } 1071 } 1072 alias SHELLFLAGSTATE* LPSHELLFLAGSTATE; 1073 1074 const SSF_SHOWALLOBJECTS = 0x1; 1075 const SSF_SHOWEXTENSIONS = 0x2; 1076 const SSF_SHOWCOMPCOLOR = 0x8; 1077 const SSF_SHOWSYSFILES = 0x20; 1078 const SSF_DOUBLECLICKINWEBVIEW = 0x80; 1079 const SSF_SHOWATTRIBCOL = 0x100; 1080 const SSF_DESKTOPHTML = 0x200; 1081 const SSF_WIN95CLASSIC = 0x400; 1082 const SSF_DONTPRETTYPATH = 0x800; 1083 const SSF_MAPNETDRVBUTTON = 0x1000; 1084 const SSF_SHOWINFOTIP = 0x2000; 1085 const SSF_HIDEICONS = 0x4000; 1086 const SSF_NOCONFIRMRECYCLE = 0x8000; 1087 1088 interface IShellIconOverlayIdentifier : IUnknown { 1089 HRESULT IsMemberOf(LPCWSTR, DWORD); 1090 HRESULT GetOverlayInfo(LPWSTR, int, int*, DWORD*); 1091 HRESULT GetPriority(int*); 1092 } 1093 1094 const ISIOI_ICONFILE = 0x00000001; 1095 const ISIOI_ICONINDEX = 0x00000002; 1096 1097 static if (_WIN32_WINNT >= 0x500) { 1098 struct SHELLSTATE { 1099 uint _bf1; 1100 DWORD dwWin95Unused; 1101 UINT uWin95Unused; 1102 LONG lParamSort; 1103 int iSortDirection; 1104 UINT _version; 1105 UINT uNotUsed; 1106 uint _bf2; 1107 /* 1108 BOOL fShowAllObjects : 1; 1109 BOOL fShowExtensions : 1; 1110 BOOL fNoConfirmRecycle : 1; 1111 BOOL fShowSysFiles : 1; 1112 BOOL fShowCompColor : 1; 1113 BOOL fDoubleClickInWebView : 1; 1114 BOOL fDesktopHTML : 1; 1115 BOOL fWin95Classic : 1; 1116 BOOL fDontPrettyPath : 1; 1117 BOOL fShowAttribCol : 1; 1118 BOOL fMapNetDrvBtn : 1; 1119 BOOL fShowInfoTip : 1; 1120 BOOL fHideIcons : 1; 1121 BOOL fWebView : 1; 1122 BOOL fFilter : 1; 1123 BOOL fShowSuperHidden : 1; 1124 BOOL fNoNetCrawling : 1; 1125 */ 1126 @property bool fShowAllObjects() { return cast(bool) (_bf1 & 0x00000001); } 1127 @property bool fShowExtensions() { return cast(bool) (_bf1 & 0x00000002); } 1128 @property bool fNoConfirmRecycle() { return cast(bool) (_bf1 & 0x00000004); } 1129 @property bool fShowSysFiles() { return cast(bool) (_bf1 & 0x00000008); } 1130 @property bool fShowCompColor() { return cast(bool) (_bf1 & 0x00000010); } 1131 @property bool fDoubleClickInWebView() { return cast(bool) (_bf1 & 0x00000020); } 1132 @property bool fDesktopHTML() { return cast(bool) (_bf1 & 0x00000040); } 1133 @property bool fWin95Classic() { return cast(bool) (_bf1 & 0x00000080); } 1134 @property bool fDontPrettyPath() { return cast(bool) (_bf1 & 0x00000100); } 1135 @property bool fShowAttribCol() { return cast(bool) (_bf1 & 0x00000200); } 1136 @property bool fMapNetDrvBtn() { return cast(bool) (_bf1 & 0x00000400); } 1137 @property bool fShowInfoTip() { return cast(bool) (_bf1 & 0x00000800); } 1138 @property bool fHideIcons() { return cast(bool) (_bf1 & 0x00001000); } 1139 @property bool fWebView() { return cast(bool) (_bf1 & 0x00002000); } 1140 @property bool fFilter() { return cast(bool) (_bf1 & 0x00004000); } 1141 @property bool fShowSuperHidden() { return cast(bool) (_bf1 & 0x00008000); } 1142 @property bool fNoNetCrawling() { return cast(bool) (_bf1 & 0x00010000); } 1143 1144 @property bool fShowAllObjects(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFFFFE) | f); return f; } 1145 @property bool fShowExtensions(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFFFFD) | (f << 1)); return f; } 1146 @property bool fNoConfirmRecycle(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFFFFB) | (f << 2)); return f; } 1147 @property bool fShowSysFiles(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFFFF8) | (f << 3)); return f; } 1148 @property bool fShowCompColor(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFFFEF) | (f << 4)); return f; } 1149 @property bool fDoubleClickInWebView(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFFFDF) | (f << 5)); return f; } 1150 @property bool fDesktopHTML(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFFFBF) | (f << 6)); return f; } 1151 @property bool fWin95Classic(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFFF8F) | (f << 7)); return f; } 1152 @property bool fDontPrettyPath(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFFEFF) | (f << 8)); return f; } 1153 @property bool fShowAttribCol(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFFDFF) | (f << 9)); return f; } 1154 @property bool fMapNetDrvBtn(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFFBFF) | (f << 10)); return f; } 1155 @property bool fShowInfoTip(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFF8FF) | (f << 11)); return f; } 1156 @property bool fHideIcons(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFEFFF) | (f << 12)); return f; } 1157 @property bool fWebView(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFDFFF) | (f << 13)); return f; } 1158 @property bool fFilter(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFFBFFF) | (f << 14)); return f; } 1159 @property bool fShowSuperHidden(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFF8FFF) | (f << 15)); return f; } 1160 @property bool fNoNetCrawling(bool f) { _bf1 = cast(uint) ((_bf1 & ~0xFFFEFFFF) | (f << 16)); return f; } 1161 /* 1162 BOOL fSepProcess : 1; 1163 BOOL fStartPanelOn : 1; 1164 BOOL fShowStartPage : 1; 1165 UINT fSpareFlags : 13; 1166 */ 1167 @property bool fSepProcess() { return cast(bool) (_bf2 & 0x00000001); } 1168 @property bool fStartPanelOn() { return cast(bool) (_bf2 & 0x00000002); } 1169 @property bool fShowStartPage() { return cast(bool) (_bf2 & 0x00000004); } 1170 @property ushort fSpareFlags() { return cast(ushort) ((_bf2 & 0x0000FFF8) >> 3); } 1171 1172 @property bool fSepProcess(bool f) { _bf2 = cast(uint) ((_bf2 & ~0xFFFFFFFE) | f); return f; } 1173 @property bool fStartPanelOn(bool f) { _bf2 = cast(uint) ((_bf2 & ~0xFFFFFFFD) | (f << 1)); return f; } 1174 @property bool fShowStartPage(bool f) { _bf2 = cast(uint) ((_bf2 & ~0xFFFFFFFB) | (f << 2)); return f; } 1175 @property ushort fSpareFlags(ushort f) { 1176 _bf2 = cast(ushort) ((_bf2 & ~0xFFFF0007) | ((f & 0x1FFF) << 3)); 1177 return cast(ushort) (f & 0x1FFF); 1178 } 1179 } 1180 alias SHELLSTATE* LPSHELLSTATE; 1181 } 1182 1183 static if (_WIN32_IE >= 0x500) { 1184 align(8) { 1185 struct SHDRAGIMAGE { 1186 SIZE sizeDragImage; 1187 POINT ptOffset; 1188 HBITMAP hbmpDragImage; 1189 COLORREF crColorKey; 1190 } 1191 alias SHDRAGIMAGE* LPSHDRAGIMAGE; 1192 } 1193 1194 interface IDragSourceHelper : IUnknown { 1195 HRESULT InitializeFromBitmap(LPSHDRAGIMAGE pshdi, IDataObject pDataObject); 1196 HRESULT InitializeFromWindow(HWND hwnd, POINT* ppt, IDataObject pDataObject); 1197 } 1198 1199 interface IDropTargetHelper : IUnknown { 1200 HRESULT DragEnter(HWND hwndTarget, IDataObject pDataObject, POINT* ppt, DWORD dwEffect); 1201 HRESULT DragLeave(); 1202 HRESULT DragOver(POINT* ppt, DWORD dwEffect); 1203 HRESULT Drop(IDataObject pDataObject, POINT* ppt, DWORD dwEffect); 1204 HRESULT Show(BOOL fShow); 1205 } 1206 } 1207 1208 extern (Windows): 1209 void SHAddToRecentDocs(UINT, PCVOID); 1210 LPITEMIDLIST SHBrowseForFolderA(PBROWSEINFOA); 1211 LPITEMIDLIST SHBrowseForFolderW(PBROWSEINFOW); 1212 void SHChangeNotify(LONG, UINT, PCVOID, PCVOID); 1213 HRESULT SHGetDataFromIDListA(LPSHELLFOLDER, LPCITEMIDLIST, int, PVOID, int); 1214 HRESULT SHGetDataFromIDListW(LPSHELLFOLDER, LPCITEMIDLIST, int, PVOID, int); 1215 HRESULT SHGetDesktopFolder(LPSHELLFOLDER*); 1216 HRESULT SHGetInstanceExplorer(IUnknown*); 1217 HRESULT SHGetMalloc(LPMALLOC*); 1218 BOOL SHGetPathFromIDListA(LPCITEMIDLIST, LPSTR); 1219 BOOL SHGetPathFromIDListW(LPCITEMIDLIST, LPWSTR); 1220 HRESULT SHGetSpecialFolderLocation(HWND, int, LPITEMIDLIST*); 1221 HRESULT SHLoadInProc(REFCLSID); 1222 1223 static if (_WIN32_IE >= 0x400) { 1224 BOOL SHGetSpecialFolderPathA(HWND, LPSTR, int, BOOL); 1225 BOOL SHGetSpecialFolderPathW(HWND, LPWSTR, int, BOOL); 1226 } 1227 1228 /* SHGetFolderPath in shfolder.dll on W9x, NT4, also in shell32.dll on W2K */ 1229 HRESULT SHGetFolderPathA(HWND, int, HANDLE, DWORD, LPSTR); 1230 HRESULT SHGetFolderPathW(HWND, int, HANDLE, DWORD, LPWSTR); 1231 1232 static if (_WIN32_WINNT >= 0x500) { 1233 INT SHGetIconOverlayIndexW(LPCWSTR pszIconPath, int iIconIndex); 1234 INT SHGetIconOverlayIndexA(LPCSTR pszIconPath, int iIconIndex); 1235 HRESULT SHGetFolderLocation(HWND, int, HANDLE, DWORD, LPITEMIDLIST*); 1236 INT SHCreateDirectoryExA(HWND, LPCSTR, LPSECURITY_ATTRIBUTES); 1237 INT SHCreateDirectoryExW(HWND, LPCWSTR, LPSECURITY_ATTRIBUTES); 1238 HRESULT SHBindToParent(LPCITEMIDLIST, REFIID, VOID**, LPCITEMIDLIST*); 1239 } 1240 1241 static if (_WIN32_WINNT >= 0x501) { 1242 enum { 1243 PRF_VERIFYEXISTS = 0x0001, 1244 PRF_TRYPROGRAMEXTENSIONS = (0x0002 | PRF_VERIFYEXISTS), 1245 PRF_FIRSTDIRDEF = 0x0004, 1246 PRF_DONTFINDLNK = 0x0008, 1247 IDO_SHGIOI_SHARE = 0x0FFFFFFF, 1248 IDO_SHGIOI_LINK = 0x0FFFFFFE, 1249 IDO_SHGIOI_SLOWFILE = 0x0FFFFFFD, 1250 IDO_SHGIOI_DEFAULT = 0x0FFFFFFC 1251 } 1252 1253 struct SHDESCRIPTIONID { 1254 DWORD dwDescriptionId; 1255 CLSID clsid; 1256 } 1257 alias SHDESCRIPTIONID* LPSHDESCRIPTIONID; 1258 1259 BOOL PathResolve(LPWSTR, LPCWSTR*, UINT); 1260 HRESULT SHGetFolderPathAndSubDirA(HWND, int, HANDLE, DWORD, LPCSTR, LPSTR); 1261 HRESULT SHGetFolderPathAndSubDirW(HWND, int, HANDLE, DWORD, LPCWSTR, LPWSTR); 1262 HRESULT SHParseDisplayName(LPCWSTR, IBindCtx, LPITEMIDLIST, SFGAOF, SFGAOF*); 1263 } 1264 1265 void SHGetSettings(LPSHELLFLAGSTATE, DWORD); 1266 1267 static if (_WIN32_WINNT >= 0x500) { 1268 void SHGetSetSettings(LPSHELLSTATE, DWORD, BOOL); 1269 BOOL ILIsEqual(LPCITEMIDLIST, LPCITEMIDLIST); 1270 BOOL ILIsParent(LPCITEMIDLIST, LPCITEMIDLIST, BOOL); 1271 BOOL ILRemoveLastID(LPITEMIDLIST); 1272 HRESULT ILLoadFromStream(IStream, LPITEMIDLIST*); 1273 HRESULT ILSaveToStream(IStream, LPCITEMIDLIST); 1274 LPITEMIDLIST ILAppendID(LPITEMIDLIST, LPCSHITEMID, BOOL); 1275 LPITEMIDLIST ILClone(LPCITEMIDLIST); 1276 LPITEMIDLIST ILCloneFirst(LPCITEMIDLIST); 1277 LPITEMIDLIST ILCombine(LPCITEMIDLIST, LPCITEMIDLIST); 1278 LPITEMIDLIST ILFindChild(LPCITEMIDLIST, LPCITEMIDLIST); 1279 LPITEMIDLIST ILFindLastID(LPCITEMIDLIST); 1280 LPITEMIDLIST ILGetNext(LPCITEMIDLIST); 1281 UINT ILGetSize(LPCITEMIDLIST); 1282 void ILFree(LPITEMIDLIST); 1283 1284 HRESULT SHCoCreateInstance(LPCWSTR, REFCLSID, IUnknown, REFIID, void**); 1285 } 1286 1287 version(Unicode) { 1288 alias IShellExecuteHookW IShellExecuteHook; 1289 alias IShellLinkW IShellLink; 1290 alias BROWSEINFOW BROWSEINFO; 1291 alias SHBrowseForFolderW SHBrowseForFolder; 1292 alias SHGetDataFromIDListW SHGetDataFromIDList; 1293 alias SHGetPathFromIDListW SHGetPathFromIDList; 1294 static if (_WIN32_IE >= 0x400) { 1295 alias SHGetSpecialFolderPathW SHGetSpecialFolderPath; 1296 } 1297 alias SHGetFolderPathW SHGetFolderPath; 1298 static if (_WIN32_WINNT >= 0x500) { 1299 alias SHGetIconOverlayIndexW SHGetIconOverlayIndex; 1300 alias SHCreateDirectoryExW SHCreateDirectoryEx; 1301 } 1302 static if (_WIN32_WINNT >= 0x501) { 1303 alias SHGetFolderPathAndSubDirW SHGetFolderPathAndSubDir; 1304 } 1305 alias FILEDESCRIPTORW FILEDESCRIPTOR; 1306 alias LPFILEDESCRIPTORW LPFILEDESCRIPTOR; 1307 alias FILEGROUPDESCRIPTORW FILEGROUPDESCRIPTOR; 1308 alias LPFILEGROUPDESCRIPTORW LPFILEGROUPDESCRIPTOR; 1309 1310 } else { 1311 alias IShellExecuteHookA IShellExecuteHook; 1312 alias IShellLinkA IShellLink; 1313 alias BROWSEINFOA BROWSEINFO; 1314 alias SHBrowseForFolderA SHBrowseForFolder; 1315 alias SHGetDataFromIDListA SHGetDataFromIDList; 1316 alias SHGetPathFromIDListA SHGetPathFromIDList; 1317 static if (_WIN32_IE >= 0x400) { 1318 alias SHGetSpecialFolderPathA SHGetSpecialFolderPath; 1319 } 1320 alias SHGetFolderPathA SHGetFolderPath; 1321 static if (_WIN32_WINNT >= 0x500) { 1322 alias SHGetIconOverlayIndexA SHGetIconOverlayIndex; 1323 alias SHCreateDirectoryExA SHCreateDirectoryEx; 1324 } 1325 static if (_WIN32_WINNT >= 0x501) { 1326 alias SHGetFolderPathAndSubDirA SHGetFolderPathAndSubDir; 1327 } 1328 alias FILEDESCRIPTORA FILEDESCRIPTOR; 1329 alias LPFILEDESCRIPTORA LPFILEDESCRIPTOR; 1330 alias FILEGROUPDESCRIPTORA FILEGROUPDESCRIPTOR; 1331 alias LPFILEGROUPDESCRIPTORA LPFILEGROUPDESCRIPTOR; 1332 } 1333 alias BROWSEINFO* PBROWSEINFO, LPBROWSEINFO; 1334 1335 static if (_WIN32_WINNT >= 0x501) { 1336 interface IFolderView : IUnknown { 1337 HRESULT GetAutoArrange(); 1338 HRESULT GetCurrentViewMode(UINT); 1339 HRESULT GetDefaultSpacing(POINT*); 1340 HRESULT GetFocusedItem(int*); 1341 HRESULT GetFolder(REFIID, PVOID*); 1342 HRESULT GetItemPosition(LPCITEMIDLIST, POINT*); 1343 HRESULT GetSelectionMarkedItem(int*); 1344 HRESULT GetSpacing(POINT*); 1345 HRESULT Item(int, LPITEMIDLIST*); 1346 HRESULT ItemCount(UINT, int*); 1347 HRESULT Items(UINT, REFIID, PVOID*); 1348 HRESULT SelectAndPositionItems(UINT, LPCITEMIDLIST*, POINT*, DWORD); 1349 HRESULT SelectItem(int, DWORD); 1350 HRESULT SetCurrentViewMode(UINT); 1351 } 1352 alias IFolderView LPFOLDERVIEW; 1353 }