- Timestamp:
- Nov 2, 1999, 9:37:43 PM (26 years ago)
- Location:
- trunk/src/comdlg32
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/cdlg.h
r1548 r1556 1 /* $Id: cdlg.h,v 1. 1 1999-11-02 19:09:41sandervl Exp $ */1 /* $Id: cdlg.h,v 1.2 1999-11-02 20:37:42 sandervl Exp $ */ 2 2 /* 3 * Common Dialog Boxes interface (32 bit) (990815)3 * Common Dialog Boxes interface (32 bit) 4 4 * 5 5 * Copyright 1998 Bertho A. Stultiens … … 37 37 38 38 #define PD32_PRINT_TITLE 7000 39 #define PD32_PRINT_ALL_X_PAGES 7001 40 #define PD32_INVALID_PAGE_RANGE 7003 39 40 #define PD32_VALUE_UREADABLE 1104 41 #define PD32_INVALID_PAGE_RANGE 1105 42 #define PD32_FROM_NOT_ABOVE_TO 1106 43 #define PD32_MARGINS_OVERLAP 1107 44 #define PD32_NR_OF_COPIES_EMPTY 1108 45 #define PD32_TOO_LARGE_COPIES 1109 46 #define PD32_PRINT_ERROR 1110 47 #define PD32_NO_DEFAULT_PRINTER 1111 48 #define PD32_CANT_FIND_PRINTER 1112 49 #define PD32_OUT_OF_MEMORY 1113 50 #define PD32_GENERIC_ERROR 1114 51 #define PD32_DRIVER_UNKNOWN 1115 52 53 #define PD32_PRINTER_STATUS_READY 1536 54 #define PD32_PRINTER_STATUS_PAUSED 1537 55 #define PD32_PRINTER_STATUS_ERROR 1538 56 #define PD32_PRINTER_STATUS_PENDING_DELETION 1539 57 #define PD32_PRINTER_STATUS_PAPER_JAM 1540 58 #define PD32_PRINTER_STATUS_PAPER_OUT 1541 59 #define PD32_PRINTER_STATUS_MANUAL_FEED 1542 60 #define PD32_PRINTER_STATUS_PAPER_PROBLEM 1543 61 #define PD32_PRINTER_STATUS_OFFLINE 1544 62 #define PD32_PRINTER_STATUS_IO_ACTIVE 1545 63 #define PD32_PRINTER_STATUS_BUSY 1546 64 #define PD32_PRINTER_STATUS_PRINTING 1547 65 #define PD32_PRINTER_STATUS_OUTPUT_BIN_FULL 1548 66 #define PD32_PRINTER_STATUS_NOT_AVAILABLE 1549 67 #define PD32_PRINTER_STATUS_WAITING 1550 68 #define PD32_PRINTER_STATUS_PROCESSING 1551 69 #define PD32_PRINTER_STATUS_INITIALIZING 1552 70 #define PD32_PRINTER_STATUS_WARMING_UP 1553 71 #define PD32_PRINTER_STATUS_TONER_LOW 1554 72 #define PD32_PRINTER_STATUS_NO_TONER 1555 73 #define PD32_PRINTER_STATUS_PAGE_PUNT 1556 74 #define PD32_PRINTER_STATUS_USER_INTERVENTION 1557 75 #define PD32_PRINTER_STATUS_OUT_OF_MEMORY 1558 76 #define PD32_PRINTER_STATUS_DOOR_OPEN 1559 77 #define PD32_PRINTER_STATUS_SERVER_UNKNOWN 1560 78 #define PD32_PRINTER_STATUS_POWER_SAVE 1561 79 80 #define PD32_DEFAULT_PRINTER 1582 81 #define PD32_NR_OF_DOCUMENTS_IN_QUEUE 1583 82 #define PD32_PRINT_ALL_X_PAGES 1584 83 #define PD32_MARGINS_IN_INCHES 1585 84 #define PD32_MARGINS_IN_MILIMETERS 1586 85 #define PD32_MILIMETERS 1587 41 86 42 87 #include "commctrl.h" 43 extern HDPA (* WINAPI COMDLG32_DPA_Create) (INT); 44 extern LPVOID (* WINAPI COMDLG32_DPA_GetPtr) (const HDPA, INT); 45 extern LPVOID (* WINAPI COMDLG32_DPA_DeleteAllPtrs) (const HDPA hdpa); 46 extern LPVOID (* WINAPI COMDLG32_DPA_DeletePtr) (const HDPA hdpa, INT i); 47 extern INT (* WINAPI COMDLG32_DPA_InsertPtr) (const HDPA, INT, LPVOID); 48 extern BOOL (* WINAPI COMDLG32_DPA_Destroy) (const HDPA); 88 #include "wine/undocshell.h" 89 #include "shellapi.h" 49 90 50 extern HICON (* WINAPI COMDLG32_ImageList_GetIcon) (HIMAGELIST, INT, UINT); 51 extern HIMAGELIST (* WINAPI COMDLG32_ImageList_LoadImageA) (HINSTANCE, LPCSTR, INT, INT, COLORREF, UINT, UINT); 52 extern BOOL (* WINAPI COMDLG32_ImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle); 53 extern BOOL (* WINAPI COMDLG32_ImageList_Destroy) (HIMAGELIST himl); 91 /* DPA */ 92 extern HDPA (WINAPI* COMDLG32_DPA_Create) (INT); 93 extern LPVOID (WINAPI* COMDLG32_DPA_GetPtr) (const HDPA, INT); 94 extern LPVOID (WINAPI* COMDLG32_DPA_DeleteAllPtrs) (const HDPA hdpa); 95 extern LPVOID (WINAPI* COMDLG32_DPA_DeletePtr) (const HDPA hdpa, INT i); 96 extern INT (WINAPI* COMDLG32_DPA_InsertPtr) (const HDPA, INT, LPVOID); 97 extern BOOL (WINAPI* COMDLG32_DPA_Destroy) (const HDPA); 98 99 /* IMAGELIST */ 100 extern HICON (WINAPI* COMDLG32_ImageList_GetIcon) (HIMAGELIST, INT, UINT); 101 extern HIMAGELIST (WINAPI *COMDLG32_ImageList_LoadImageA) (HINSTANCE, LPCSTR, INT, INT, COLORREF, UINT, UINT); 102 extern BOOL (WINAPI* COMDLG32_ImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle); 103 extern BOOL (WINAPI* COMDLG32_ImageList_Destroy) (HIMAGELIST himl); 104 105 /* ITEMIDLIST */ 106 107 extern LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILClone) (LPCITEMIDLIST); 108 extern LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILCombine)(LPCITEMIDLIST,LPCITEMIDLIST); 109 extern LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILGetNext)(LPITEMIDLIST); 110 extern BOOL (WINAPI *COMDLG32_PIDL_ILRemoveLastID)(LPCITEMIDLIST); 111 extern BOOL (WINAPI *COMDLG32_PIDL_ILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST); 112 113 /* SHELL */ 114 extern BOOL (WINAPI *COMDLG32_SHGetPathFromIDListA) (LPCITEMIDLIST,LPSTR); 115 extern HRESULT (WINAPI *COMDLG32_SHGetSpecialFolderLocation)(HWND,INT,LPITEMIDLIST *); 116 extern DWORD (WINAPI *COMDLG32_SHGetDesktopFolder)(IShellFolder **); 117 extern DWORD (WINAPI *COMDLG32_SHGetFileInfoA)(LPCSTR,DWORD,SHFILEINFOA*,UINT,UINT); 118 extern DWORD (WINAPI *COMDLG32_SHFree)(LPVOID); 119 120 /* PATH */ 121 extern BOOL (WINAPI *COMDLG32_PathIsRootA)(LPCSTR x); 122 extern LPCSTR (WINAPI *COMDLG32_PathFindFilenameA)(LPCSTR path); 123 extern DWORD (WINAPI *COMDLG32_PathRemoveFileSpecA)(LPSTR fn); 124 extern BOOL (WINAPI *COMDLG32_PathMatchSpecW)(LPCWSTR x, LPCWSTR y); 125 extern LPSTR (WINAPI *COMDLG32_PathAddBackslashA)(LPSTR path); 54 126 #endif 55 127 -
trunk/src/comdlg32/cdlg32.cpp
r1548 r1556 1 /* $Id: cdlg32.cpp,v 1. 1 1999-11-02 19:09:41sandervl Exp $ */1 /* $Id: cdlg32.cpp,v 1.2 1999-11-02 20:37:42 sandervl Exp $ */ 2 2 /* 3 * Common Dialog Boxes interface (32 bit) (990815)4 * Find/Replace 3 * Common Dialog Boxes interface (32 bit) 4 * Find/Replace 5 5 * 6 6 * Copyright 1999 Bertho A. Stultiens 7 7 */ 8 8 9 #ifdef __WIN32OS2__ 10 // ><DJR 17.05.99 Force to use C-interfaces for now to prevent CALLBACK definition compiler error 11 #define CINTERFACE 1 9 12 #include <os2win.h> 13 #else 14 #include "winbase.h" 15 #endif 10 16 #include "commdlg.h" 11 17 #include "cderr.h" … … 16 22 #include "cdlg.h" 17 23 24 18 25 HINSTANCE COMDLG32_hInstance = 0; 19 HINSTANCE16 COMDLG32_hInstance16 = 0;20 26 21 27 static DWORD COMDLG32_TlsIndex; … … 25 31 HINSTANCE SHELL32_hInstance = 0; 26 32 27 HDPA (* WINAPI COMDLG32_DPA_Create) (INT); 28 LPVOID (* WINAPI COMDLG32_DPA_GetPtr) (const HDPA, INT); 29 LPVOID (* WINAPI COMDLG32_DPA_DeleteAllPtrs) (const HDPA hdpa); 30 LPVOID (* WINAPI COMDLG32_DPA_DeletePtr) (const HDPA hdpa, INT i); 31 INT (* WINAPI COMDLG32_DPA_InsertPtr) (const HDPA, INT, LPVOID); 32 BOOL (* WINAPI COMDLG32_DPA_Destroy) (const HDPA); 33 34 HICON (* WINAPI COMDLG32_ImageList_GetIcon) (HIMAGELIST, INT, UINT); 35 HIMAGELIST (* WINAPI COMDLG32_ImageList_LoadImageA) (HINSTANCE, LPCSTR, INT, INT, COLORREF, UINT, UINT); 36 BOOL (* WINAPI COMDLG32_ImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle); 37 BOOL (* WINAPI COMDLG32_ImageList_Destroy) (HIMAGELIST himl); 33 /* DPA */ 34 HDPA (WINAPI* COMDLG32_DPA_Create) (INT); 35 LPVOID (WINAPI* COMDLG32_DPA_GetPtr) (const HDPA, INT); 36 LPVOID (WINAPI* COMDLG32_DPA_DeletePtr) (const HDPA hdpa, INT i); 37 LPVOID (WINAPI* COMDLG32_DPA_DeleteAllPtrs) (const HDPA hdpa); 38 INT (WINAPI* COMDLG32_DPA_InsertPtr) (const HDPA, INT, LPVOID); 39 BOOL (WINAPI* COMDLG32_DPA_Destroy) (const HDPA); 40 41 /* IMAGELIST */ 42 HICON (WINAPI* COMDLG32_ImageList_GetIcon) (HIMAGELIST, INT, UINT); 43 HIMAGELIST (WINAPI *COMDLG32_ImageList_LoadImageA) (HINSTANCE, LPCSTR, INT, INT, COLORREF, UINT, UINT); 44 BOOL (WINAPI* COMDLG32_ImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle); 45 BOOL (WINAPI* COMDLG32_ImageList_Destroy) (HIMAGELIST himl); 46 47 /* ITEMIDLIST */ 48 LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILClone) (LPCITEMIDLIST); 49 LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILCombine)(LPCITEMIDLIST,LPCITEMIDLIST); 50 LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILGetNext)(LPITEMIDLIST); 51 BOOL (WINAPI *COMDLG32_PIDL_ILRemoveLastID)(LPCITEMIDLIST); 52 BOOL (WINAPI *COMDLG32_PIDL_ILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST); 53 54 /* SHELL */ 55 BOOL (WINAPI *COMDLG32_SHGetPathFromIDListA) (LPCITEMIDLIST,LPSTR); 56 HRESULT (WINAPI *COMDLG32_SHGetSpecialFolderLocation)(HWND,INT,LPITEMIDLIST *); 57 DWORD (WINAPI *COMDLG32_SHGetDesktopFolder)(IShellFolder **); 58 DWORD (WINAPI *COMDLG32_SHGetFileInfoA)(LPCSTR,DWORD,SHFILEINFOA*,UINT,UINT); 59 DWORD (WINAPI *COMDLG32_SHFree)(LPVOID); 60 61 /* PATH */ 62 BOOL (WINAPI *COMDLG32_PathIsRootA)(LPCSTR x); 63 LPCSTR (WINAPI *COMDLG32_PathFindFilenameA)(LPCSTR path); 64 DWORD (WINAPI *COMDLG32_PathRemoveFileSpecA)(LPSTR fn); 65 BOOL (WINAPI *COMDLG32_PathMatchSpecW)(LPCWSTR x, LPCWSTR y); 66 LPSTR (WINAPI *COMDLG32_PathAddBackslashA)(LPSTR path); 38 67 39 68 /*********************************************************************** … … 48 77 BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved) 49 78 { 50 //TRACE("(%08x, %08lx, %p)\n", hInstance, Reason, Reserved);79 TRACE("(%08x, %08lx, %p)\n", hInstance, Reason, Reserved); 51 80 52 81 switch(Reason) … … 56 85 if(COMDLG32_hInstance) 57 86 { 58 dprintf(("comdlg32.dll instantiated twice in one address space!\n"));87 ERR("comdlg32.dll instantiated twice in one address space!\n"); 59 88 /* 60 89 * We should return FALSE here, but that will break … … 70 99 if((COMDLG32_TlsIndex = TlsAlloc()) == 0xffffffff) 71 100 { 72 dprintf(("No space for COMDLG32 TLS\n"));101 ERR("No space for COMDLG32 TLS\n"); 73 102 return FALSE; 74 103 } … … 79 108 if (!COMCTL32_hInstance || !SHELL32_hInstance) 80 109 { 81 dprintf(("loading of comctl32 or shell32 failed\n"));110 ERR("loading of comctl32 or shell32 or shlwapi failed\n"); 82 111 return FALSE; 83 112 } 84 113 /* DPA */ 85 114 *(VOID **)&COMDLG32_DPA_Create=(void*)GetProcAddress(COMCTL32_hInstance, (LPCSTR)328L); 86 115 *(VOID **)&COMDLG32_DPA_Destroy=(void*)GetProcAddress(COMCTL32_hInstance, (LPCSTR)329L); … … 90 119 *(VOID **)&COMDLG32_DPA_DeleteAllPtrs=(void*)GetProcAddress(COMCTL32_hInstance, (LPCSTR)337L); 91 120 121 /* IMAGELIST */ 92 122 *(VOID **)&COMDLG32_ImageList_GetIcon=(void*)GetProcAddress(COMCTL32_hInstance,"ImageList_GetIcon"); 93 123 *(VOID **)&COMDLG32_ImageList_LoadImageA=(void*)GetProcAddress(COMCTL32_hInstance,"ImageList_LoadImageA"); 94 124 *(VOID **)&COMDLG32_ImageList_Draw=(void*)GetProcAddress(COMCTL32_hInstance,"ImageList_Draw"); 95 125 *(VOID **)&COMDLG32_ImageList_Destroy=(void*)GetProcAddress(COMCTL32_hInstance,"ImageList_Destroy"); 126 127 /* ITEMISLIST */ 128 129 *(VOID **)&COMDLG32_PIDL_ILIsEqual =(void*)GetProcAddress(SHELL32_hInstance, (LPCSTR)21L); 130 *(VOID **)&COMDLG32_PIDL_ILCombine =(void*)GetProcAddress(SHELL32_hInstance, (LPCSTR)25L); 131 *(VOID **)&COMDLG32_PIDL_ILGetNext =(void*)GetProcAddress(SHELL32_hInstance, (LPCSTR)153L); 132 *(VOID **)&COMDLG32_PIDL_ILClone =(void*)GetProcAddress(SHELL32_hInstance, (LPCSTR)18L); 133 *(VOID **)&COMDLG32_PIDL_ILRemoveLastID =(void*)GetProcAddress(SHELL32_hInstance, (LPCSTR)17L); 134 135 /* SHELL */ 136 137 *(VOID **)&COMDLG32_SHFree = (void*)GetProcAddress(SHELL32_hInstance,"SHFree"); 138 *(VOID **)&COMDLG32_SHGetSpecialFolderLocation = (void*)GetProcAddress(SHELL32_hInstance,"SHGetSpecialFolderLocation"); 139 *(VOID **)&COMDLG32_SHGetPathFromIDListA = (void*)GetProcAddress(SHELL32_hInstance,"SHGetPathFromIDListA"); 140 *(VOID **)&COMDLG32_SHGetDesktopFolder = (void*)GetProcAddress(SHELL32_hInstance,"SHGetDesktopFolder"); 141 *(VOID **)&COMDLG32_SHGetFileInfoA = (void*)GetProcAddress(SHELL32_hInstance,"SHGetFileInfoA"); 142 143 /* ### WARINIG ### 144 We can't do a GetProcAddress to link to StrRetToBuf[A|W] sine not all 145 versions of the shlwapi are exporting these functions. When we are 146 seperating the dlls then we have to dublicate code from shell32 into comdlg32. 147 Till then just call these functions. These functions don't have any side effects 148 so it won't break the use of any combination of native and buildin dll's (jsch) */ 149 150 /* PATH */ 151 *(VOID **)&COMDLG32_PathMatchSpecW = (void*)GetProcAddress(SHELL32_hInstance,"PathMatchSpecW"); 152 *(VOID **)&COMDLG32_PathIsRootA = (void*)GetProcAddress(SHELL32_hInstance,"PathIsRootA"); 153 *(VOID **)&COMDLG32_PathRemoveFileSpecA = (void*)GetProcAddress(SHELL32_hInstance,"PathRemoveFileSpecA"); 154 *(VOID **)&COMDLG32_PathFindFilenameA = (void*)GetProcAddress(SHELL32_hInstance,"PathFindFileNameA"); 155 *(VOID **)&COMDLG32_PathAddBackslashA = (void*)GetProcAddress(SHELL32_hInstance,"PathAddBackslashA"); 96 156 break; 97 157 … … 138 198 void COMDLG32_SetCommDlgExtendedError(DWORD err) 139 199 { 200 TRACE("(%08lx)\n", err); 140 201 TlsSetValue(COMDLG32_TlsIndex, (void *)err); 141 202 } -
trunk/src/comdlg32/comdlg32.cpp
r1548 r1556 1 /* $Id: comdlg32.cpp,v 1.1 6 1999-11-02 19:09:42 sandervl Exp $ */1 /* $Id: comdlg32.cpp,v 1.17 1999-11-02 20:37:42 sandervl Exp $ */ 2 2 3 3 /* … … 76 76 *****************************************************************************/ 77 77 78 ODINFUNCTION1(BOOL, GetSaveFileNameA 32,78 ODINFUNCTION1(BOOL, GetSaveFileNameA, 79 79 LPOPENFILENAMEA, lpofn) 80 80 { … … 102 102 *****************************************************************************/ 103 103 104 ODINFUNCTION1(BOOL, GetSaveFileNameW 32,104 ODINFUNCTION1(BOOL, GetSaveFileNameW, 105 105 LPOPENFILENAMEW, lpofn) 106 106 { … … 225 225 *****************************************************************************/ 226 226 227 ODINFUNCTION1(BOOL, GetOpenFileNameA 32,227 ODINFUNCTION1(BOOL, GetOpenFileNameA, 228 228 LPOPENFILENAMEA, lpofn) 229 229 { … … 250 250 *****************************************************************************/ 251 251 252 ODINFUNCTION1(BOOL, GetOpenFileNameW 32,252 ODINFUNCTION1(BOOL, GetOpenFileNameW, 253 253 LPOPENFILENAMEW, lpofn) 254 254 { -
trunk/src/comdlg32/comdlg32.def
r1548 r1556 1 ; $Id: comdlg32.def,v 1. 3 1999-11-02 19:09:42 sandervl Exp $1 ; $Id: comdlg32.def,v 1.4 1999-11-02 20:37:42 sandervl Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 15 15 GetFileTitleA = _GetFileTitleA32@12 @8 16 16 GetFileTitleW = _GetFileTitleW32@12 @9 17 GetOpenFileNameA = _GetOpenFileNameA 32@4 @1018 GetOpenFileNameW = _GetOpenFileNameW 32@4 @1119 GetSaveFileNameA = _GetSaveFileNameA 32@4 @1220 GetSaveFileNameW = _GetSaveFileNameW 32@4 @1317 GetOpenFileNameA = _GetOpenFileNameA@4 @10 18 GetOpenFileNameW = _GetOpenFileNameW@4 @11 19 GetSaveFileNameA = _GetSaveFileNameA@4 @12 20 GetSaveFileNameW = _GetSaveFileNameW@4 @13 21 21 PageSetupDlgA = _PageSetupDlgA@4 @14 22 22 PageSetupDlgW = _PageSetupDlgW@4 @15 -
trunk/src/comdlg32/filedlg95.cpp
r1548 r1556 1 /* $Id: filedlg95.cpp,v 1. 1 1999-11-02 19:09:42 sandervl Exp $ */1 /* $Id: filedlg95.cpp,v 1.2 1999-11-02 20:37:42 sandervl Exp $ */ 2 2 /* 3 * COMMDLG - File Open Dialogs Win95 look and feel (990815) 4 * 5 */ 6 // ><DJR 17.05.99 Force to use C-interfaces for now to prevent CALLBACK definition compiler error 7 #define CINTERFACE 1 8 3 * COMMDLG - File Open Dialogs Win95 look and feel 4 * 5 */ 9 6 #include <ctype.h> 10 7 #include <stdlib.h> 11 8 #include <string.h> 9 #ifdef __WIN32OS2__ 10 // ><DJR 17.05.99 Force to use C-interfaces for now to prevent CALLBACK definition compiler error 11 #define CINTERFACE 1 12 12 #include <os2win.h> 13 #else 14 #include "winbase.h" 15 #include "tweak.h" 16 #endif 13 17 #include "ldt.h" 14 18 #include "heap.h" 15 19 #include "commdlg.h" 16 20 #include "dlgs.h" 21 #include "cdlg.h" 17 22 #include "debugtools.h" 18 23 #include "cderr.h" 19 //#include "tweak.h"20 24 #include "winnls.h" 21 25 #include "shellapi.h" 22 #include "commctrl.h"23 26 #include "tchar.h" 24 27 #include "filedlgbrowser.h" 25 #include "wine/undocshell.h"26 28 #include "wine/obj_contextmenu.h" 27 29 30 #ifdef __WIN32OS2__ 31 #include <heapstring.h> 32 33 #define MapHModuleSL(a) a 34 #define MapHModuleLS(a) a 35 #endif 36 28 37 DEFAULT_DEBUG_CHANNEL(commdlg) 29 38 30 #include "cdlg.h"31 32 #include <heapstring.h>33 39 34 40 /*********************************************************************** … … 105 111 #define CBShowDropDown(hwnd,show) \ 106 112 SendMessageA(hwnd,CB_SHOWDROPDOWN,(WPARAM)show,0); 113 #define CBSetItemHeight(hwnd,index,height) \ 114 SendMessageA(hwnd,CB_SETITEMHEIGHT,(WPARAM)index,(LPARAM)height); 107 115 108 116 … … 129 137 static BOOL FILEDLG95_SHELL_ExecuteCommand(HWND hwnd, LPCSTR lpVerb); 130 138 static BOOL FILEDLG95_SHELL_NewFolder(HWND hwnd); 131 BOOL FILEDLG95_SHELL_FillIncludedItemList(HWND hwnd,132 LPITEMIDLIST pidlCurrentFolder,133 LPSTR lpstrMask);134 139 static void FILEDLG95_SHELL_Clean(HWND hwnd); 140 135 141 /* Functions used by the filetype combo box */ 136 142 static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd); … … 159 165 /* Shell memory allocation */ 160 166 char *MemAlloc(UINT size); 161 void 167 void MemFree(void *mem); 162 168 163 169 BOOL WINAPI GetOpenFileName95(FileOpenDlgInfos *fodInfos); … … 179 185 180 186 LRESULT lRes; 181 LPCVOID dlgtemplate;187 LPCVOID templateDlg; 182 188 HRSRC hRes; 183 189 HANDLE hDlgTmpl = 0; … … 185 191 /* Create the dialog from a template */ 186 192 187 if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE)188 {189 #ifdef __WIN32OS2__190 if (!(dlgtemplate = LockResource( fodInfos->ofnInfos.hInstance)))191 #else192 if (!(dlgtemplate = LockResource( MapHModuleSL(fodInfos->ofnInfos.hInstance ))))193 #endif194 {195 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);196 return FALSE;197 }198 }199 else if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATE)200 {201 #ifdef __WIN32OS2__202 if (!(hRes = FindResourceA(fodInfos->ofnInfos.hInstance,203 #else204 if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos.hInstance),205 #endif206 (fodInfos->ofnInfos.lpTemplateName), RT_DIALOGA)))207 {208 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);209 return FALSE;210 }211 #ifdef __WIN32OS2__212 if (!(hDlgTmpl = LoadResource( fodInfos->ofnInfos.hInstance,213 #else214 if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos.hInstance),215 #endif216 hRes )) ||217 !(dlgtemplate = LockResource( hDlgTmpl )))218 {219 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);220 return FALSE;221 }222 }223 else224 {225 193 if(!(hRes = FindResourceA(COMDLG32_hInstance,MAKEINTRESOURCEA(IDD_OPENDIALOG),RT_DIALOGA))) 226 194 { … … 229 197 } 230 198 if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hRes )) || 231 !( dlgtemplate= LockResource( hDlgTmpl )))199 !(templateDlg = LockResource( hDlgTmpl ))) 232 200 { 233 201 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 234 202 return FALSE; 235 203 } 236 }237 238 204 lRes = DialogBoxIndirectParamA(COMDLG32_hInstance, 239 (LPDLGTEMPLATEA) dlgtemplate,205 (LPDLGTEMPLATEA) templateDlg, 240 206 fodInfos->ofnInfos.hwndOwner, 241 207 (DLGPROC) FileOpenDlgProc95, … … 263 229 264 230 LRESULT lRes; 265 LPCVOID dlgtemplate;231 LPCVOID templateDlg; 266 232 HRSRC hRes; 267 233 HANDLE hDlgTmpl = 0; … … 269 235 /* Create the dialog from a template */ 270 236 271 if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE)272 {273 #ifdef __WIN32OS2__274 if (!(dlgtemplate = LockResource( fodInfos->ofnInfos.hInstance)))275 #else276 if (!(dlgtemplate = LockResource( MapHModuleSL(fodInfos->ofnInfos.hInstance ))))277 #endif278 {279 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);280 return FALSE;281 }282 }283 else if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATE)284 {285 #ifdef __WIN32OS2__286 if (!(hRes = FindResourceA(fodInfos->ofnInfos.hInstance,287 #else288 if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos.hInstance),289 #endif290 (fodInfos->ofnInfos.lpTemplateName), RT_DIALOGA)))291 {292 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);293 return FALSE;294 }295 #ifdef __WIN32OS2__296 if (!(hDlgTmpl = LoadResource( fodInfos->ofnInfos.hInstance,297 #else298 if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos.hInstance),299 #endif300 hRes )) ||301 !(dlgtemplate = LockResource( hDlgTmpl )))302 {303 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);304 return FALSE;305 }306 }307 else308 {309 237 if(!(hRes = FindResourceA(COMDLG32_hInstance,MAKEINTRESOURCEA(IDD_SAVEDIALOG),RT_DIALOGA))) 310 238 { … … 313 241 } 314 242 if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hRes )) || 315 !( dlgtemplate= LockResource( hDlgTmpl )))243 !(templateDlg = LockResource( hDlgTmpl ))) 316 244 { 317 245 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 318 246 return FALSE; 319 247 } 320 }321 248 lRes = DialogBoxIndirectParamA(COMDLG32_hInstance, 322 (LPDLGTEMPLATEA) dlgtemplate,249 (LPDLGTEMPLATEA) templateDlg, 323 250 fodInfos->ofnInfos.hwndOwner, 324 251 (DLGPROC) FileOpenDlgProc95, … … 350 277 memset(&fodInfos->ofnInfos,'\0',sizeof(*ofn)); fodInfos->ofnInfos.lStructSize = sizeof(*ofn); 351 278 fodInfos->ofnInfos.hwndOwner = ofn->hwndOwner; 352 #ifdef __WIN32OS2__353 fodInfos->ofnInfos.hInstance = ofn->hInstance;354 #else355 279 fodInfos->ofnInfos.hInstance = MapHModuleLS(ofn->hInstance); 356 #endif357 280 if (ofn->lpstrFilter) 358 281 { … … 377 300 s = s+strlen(s)+1; 378 301 s++; 379 x = (LPSTR)MemAlloc(s-ofn->lpstrCustomFilter);302 x = MemAlloc(s-ofn->lpstrCustomFilter); 380 303 memcpy(x,ofn->lpstrCustomFilter,s-ofn->lpstrCustomFilter); 381 304 fodInfos->ofnInfos.lpstrCustomFilter = (LPSTR)x; … … 395 318 if (ofn->lpstrInitialDir) 396 319 { 397 fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(strlen(ofn->lpstrInitialDir) );320 fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(strlen(ofn->lpstrInitialDir)+1); 398 321 strcpy((LPSTR)fodInfos->ofnInfos.lpstrInitialDir,ofn->lpstrInitialDir); 399 322 } … … 401 324 if (ofn->lpstrTitle) 402 325 { 403 fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(strlen(ofn->lpstrTitle) );326 fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(strlen(ofn->lpstrTitle)+1); 404 327 strcpy((LPSTR)fodInfos->ofnInfos.lpstrTitle,ofn->lpstrTitle); 405 328 } … … 410 333 if (ofn->lpstrDefExt) 411 334 { 412 fodInfos->ofnInfos.lpstrDefExt = (char *)MemAlloc(strlen(ofn->lpstrDefExt));335 fodInfos->ofnInfos.lpstrDefExt = MemAlloc(strlen(ofn->lpstrDefExt)+1); 413 336 strcpy((LPSTR)fodInfos->ofnInfos.lpstrDefExt,ofn->lpstrDefExt); 414 337 } … … 418 341 if (ofn->lpTemplateName) 419 342 { 420 /* template don't work - using normal dialog */ 421 /* fodInfos->ofnInfos.lpTemplateName = MemAlloc(strlen(ofn->lpTemplateName)); 422 strcpy((LPSTR)fodInfos->ofnInfos.lpTemplateName,ofn->lpTemplateName);*/ 423 fodInfos->ofnInfos.Flags &= ~OFN_ENABLETEMPLATEHANDLE; 424 fodInfos->ofnInfos.Flags &= ~OFN_ENABLETEMPLATE; 425 FIXME("File dialog 95 template not implemented\n"); 426 343 fodInfos->ofnInfos.lpTemplateName = ofn->lpTemplateName; 427 344 } 428 345 … … 430 347 if(!ofn->lpstrInitialDir) 431 348 { 432 fodInfos->ofnInfos.lpstrInitialDir = (char *)MemAlloc(MAX_PATH);349 fodInfos->ofnInfos.lpstrInitialDir = MemAlloc(MAX_PATH); 433 350 GetCurrentDirectoryA(MAX_PATH,(LPSTR)fodInfos->ofnInfos.lpstrInitialDir); 434 351 } 435 352 353 /* Initialise the dialog property */ 354 fodInfos->DlgInfos.dwDlgProp = 0; 355 436 356 switch(iDlgType) 437 357 { … … 440 360 break; 441 361 case SAVE_DIALOG : 362 fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG; 442 363 ret = GetSaveFileName95(fodInfos); 443 364 break; … … 497 418 fodInfos->ofnInfos.lStructSize = sizeof(*ofn); 498 419 fodInfos->ofnInfos.hwndOwner = ofn->hwndOwner; 499 #ifdef __WIN32OS2__500 fodInfos->ofnInfos.hInstance = ofn->hInstance;501 #else502 420 fodInfos->ofnInfos.hInstance = MapHModuleLS(ofn->hInstance); 503 #endif504 421 if (ofn->lpstrFilter) 505 422 { … … 555 472 fodInfos->ofnInfos.lpstrFileTitle = (LPSTR)MemAlloc(ofn->nMaxFileTitle); 556 473 if (ofn->lpstrInitialDir) 557 fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrInitialDir)); 474 { 475 fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrInitialDir)+1); 476 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrInitialDir,(LPWSTR)ofn->lpstrInitialDir); 477 } 558 478 if (ofn->lpstrTitle) 559 fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrTitle)); 479 { 480 fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrTitle)+1); 481 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrTitle,(LPWSTR)ofn->lpstrTitle); 482 } 560 483 fodInfos->ofnInfos.Flags = ofn->Flags|OFN_WINE|OFN_UNICODE; 561 484 fodInfos->ofnInfos.nFileOffset = ofn->nFileOffset; 562 485 fodInfos->ofnInfos.nFileExtension = ofn->nFileExtension; 563 486 if (ofn->lpstrDefExt) 564 fodInfos->ofnInfos.lpstrDefExt = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrDefExt)); 487 { 488 fodInfos->ofnInfos.lpstrDefExt = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrDefExt)+1); 489 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrDefExt,(LPWSTR)ofn->lpstrDefExt); 490 } 565 491 fodInfos->ofnInfos.lCustData = ofn->lCustData; 566 492 fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook; 567 493 if (ofn->lpTemplateName) 568 fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName)); 494 { 495 fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName)+1); 496 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpTemplateName,(LPWSTR)ofn->lpTemplateName); 497 } 498 /* Initialise the dialog property */ 499 fodInfos->DlgInfos.dwDlgProp = 0; 500 569 501 switch(iDlgType) 570 502 { … … 573 505 break; 574 506 case SAVE_DIALOG : 507 fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG; 575 508 ret = GetSaveFileName95(fodInfos); 576 509 break; … … 579 512 } 580 513 581 582 514 /* Cleaning */ 583 515 ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset; … … 612 544 } 613 545 546 void ArrangeCtrlPositions( HWND hwndChildDlg, HWND hwndParentDlg) 547 { 548 549 HWND hwndChild,hwndStc32; 550 RECT rectParent,rectChild,rectCtrl,rectStc32; 551 POINT ptMoveCtl; 552 HDWP handle; 553 POINT ptParentClient; 554 555 ptMoveCtl.x = ptMoveCtl.y = 0; 556 hwndStc32=GetDlgItem(hwndChildDlg,stc32); 557 GetClientRect(hwndParentDlg,&rectParent); 558 GetClientRect(hwndChildDlg,&rectChild); 559 if(hwndStc32) 560 { 561 RECT rectTemp; 562 GetWindowRect(hwndStc32,&rectStc32); 563 MapWindowPoints(0, hwndChildDlg,(LPPOINT)&rectStc32,2); 564 CopyRect(&rectTemp,&rectStc32); 565 566 SetRect(&rectStc32,rectStc32.left,rectStc32.top,rectStc32.left + (rectParent.right-rectParent.left),rectStc32.top+(rectParent.bottom-rectParent.top)); 567 SetWindowPos(hwndStc32,0,rectStc32.left,rectStc32.top,rectStc32.right-rectStc32.left,rectStc32.bottom-rectStc32.top,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE); 568 if(rectStc32.right < rectTemp.right) 569 { 570 ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left)); 571 ptMoveCtl.x = 0; 572 } 573 else 574 { 575 ptMoveCtl.x = (rectStc32.right - rectTemp.right); 576 ptParentClient.x = max((rectParent.right-rectParent.left),((rectChild.right-rectChild.left)+rectStc32.right-rectTemp.right)); 577 } 578 if(rectStc32.bottom < rectTemp.bottom) 579 { 580 ptParentClient.y = max((rectParent.bottom-rectParent.top),(rectChild.bottom-rectChild.top)); 581 ptMoveCtl.y = 0; 582 } 583 else 584 { 585 ptMoveCtl.y = (rectStc32.bottom - rectTemp.bottom); 586 ptParentClient.y = max((rectParent.bottom-rectParent.top),((rectChild.bottom-rectChild.top)+rectStc32.bottom-rectTemp.bottom)); 587 } 588 } 589 else 590 { 591 if( (GetWindow(hwndChildDlg,GW_CHILD)) == (HWND) NULL) 592 return; 593 ptParentClient.x = rectParent.right-rectParent.left; 594 ptParentClient.y = (rectParent.bottom-rectParent.top) + (rectChild.bottom-rectChild.top); 595 ptMoveCtl.y = rectParent.bottom-rectParent.top; 596 ptMoveCtl.x=0; 597 } 598 SetRect(&rectParent,rectParent.left,rectParent.top,rectParent.left+ptParentClient.x,rectParent.top+ptParentClient.y); 599 AdjustWindowRectEx( &rectParent,GetWindowLongA(hwndParentDlg,GWL_STYLE),FALSE,GetWindowLongA(hwndParentDlg,GWL_EXSTYLE)); 600 601 SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y, 602 SWP_NOZORDER ); 603 SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left), 604 (rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER); 605 606 hwndChild = GetWindow(hwndChildDlg,GW_CHILD); 607 handle = BeginDeferWindowPos( 1 ); 608 if(hwndStc32) 609 { 610 GetWindowRect(hwndStc32,&rectStc32); 611 MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2); 612 } 613 else 614 SetRect(&rectStc32,0,0,0,0); 615 if (hwndChild && handle) 616 { 617 do 618 { 619 if(hwndChild != hwndStc32) 620 { 621 if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE) 622 continue; 623 GetWindowRect(hwndChild,&rectCtrl); 624 MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2); 625 if(rectCtrl.top > rectStc32.top) 626 { 627 628 if(ptMoveCtl.x > 0) 629 rectCtrl.left += ptMoveCtl.x; 630 rectCtrl.top += ptMoveCtl.y; 631 handle = DeferWindowPos(handle, hwndChild, 0, rectCtrl.left, rectCtrl.top, 632 rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top, 633 SWP_NOSIZE | SWP_NOZORDER ); 634 } 635 } 636 } 637 while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL && handle); 638 } 639 if(handle) 640 EndDeferWindowPos( handle ); 641 handle = BeginDeferWindowPos( 1 ); 642 hwndChild = GetWindow(hwndParentDlg,GW_CHILD); 643 if(hwndStc32) 644 { 645 GetWindowRect(hwndStc32,&rectStc32); 646 MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2); 647 ptMoveCtl.x = rectStc32.left - 0; 648 ptMoveCtl.y = rectStc32.top - 0; 649 if (hwndChild && handle) 650 { 651 do 652 { 653 if(hwndChild != hwndChildDlg) 654 { 655 656 if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE) 657 continue; 658 GetWindowRect(hwndChild,&rectCtrl); 659 MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2); 660 661 rectCtrl.left += ptMoveCtl.x; 662 rectCtrl.top += ptMoveCtl.y; 663 664 handle = DeferWindowPos( handle, hwndChild, 0, rectCtrl.left, rectCtrl.top, 665 rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top, 666 SWP_NOSIZE |SWP_NOZORDER ); 667 } 668 } 669 while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL); 670 } 671 if(handle) 672 EndDeferWindowPos( handle ); 673 } 674 675 } 676 677 678 HRESULT WINAPI FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 679 { 680 static WNDPROC procUserHook=NULL; 681 switch(uMsg) 682 { 683 case WM_INITDIALOG: 684 { 685 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *)lParam; 686 procUserHook=NULL; 687 lParam = (LPARAM) &fodInfos->ofnInfos; 688 ArrangeCtrlPositions(hwnd,GetParent(hwnd)); 689 if(fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK) 690 procUserHook = (WNDPROC) fodInfos->ofnInfos.lpfnHook; 691 if(procUserHook) 692 return CallWindowProcA(procUserHook,hwnd,uMsg,wParam,lParam); 693 return 0; 694 } } 695 if(procUserHook) 696 return CallWindowProcA(procUserHook,hwnd,uMsg,wParam,lParam); 697 return DefWindowProcA(hwnd,uMsg,wParam,lParam); 698 } 699 700 HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos,HWND hwnd) 701 { 702 LPCVOID templateDlg; 703 HRSRC hRes; 704 HANDLE hDlgTmpl = 0; 705 HWND hChildDlg = 0; 706 if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATE || fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE) 707 { 708 if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE) 709 { 710 if( !(templateDlg = LockResource( fodInfos->ofnInfos.hInstance))) 711 { 712 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 713 return (HWND)NULL; 714 } 715 716 } 717 else 718 { 719 if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos.hInstance), 720 (fodInfos->ofnInfos.lpTemplateName), RT_DIALOGA))) 721 { 722 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); 723 return (HWND)NULL; 724 } 725 if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos.hInstance), 726 hRes )) || 727 !(templateDlg = LockResource( hDlgTmpl ))) 728 { 729 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 730 return (HWND)NULL; 731 } 732 } 733 734 hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,(LPCDLGTEMPLATEA)templateDlg,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos); 735 if(hChildDlg) 736 { 737 ShowWindow(hChildDlg,SW_SHOW); 738 return hChildDlg; 739 } 740 } 741 else if(fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK && fodInfos->ofnInfos.lpfnHook) 742 { 743 RECT rectHwnd; 744 DLGTEMPLATE tmplate; 745 GetClientRect(hwnd,&rectHwnd); 746 tmplate.style = WS_CHILD | WS_CLIPSIBLINGS; 747 tmplate.dwExtendedStyle = 0; 748 tmplate.cdit = 0; 749 tmplate.x = 0; 750 tmplate.y = 0; 751 tmplate.cx = rectHwnd.right-rectHwnd.left; 752 tmplate.cy = rectHwnd.bottom-rectHwnd.top; 753 754 return CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos); 755 } 756 return (HWND)NULL; 757 } 614 758 615 759 /*********************************************************************** … … 624 768 { 625 769 case WM_INITDIALOG : 770 CreateTemplateDialog((FileOpenDlgInfos *)lParam,hwnd); 626 771 return FILEDLG95_OnWMInitDialog(hwnd, wParam, lParam); 627 772 case WM_COMMAND: … … 637 782 } 638 783 return FALSE; 639 #ifndef __WIN32OS2__784 640 785 case WM_GETISHELLBROWSER: 641 786 return FILEDLG95_OnWMGetIShellBrowser(hwnd); 642 #endif643 787 644 788 case WM_DESTROY: 645 789 RemovePropA(hwnd, FileOpenDlgInfosStr); 790 646 791 default : 647 792 return FALSE; … … 698 843 699 844 /* Free pidlItem memory */ 700 SHFree(pidlItemId);845 COMDLG32_SHFree(pidlItemId); 701 846 702 847 return TRUE; … … 722 867 WORD wNotifyCode = HIWORD(wParam); /* notification code */ 723 868 WORD wID = LOWORD(wParam); /* item, control, or accelerator identifier */ 869 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); 724 870 725 871 switch(wID) … … 763 909 764 910 } 765 911 /* Do not use the listview selection anymore */ 912 fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW; 766 913 return 0; 767 914 } … … 851 998 } 852 999 1000 /* List View is selected by default */ 1001 SendDlgItemMessageA(hwnd, IDC_LIST, BM_SETCHECK,(WPARAM) BST_CHECKED,0); 1002 853 1003 return 0; 854 1004 } … … 863 1013 BOOL FILEDLG95_OnOpen(HWND hwnd) 864 1014 { 865 char lpstr FileName[MAX_PATH];1015 char lpstrSpecifiedByUser[MAX_PATH] = ""; 866 1016 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); 1017 LPITEMIDLIST pidlSelection; 867 1018 868 1019 TRACE("\n"); 869 1020 870 if(GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrFileName,MAX_PATH)) 871 { 872 char *tmp; 873 char lpstrFile[MAX_PATH]; 874 875 /* Get the selected file name and path */ 876 SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent, 877 lpstrFile); 878 if(strcmp(&lpstrFile[strlen(lpstrFile)-1],"\\")) 879 strcat(lpstrFile,"\\"); 880 strcat(lpstrFile,lpstrFileName); 1021 /* Check if there is a selected item in the listview */ 1022 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_USEVIEW) 1023 { 1024 pidlSelection = GetSelectedPidl(fodInfos->Shell.FOIShellView); 1025 GetName(fodInfos->Shell.FOIShellFolder,pidlSelection,SHGDN_NORMAL,lpstrSpecifiedByUser); 1026 COMDLG32_SHFree((LPVOID)pidlSelection); 1027 } 1028 else 1029 /* Get the text from the filename edit */ 1030 GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrSpecifiedByUser,MAX_PATH); 1031 1032 if(strlen(lpstrSpecifiedByUser)) 1033 { 1034 LPSHELLFOLDER psfDesktop; 1035 LPITEMIDLIST browsePidl; 1036 LPSTR lpstrFileSpec; 1037 LPSTR lpstrTemp; 1038 char lpstrPathSpec[MAX_PATH] = ""; 1039 char lpstrCurrentDir[MAX_PATH] = ""; 1040 char lpstrPathAndFile[MAX_PATH] = ""; 1041 1042 /* Separate the file spec from the path spec 1043 e.g.: 1044 lpstrSpecifiedByUser lpstrPathSpec lpstrFileSpec 1045 C:\TEXT1\TEXT2 C:\TEXT1 TEXT2 1046 */ 1047 lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA(lpstrSpecifiedByUser); 1048 strcpy(lpstrPathSpec,lpstrSpecifiedByUser); 1049 COMDLG32_PathRemoveFileSpecA(lpstrPathSpec); 1050 1051 /* Get the current directory name */ 1052 COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent, 1053 lpstrCurrentDir); 1054 1055 /* Create an absolute path name */ 1056 if(lpstrSpecifiedByUser[1] != ':') 1057 { 1058 switch(lpstrSpecifiedByUser[0]) 1059 { 1060 /* Add drive spec \TEXT => C:\TEXT */ 1061 case '\\': 1062 { 1063 INT iCopy = 2; 1064 char lpstrTmp[MAX_PATH] = ""; 1065 if(!strlen(lpstrPathSpec)) 1066 iCopy = 3; 1067 strncpy(lpstrTmp,lpstrCurrentDir,iCopy); 1068 strcat(lpstrTmp,lpstrPathSpec); 1069 strcpy(lpstrPathSpec,lpstrTmp); 1070 } 1071 break; 1072 /* Go to parent ..\TEXT */ 1073 case '.': 1074 { 1075 INT iSize; 1076 char lpstrTmp2[MAX_PATH] = ""; 1077 LPSTR lpstrTmp = strrchr(lpstrCurrentDir,'\\'); 1078 iSize = lpstrTmp - lpstrCurrentDir; 1079 strncpy(lpstrTmp2,lpstrCurrentDir,iSize + 1); 1080 if(strlen(lpstrSpecifiedByUser) <= 3) 1081 strcpy(lpstrFileSpec,""); 1082 if(strcmp(lpstrPathSpec,"..")) 1083 strcat(lpstrTmp2,&lpstrPathSpec[3]); 1084 strcpy(lpstrPathSpec,lpstrTmp2); 1085 } 1086 break; 1087 default: 1088 { 1089 char lpstrTmp[MAX_PATH] = ""; 1090 if(strcmp(&lpstrCurrentDir[strlen(lpstrCurrentDir)-1],"\\")) 1091 strcat(lpstrCurrentDir,"\\"); 1092 strcpy(lpstrTmp,lpstrCurrentDir); 1093 strcat(lpstrTmp,lpstrPathSpec); 1094 strcpy(lpstrPathSpec,lpstrTmp); 1095 } 1096 1097 } /* end switch */ 1098 } 1099 1100 if(strlen(lpstrPathSpec)) 1101 { 1102 /* Browse to the right directory */ 1103 COMDLG32_SHGetDesktopFolder(&psfDesktop); 1104 if((browsePidl = GetPidlFromName(psfDesktop,lpstrPathSpec))) 1105 { 1106 /* Browse to directory */ 1107 IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, 1108 browsePidl, 1109 SBSP_ABSOLUTE); 1110 COMDLG32_SHFree(browsePidl); 1111 } 1112 else 1113 { 1114 /* Path does not exist */ 1115 if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST) 1116 { 1117 MessageBoxA(hwnd, 1118 "Path does not exist", 1119 fodInfos->ofnInfos.lpstrTitle, 1120 MB_OK | MB_ICONEXCLAMATION); 1121 return FALSE; 1122 } 1123 } 1124 1125 strcat(lpstrPathAndFile,lpstrPathSpec); 1126 IShellFolder_Release(psfDesktop); 1127 } 1128 else 1129 { 1130 strcat(lpstrPathAndFile,lpstrCurrentDir); 1131 } 1132 1133 /* Create the path and file string */ 1134 COMDLG32_PathAddBackslashA(lpstrPathAndFile); 1135 strcat(lpstrPathAndFile,lpstrFileSpec); 1136 1137 /* Update the edit field */ 1138 SetDlgItemTextA(hwnd,IDC_FILENAME,lpstrFileSpec); 1139 SendDlgItemMessageA(hwnd,IDC_FILENAME,EM_SETSEL,0,-1); 1140 1141 /* Don't go further if we dont have a file spec */ 1142 if(!strlen(lpstrFileSpec) || !strcmp(lpstrFileSpec,lpstrPathSpec)) 1143 return FALSE; 1144 1145 /* Time to check lpstrFileSpec */ 1146 /* search => contains * or ? */ 1147 /* browse => contains a directory name */ 1148 /* file => contains a file name */ 881 1149 882 1150 /* Check if this is a search */ 883 if(strchr(lpstrFileName,'*') || strchr(lpstrFileName,'?'))1151 if(strchr(lpstrFileSpec,'*') || strchr(lpstrFileSpec,'?')) 884 1152 { 885 1153 int iPos; … … 889 1157 MemFree((LPVOID)fodInfos->ShellInfos.lpstrCurrentFilter); 890 1158 891 fodInfos->ShellInfos.lpstrCurrentFilter = (LPWSTR)MemAlloc((strlen(lpstrFileName)+1)*2);892 lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter,(LPSTR)strlwr((LPSTR)lpstrFileName)); 893 1159 fodInfos->ShellInfos.lpstrCurrentFilter = (LPWSTR)MemAlloc((strlen(lpstrFileSpec)+1)*2); 1160 lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter, 1161 (LPSTR)strlwr((LPSTR)lpstrFileSpec)); 894 1162 895 1163 IShellView_Refresh(fodInfos->Shell.FOIShellView); 896 1164 897 if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB,lpstrFileName))) 1165 if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB, 1166 lpstrFileSpec))) 898 1167 CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB,iPos); 899 1168 … … 901 1170 } 902 1171 903 /* Check file extension*/904 905 if(!strrchr(lpstrFile,'.'))1172 /* browse if the user specified a directory */ 1173 if((browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder, 1174 lpstrFileSpec))) 906 1175 { 907 /* if the file has no extension, append the selected 908 extension of the filetype combo box */ 909 int iExt; 910 LPSTR lpstrExt; 911 LPSTR lpstrTmp; 912 iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB); 913 lpstrTmp = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iExt); 914 915 if((lpstrExt = strchr(lpstrTmp,';'))) 1176 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 1177 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1178 1, 1179 &browsePidl, 1180 &ulAttr); 1181 1182 /* Browse to directory */ 1183 if(ulAttr) 916 1184 { 917 int i = lpstrExt - lpstrTmp; 918 lpstrExt = MemAlloc(i); 919 strncpy(lpstrExt,&lpstrTmp[1],i-1); 1185 if(FAILED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, 1186 browsePidl, 1187 SBSP_RELATIVE))) 1188 { 1189 if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST) 1190 { 1191 MessageBoxA(hwnd, 1192 "Path does not exist", 1193 fodInfos->ofnInfos.lpstrTitle, 1194 MB_OK | MB_ICONEXCLAMATION); 1195 COMDLG32_SHFree(browsePidl); 1196 return FALSE; 920 1197 } 921 else922 {923 lpstrExt = MemAlloc(strlen(lpstrTmp)-1);924 strcpy(lpstrExt,&lpstrTmp[1]);925 }926 927 if(!strcmp(&lpstrExt[1],"*") && fodInfos->ofnInfos.lpstrDefExt)928 {929 lpstrExt = MemAlloc(strlen(fodInfos->ofnInfos.lpstrDefExt)+1);930 strcat(lpstrExt,".");931 strcat(lpstrExt,(LPSTR) fodInfos->ofnInfos.lpstrDefExt);932 }933 934 strcat(lpstrFile,lpstrExt);935 1198 } 936 /* Check if the selected file exist */ 937 938 if(strlen(lpstrFile) > fodInfos->ofnInfos.nMaxFile) 1199 COMDLG32_SHFree(browsePidl); 1200 return FALSE; 1201 } 1202 COMDLG32_SHFree(browsePidl); 1203 } 1204 else 939 1205 { 940 /* set error FNERR_BUFFERTOSMALL */ 941 FILEDLG95_Clean(hwnd); 942 return EndDialog(hwnd,FALSE); 943 } 944 strcpy(fodInfos->ofnInfos.lpstrFile,lpstrFile); 945 946 /* Set the lpstrFileTitle of the OPENFILENAME structure */ 947 if(fodInfos->ofnInfos.lpstrFileTitle) 948 strncpy(fodInfos->ofnInfos.lpstrFileTitle, 949 lpstrFileName, 950 fodInfos->ofnInfos.nMaxFileTitle); 951 952 /* Check if the file is to be opened as read only */ 953 if(BST_CHECKED == SendDlgItemMessageA(hwnd,IDC_OPENREADONLY,BM_GETSTATE,0,0)) 954 SetFileAttributesA(fodInfos->ofnInfos.lpstrFile,FILE_ATTRIBUTE_READONLY); 955 956 /* nFileExtension and nFileOffset of OPENFILENAME structure */ 957 tmp = strrchr(fodInfos->ofnInfos.lpstrFile,'\\'); 958 fodInfos->ofnInfos.nFileOffset = tmp - fodInfos->ofnInfos.lpstrFile + 1; 959 tmp = strrchr(fodInfos->ofnInfos.lpstrFile,'.'); 960 fodInfos->ofnInfos.nFileExtension = tmp - fodInfos->ofnInfos.lpstrFile + 1; 961 962 /* Check if selected file exists */ 963 if(!GetPidlFromName(fodInfos->Shell.FOIShellFolder, lpstrFileName)) 964 { 1206 /* File does not exist in current directory */ 1207 1208 /* The selected file does not exist */ 965 1209 /* Tell the user the selected does not exist */ 966 1210 if(fodInfos->ofnInfos.Flags & OFN_FILEMUSTEXIST) … … 970 1214 char tmp[400]; 971 1215 972 LoadStringA(COMDLG32_hInstance,IDS_FILENOTFOUND,lpstrNotFound,100); 973 LoadStringA(COMDLG32_hInstance,IDS_VERIFYFILE,lpstrMsg,100); 1216 LoadStringA(COMDLG32_hInstance, 1217 IDS_FILENOTFOUND, 1218 lpstrNotFound, 1219 100); 1220 LoadStringA(COMDLG32_hInstance, 1221 IDS_VERIFYFILE, 1222 lpstrMsg, 1223 100); 974 1224 975 1225 strcpy(tmp,fodInfos->ofnInfos.lpstrFile); … … 979 1229 strcat(tmp,lpstrMsg); 980 1230 981 MessageBoxA(hwnd,tmp,fodInfos->ofnInfos.lpstrTitle,MB_OK | MB_ICONEXCLAMATION); 1231 MessageBoxA(hwnd, 1232 tmp, 1233 fodInfos->ofnInfos.lpstrTitle, 1234 MB_OK | MB_ICONEXCLAMATION); 982 1235 return FALSE; 983 1236 } … … 989 1242 LoadStringA(COMDLG32_hInstance,IDS_CREATEFILE,tmp,100); 990 1243 991 if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos.lpstrTitle,MB_YESNO | MB_ICONQUESTION)) 1244 if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos.lpstrTitle, 1245 MB_YESNO | MB_ICONQUESTION)) 992 1246 { 993 1247 /* Create the file, clean and exit */ … … 998 1252 } 999 1253 } 1254 1255 /* Open the selected file */ 1256 1257 /* Check file extension */ 1258 if(!strrchr(lpstrPathAndFile,'.')) 1259 { 1260 /* if the file has no extension, append the selected 1261 extension of the filetype combo box */ 1262 int iExt; 1263 LPSTR lpstrExt; 1264 iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB); 1265 lpstrTemp = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iExt); 1266 1267 if((lpstrExt = strchr(lpstrTemp,';'))) 1268 { 1269 int i = lpstrExt - lpstrTemp; 1270 lpstrExt = MemAlloc(i); 1271 strncpy(lpstrExt,&lpstrTemp[1],i-1); 1272 } 1273 else 1274 { 1275 lpstrExt = MemAlloc(strlen(lpstrTemp)); 1276 strcpy(lpstrExt,&lpstrTemp[1]); 1277 } 1278 1279 if(!strcmp(&lpstrExt[1],"*") && fodInfos->ofnInfos.lpstrDefExt) 1280 { 1281 lpstrExt = MemAlloc(strlen(fodInfos->ofnInfos.lpstrDefExt)+2); 1282 strcat(lpstrExt,"."); 1283 strcat(lpstrExt,(LPSTR) fodInfos->ofnInfos.lpstrDefExt); 1284 } 1285 strcat(lpstrPathAndFile,lpstrExt); 1286 } 1287 /* Check that size size of the file does not exceed buffer size */ 1288 if(strlen(lpstrPathAndFile) > fodInfos->ofnInfos.nMaxFile) 1289 { 1290 /* set error FNERR_BUFFERTOSMALL */ 1291 FILEDLG95_Clean(hwnd); 1292 return EndDialog(hwnd,FALSE); 1293 } 1294 strcpy(fodInfos->ofnInfos.lpstrFile,lpstrPathAndFile); 1295 1296 /* Set the lpstrFileTitle of the OPENFILENAME structure */ 1297 if(fodInfos->ofnInfos.lpstrFileTitle) 1298 strncpy(fodInfos->ofnInfos.lpstrFileTitle, 1299 lpstrFileSpec, 1300 fodInfos->ofnInfos.nMaxFileTitle); 1301 1302 /* Check if the file is to be opened as read only */ 1303 if(BST_CHECKED == SendDlgItemMessageA(hwnd, 1304 IDC_OPENREADONLY, 1305 BM_GETSTATE,0,0)) 1306 SetFileAttributesA(fodInfos->ofnInfos.lpstrFile, 1307 FILE_ATTRIBUTE_READONLY); 1308 1309 /* nFileExtension and nFileOffset of OPENFILENAME structure */ 1310 lpstrTemp = strrchr(fodInfos->ofnInfos.lpstrFile,'\\'); 1311 fodInfos->ofnInfos.nFileOffset = lpstrTemp - fodInfos->ofnInfos.lpstrFile + 1; 1312 lpstrTemp = strrchr(fodInfos->ofnInfos.lpstrFile,'.'); 1313 fodInfos->ofnInfos.nFileExtension = lpstrTemp - fodInfos->ofnInfos.lpstrFile + 1; 1314 1315 1000 1316 /* clean and exit */ 1001 1317 FILEDLG95_Clean(hwnd); … … 1024 1340 1025 1341 fodInfos->Shell.FOIShellView = NULL; 1026 if(FAILED( SHGetDesktopFolder(&fodInfos->Shell.FOIShellFolder)))1342 if(FAILED(COMDLG32_SHGetDesktopFolder(&fodInfos->Shell.FOIShellFolder))) 1027 1343 return E_FAIL; 1028 1344 … … 1177 1493 break; 1178 1494 1179 lpstrExt = (LPSTR) MemAlloc(strlen(lpstrExtTmp) );1495 lpstrExt = (LPSTR) MemAlloc(strlen(lpstrExtTmp)+1); 1180 1496 if(!lpstrExt) 1181 1497 break; … … 1230 1546 lpstrFilter = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, 1231 1547 iItem); 1232 if( lpstrFilter)1548 if((INT)lpstrFilter != CB_ERR) 1233 1549 { 1234 1550 fodInfos->ShellInfos.lpstrCurrentFilter = (LPWSTR)MemAlloc((strlen(lpstrFilter)+1)*2); … … 1311 1627 1312 1628 SetPropA(hwndCombo, LookInInfosStr, (HANDLE) liInfos); 1629 CBSetItemHeight(hwndCombo,0,GetSystemMetrics(SM_CYSMICON)); 1313 1630 1314 1631 /* Initialise data of Desktop folder */ 1315 SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidlTmp);1632 COMDLG32_SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidlTmp); 1316 1633 FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND); 1317 SHFree(pidlTmp);1318 1319 SHGetSpecialFolderLocation(0,CSIDL_DRIVES,&pidlDrives);1320 1321 SHGetDesktopFolder(&psfRoot);1634 COMDLG32_SHFree(pidlTmp); 1635 1636 COMDLG32_SHGetSpecialFolderLocation(0,CSIDL_DRIVES,&pidlDrives); 1637 1638 COMDLG32_SHGetDesktopFolder(&psfRoot); 1322 1639 1323 1640 if (psfRoot) … … 1331 1648 1332 1649 /* special handling for CSIDL_DRIVES */ 1333 if ( ILIsEqual(pidlTmp, pidlDrives))1650 if (COMDLG32_PIDL_ILIsEqual(pidlTmp, pidlDrives)) 1334 1651 { 1335 1652 if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives))) … … 1340 1657 while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL)) 1341 1658 { 1342 pidlAbsTmp = ILCombine(pidlTmp, pidlTmp1);1659 pidlAbsTmp = COMDLG32_PIDL_ILCombine(pidlTmp, pidlTmp1); 1343 1660 FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND); 1344 SHFree(pidlAbsTmp);1345 SHFree(pidlTmp1);1661 COMDLG32_SHFree(pidlAbsTmp); 1662 COMDLG32_SHFree(pidlTmp1); 1346 1663 } 1347 1664 IEnumIDList_Release(lpeDrives); … … 1350 1667 } 1351 1668 } 1352 SHFree(pidlTmp);1669 COMDLG32_SHFree(pidlTmp); 1353 1670 } 1354 1671 IEnumIDList_Release(lpeRoot); … … 1357 1674 1358 1675 IShellFolder_Release(psfRoot); 1359 SHFree(pidlDrives);1676 COMDLG32_SHFree(pidlDrives); 1360 1677 1361 1678 return NOERROR; … … 1394 1711 if(pDIStruct->itemID == liInfos->uSelectedItem) 1395 1712 { 1396 ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,1713 ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, 1397 1714 0, 1398 1715 &sfi, … … 1404 1721 else 1405 1722 { 1406 ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,1723 ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, 1407 1724 0, 1408 1725 &sfi, … … 1431 1748 { 1432 1749 iIndentation = 0; 1433 ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,1750 ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, 1434 1751 0, 1435 1752 &sfi, … … 1495 1812 iItem = CBGetCurSel(fodInfos->DlgInfos.hwndLookInCB); 1496 1813 1497 tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB, 1498 iItem); 1814 if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB, 1815 iItem))) 1816 return FALSE; 1499 1817 1500 1818 … … 1537 1855 /* Calculate the indentation of the item in the lookin*/ 1538 1856 pidlNext = pidl; 1539 while( (pidlNext= ILGetNext(pidlNext)) )1857 while( (pidlNext=COMDLG32_PIDL_ILGetNext(pidlNext)) ) 1540 1858 { 1541 1859 tmpFolder->m_iIndent++; 1542 1860 } 1543 1861 1544 tmpFolder->pidlItem = ILClone(pidl);1862 tmpFolder->pidlItem = COMDLG32_PIDL_ILClone(pidl); 1545 1863 1546 1864 if(tmpFolder->m_iIndent > liInfos->iMaxIndentation) 1547 1865 liInfos->iMaxIndentation = tmpFolder->m_iIndent; 1548 1866 1549 SHGetFileInfoA((LPSTR)pidl,1867 COMDLG32_SHGetFileInfoA((LPSTR)pidl, 1550 1868 0, 1551 1869 &sfi, … … 1598 1916 1599 1917 /* Free pidlParent memory */ 1600 SHFree((LPVOID)pidlParent);1918 COMDLG32_SHFree((LPVOID)pidlParent); 1601 1919 1602 1920 return FILEDLG95_LOOKIN_AddItem(hwnd,pidl,iParentPos + 1); … … 1693 2011 LPSFOLDER tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,i); 1694 2012 1695 if(iSearchMethod == SEARCH_PIDL && ILIsEqual((LPITEMIDLIST)searchArg,tmpFolder->pidlItem))2013 if(iSearchMethod == SEARCH_PIDL && COMDLG32_PIDL_ILIsEqual((LPITEMIDLIST)searchArg,tmpFolder->pidlItem)) 1696 2014 return i; 1697 2015 if(iSearchMethod == SEARCH_EXP && tmpFolder->m_iIndent == (int)searchArg) … … 1750 2068 { 1751 2069 HRESULT hRes; 1752 SHGetDesktopFolder(&lpsf);2070 COMDLG32_SHGetDesktopFolder(&lpsf); 1753 2071 hRes = GetName(lpsf,pidl,dwFlags,lpstrFileName); 1754 2072 IShellFolder_Release(lpsf); … … 1762 2080 &str))) 1763 2081 { 1764 return StrRetToStrNA(lpstrFileName, MAX_PATH, &str, pidl);2082 return StrRetToBufA(&str, pidl,lpstrFileName, MAX_PATH); 1765 2083 } 1766 2084 return E_FAIL; … … 1779 2097 TRACE("%p\n", pidlAbs); 1780 2098 1781 if(SUCCEEDED( SHGetDesktopFolder(&psfParent)))2099 if(SUCCEEDED(COMDLG32_SHGetDesktopFolder(&psfParent))) 1782 2100 { 1783 2101 psf = psfParent; 1784 2102 if(pidlAbs && pidlAbs->mkid.cb) 1785 2103 { 1786 if( FAILED(IShellFolder_BindToObject(psfParent, pidlAbs, NULL, &IID_IShellFolder, (LPVOID*)&psf)))2104 if(SUCCEEDED(IShellFolder_BindToObject(psfParent, pidlAbs, NULL, &IID_IShellFolder, (LPVOID*)&psf))) 1787 2105 { 1788 psf = NULL; 2106 IShellFolder_Release(psfParent); 2107 return psf; 1789 2108 } 1790 2109 } 1791 IShellFolder_Release(psfParent); 1792 } 1793 1794 return psf; 1795 2110 /* return the desktop */ 2111 return psfParent; 2112 } 2113 return NULL; 1796 2114 } 1797 2115 … … 1807 2125 TRACE("%p\n", pidl); 1808 2126 1809 pidlParent = ILClone(pidl);1810 ILRemoveLastID(pidlParent);1811 2127 pidlParent = COMDLG32_PIDL_ILClone(pidl); 2128 COMDLG32_PIDL_ILRemoveLastID(pidlParent); 2129 1812 2130 return pidlParent; 1813 1814 2131 } 1815 2132 … … 1825 2142 ULONG ulEaten; 1826 2143 wchar_t lpwstrDirName[MAX_PATH]; 2144 1827 2145 1828 2146 TRACE("sf=%p file=%s\n", psf, lpcstrFileName); … … 1838 2156 MAX_PATH); 1839 2157 1840 1841 1842 if(SUCCEEDED(IShellFolder_ParseDisplayName(psf, 1843 0, 2158 IShellFolder_ParseDisplayName(psf, 0, 1844 2159 NULL, 1845 2160 (LPWSTR)lpwstrDirName, 1846 2161 &ulEaten, 1847 2162 &pidl, 1848 NULL)))1849 { 2163 NULL); 2164 1850 2165 return pidl; 1851 }1852 return NULL;1853 2166 } 1854 2167 -
trunk/src/comdlg32/filedlgbrowser.cpp
r1548 r1556 1 /* $Id: filedlgbrowser.cpp,v 1.1 1999-11-02 19:09:42 sandervl Exp $ */2 1 /* 3 * Implementation of IShellBrowser for the File Open common dialog (990815)2 * Implementation of IShellBrowser for the File Open common dialog 4 3 * 5 4 * 6 5 */ 6 7 #include <stdio.h> 8 #ifdef __WIN32OS2__ 7 9 // ><DJR 17.05.99 Force to use C-interfaces for now to prevent CALLBACK definition compiler error 8 10 #define CINTERFACE 1 9 10 #include <stdio.h> 11 #include <os2win.h> 11 12 #include "unknwn.h" 12 #include <os2win.h>13 13 #include "filedlgbrowser.h" 14 #else 15 #include "unknwn.h" 16 #include "filedlgbrowser.h" 17 #include "winuser.h" 18 #endif 14 19 #include "heap.h" 15 #include "commctrl.h"16 20 #include "wine/obj_dataobject.h" 17 21 #include "debugtools.h" … … 77 81 78 82 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv); 83 #if 0 79 84 LPITEMIDLIST GetSelectedPidl(IShellView *ppshv); 85 #endif 80 86 81 87 /************************************************************************** … … 116 122 sb->lpVtbl2 = &IShellBrowserImpl_ICommDlgBrowser_Vtbl; 117 123 118 SHGetSpecialFolderLocation(hwndOwner,124 COMDLG32_SHGetSpecialFolderLocation(hwndOwner, 119 125 CSIDL_DESKTOP, 120 126 &fodInfos->ShellInfos.pidlAbsCurrent); … … 194 200 if (!--(This->ref)) 195 201 { 196 SHFree(This);202 COMDLG32_SHFree(This); 197 203 return 0; 198 204 } … … 287 293 } 288 294 /* create an absolute pidl */ 289 pidlTmp = ILCombine(fodInfos->ShellInfos.pidlAbsCurrent,295 pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent, 290 296 (LPITEMIDLIST)pidl); 291 297 … … 302 308 { 303 309 /* An absolute pidl (relative from the desktop) */ 304 pidlTmp = ILClone((LPITEMIDLIST)pidl);310 pidlTmp = COMDLG32_PIDL_ILClone((LPITEMIDLIST)pidl); 305 311 psfTmp = GetShellFolderFromPidl(pidlTmp); 306 312 } 307 313 314 308 315 /* Retrieve the IShellFolder interface of the pidl specified folder */ 309 316 if(!psfTmp) 310 317 return E_FAIL; 318 319 /* If the pidl to browse to is equal to the actual pidl ... 320 do nothing and pretend you did it*/ 321 if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent)) 322 { 323 IShellFolder_Release(psfTmp); 324 COMDLG32_SHFree(pidlTmp); 325 return NOERROR; 326 } 311 327 312 328 /* Release the current fodInfos->Shell.FOIShellFolder and update its value */ … … 349 365 350 366 /* Release old pidlAbsCurrent memory and update its value */ 351 SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent);367 COMDLG32_SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent); 352 368 fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp; 353 369 … … 626 642 HRESULT hRes; 627 643 628 /* Selected item is a directory so browse to it */629 630 644 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 631 645 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); … … 634 648 /* Tell the dialog that the user selected a file */ 635 649 else 650 { 636 651 hRes = FILEDLG95_OnOpen(This->hwndOwner); 652 } 637 653 638 654 /* Free memory used by pidl */ 639 SHFree((LPVOID)pidl);655 COMDLG32_SHFree((LPVOID)pidl); 640 656 641 657 return hRes; … … 662 678 break; 663 679 case CDBOSC_KILLFOCUS: 680 { 681 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 682 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) 683 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save"); 684 } 664 685 break; 665 686 case CDBOSC_SELCHANGE: … … 705 726 706 727 if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_FORPARSING, &str))) 707 { if (SUCCEEDED(StrRetTo StrNW(szPathW, MAX_PATH, &str, pidl)))728 { if (SUCCEEDED(StrRetToBufW(&str, pidl,szPathW, MAX_PATH))) 708 729 { 709 if (PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))730 if (COMDLG32_PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter)) 710 731 return S_OK; 711 732 } … … 721 742 { 722 743 LPITEMIDLIST pidl; 723 744 FileOpenDlgInfos *fodInfos; 724 745 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface); 725 746 747 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 726 748 TRACE("(%p)\n", This); 727 749 … … 731 753 char lpstrFileName[MAX_PATH]; 732 754 733 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);734 735 755 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 736 756 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); … … 739 759 if(SUCCEEDED(hRes = GetName(fodInfos->Shell.FOIShellFolder,pidl,SHGDN_NORMAL,lpstrFileName))) 740 760 SetWindowTextA(fodInfos->DlgInfos.hwndFileName,lpstrFileName); 761 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) 762 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save"); 741 763 } 742 743 SHFree((LPVOID)pidl); 764 else 765 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Open"); 766 767 fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW; 768 769 COMDLG32_SHFree((LPVOID)pidl); 744 770 return hRes; 745 771 } 746 772 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) 773 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save"); 774 775 fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW; 747 776 return E_FAIL; 748 777 } … … 780 809 LPIDA cida = (LPIDA)GlobalLock(medium.u.hGlobal); 781 810 TRACE("cida=%p\n", cida); 782 pidlSelected = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[1]]));811 pidlSelected = COMDLG32_PIDL_ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[1]])); 783 812 784 813 if(medium.pUnkForRelease)
Note:
See TracChangeset
for help on using the changeset viewer.