Joel Holdsworth : comdlg32: Replaced file dialog house icon with the shell icon for desktop.

Alexandre Julliard julliard at winehq.org
Mon Oct 5 09:54:30 CDT 2009


Module: wine
Branch: master
Commit: ee09534c27098bc8b00a7c0d5f9199232aab8fb5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ee09534c27098bc8b00a7c0d5f9199232aab8fb5

Author: Joel Holdsworth <joel at airwebreathe.org.uk>
Date:   Sat Oct  3 10:12:55 2009 +0100

comdlg32: Replaced file dialog house icon with the shell icon for desktop.

---

 dlls/comdlg32/800.bmp    |  Bin 1334 -> 0 bytes
 dlls/comdlg32/cdlg_xx.rc |    3 ---
 dlls/comdlg32/filedlg.c  |   27 +++++++++++++++++++--------
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/dlls/comdlg32/800.bmp b/dlls/comdlg32/800.bmp
deleted file mode 100644
index 3b7dae2..0000000
Binary files a/dlls/comdlg32/800.bmp and /dev/null differ
diff --git a/dlls/comdlg32/cdlg_xx.rc b/dlls/comdlg32/cdlg_xx.rc
index 0797897..24139d2 100644
--- a/dlls/comdlg32/cdlg_xx.rc
+++ b/dlls/comdlg32/cdlg_xx.rc
@@ -71,9 +71,6 @@ PD32_PORTRAIT ICON pd32_portrait.ico
 /* @makedep: pd32_landscape.ico */
 PD32_LANDSCAPE ICON pd32_landscape.ico
 
-/* @makedep: 800.bmp */
-800 BITMAP DISCARDABLE LOADONCALL "800.bmp"
-
 /* @makedep: folder.ico */
 FOLDER ICON folder.ico
 
diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index a28c457..d1147eb 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -1320,15 +1320,16 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
    {VIEW_LIST,         FCIDM_TB_SMALLICON,  TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0 },
    {VIEW_DETAILS,      FCIDM_TB_REPORTVIEW, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0 },
   };
-  TBADDBITMAP tba[2];
+  static const TBADDBITMAP tba = {HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR};
+
   RECT rectTB;
   RECT rectlook;
-  FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr);
 
-  tba[0].hInst = HINST_COMMCTRL;
-  tba[0].nID   = IDB_VIEW_SMALL_COLOR;
-  tba[1].hInst = COMDLG32_hInstance;
-  tba[1].nID   = 800;
+  HIMAGELIST toolbarImageList;
+  SHFILEINFOA shFileInfo;
+  ITEMIDLIST *desktopPidl;
+
+  FileOpenDlgInfos *fodInfos = GetPropA(hwnd,FileOpenDlgInfosStr);
 
   TRACE("%p\n", fodInfos);
 
@@ -1378,9 +1379,19 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
 /* FIXME: use TB_LOADIMAGES when implemented */
 /*  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_LOADIMAGES, IDB_VIEW_SMALL_COLOR, HINST_COMMCTRL);*/
   SendMessageW(fodInfos->DlgInfos.hwndTB, TB_SETMAXTEXTROWS, 0, 0);
-  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, 12, (LPARAM) &tba[0]);
-  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, 1, (LPARAM) &tba[1]);
+  SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, 12, (LPARAM) &tba);
+
+  /* Retrieve and add desktop icon to the toolbar */
+  toolbarImageList = (HIMAGELIST)SendMessageW(fodInfos->DlgInfos.hwndTB, TB_GETIMAGELIST, 0, 0L);
+  SHGetSpecialFolderLocation(hwnd, CSIDL_DESKTOP, &desktopPidl);
+  SHGetFileInfoA((LPCSTR)desktopPidl, 0, &shFileInfo, sizeof(shFileInfo),
+    SHGFI_PIDL | SHGFI_ICON | SHGFI_SMALLICON);
+  ImageList_AddIcon(toolbarImageList, shFileInfo.hIcon);
+
+  DestroyIcon(shFileInfo.hIcon);
+  CoTaskMemFree(desktopPidl);
 
+  /* Finish Toolbar Construction */
   SendMessageW(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSW, 9, (LPARAM) tbb);
   SendMessageW(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0);
 




More information about the wine-cvs mailing list