Changeset 1864 for trunk/src/comdlg32/filedlg95.cpp
- Timestamp:
- Nov 28, 1999, 1:32:28 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/filedlg95.cpp
r1721 r1864 1 /* $Id: filedlg95.cpp,v 1. 4 1999-11-13 15:41:44sandervl Exp $ */1 /* $Id: filedlg95.cpp,v 1.5 1999-11-28 12:32:27 sandervl Exp $ */ 2 2 /* 3 3 * COMMDLG - File Open Dialogs Win95 look and feel 4 4 * 5 5 */ 6 #ifdef __WIN32OS2__ 7 #include <os2win.h> 8 #include <heapstring.h> 9 // ><DJR 17.05.99 Force to use C-interfaces for now to prevent CALLBACK definition compiler error 10 #define CINTERFACE 1 11 12 #define MapHModuleSL(a) a 13 #define MapHModuleLS(a) a 14 15 #endif 6 16 #include <ctype.h> 7 17 #include <stdlib.h> 8 18 #include <string.h> 9 #ifdef __WIN32OS2__10 // ><DJR 17.05.99 Force to use C-interfaces for now to prevent CALLBACK definition compiler error11 #define CINTERFACE 112 #include <os2win.h>13 #else14 19 #include "winbase.h" 15 #include "tweak.h"16 #endif17 20 #include "ldt.h" 18 21 #include "heap.h" … … 22 25 #include "debugtools.h" 23 26 #include "cderr.h" 27 #include "tweak.h" 24 28 #include "winnls.h" 25 29 #include "shellapi.h" … … 28 32 #include "wine/obj_contextmenu.h" 29 33 30 #ifdef __WIN32OS2__31 #include <heapstring.h>32 33 #define MapHModuleSL(a) a34 #define MapHModuleLS(a) a35 #endif36 37 34 DEFAULT_DEBUG_CHANNEL(commdlg) 38 39 35 40 36 /*********************************************************************** … … 46 42 HIMAGELIST hImgList; 47 43 int m_iIndent; /* Indentation index */ 48 LPITEMIDLIST pidlItem; /* absolute pidl of the item */ 44 LPITEMIDLIST pidlItem; /* absolute pidl of the item */ 49 45 50 46 } SFOLDER,*LPSFOLDER; … … 164 160 165 161 /* Shell memory allocation */ 166 char*MemAlloc(UINT size);162 void *MemAlloc(UINT size); 167 163 void MemFree(void *mem); 168 164 169 BOOL WINAPI GetOpenFileName95(FileOpenDlgInfos *fodInfos); 170 BOOL WINAPI GetSaveFileName95(FileOpenDlgInfos *fodInfos); 165 BOOL WINAPI GetFileName95(FileOpenDlgInfos *fodInfos); 171 166 HRESULT WINAPI FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 172 173 /*********************************************************************** 174 * GetOpenFileName95 175 * 176 * Creates an Open common dialog box that lets the user select 167 HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode); 168 HRESULT FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 169 170 /*********************************************************************** 171 * GetFileName95 172 * 173 * Creates an Open common dialog box that lets the user select 177 174 * the drive, directory, and the name of a file or set of files to open. 178 175 * … … 181 178 * FALSE on cancel, error, close or filename-does-not-fit-in-buffer. 182 179 */ 183 BOOL WINAPI Get OpenFileName95(FileOpenDlgInfos *fodInfos)180 BOOL WINAPI GetFileName95(FileOpenDlgInfos *fodInfos) 184 181 { 185 182 186 183 LRESULT lRes; 187 LPCVOID templateDlg;184 LPCVOID lpTemplate; 188 185 HRSRC hRes; 189 186 HANDLE hDlgTmpl = 0; … … 191 188 /* Create the dialog from a template */ 192 189 193 if(!(hRes = FindResourceA(COM DLG32_hInstance,MAKEINTRESOURCEA(IDD_OPENDIALOG),RT_DIALOGA)))190 if(!(hRes = FindResourceA(COMMDLG_hInstance32,MAKEINTRESOURCEA(NEWFILEOPENORD),RT_DIALOGA))) 194 191 { 195 192 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); 196 193 return FALSE; 197 194 } 198 if (!(hDlgTmpl = LoadResource(COM DLG32_hInstance, hRes )) ||199 !( templateDlg= LockResource( hDlgTmpl )))195 if (!(hDlgTmpl = LoadResource(COMMDLG_hInstance32, hRes )) || 196 !(lpTemplate = LockResource( hDlgTmpl ))) 200 197 { 201 198 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 202 199 return FALSE; 203 200 } 204 lRes = DialogBoxIndirectParamA(COM DLG32_hInstance,205 (LPDLGTEMPLATEA) templateDlg,201 lRes = DialogBoxIndirectParamA(COMMDLG_hInstance32, 202 (LPDLGTEMPLATEA) lpTemplate, 206 203 fodInfos->ofnInfos.hwndOwner, 207 204 (DLGPROC) FileOpenDlgProc95, … … 211 208 if( lRes == -1) 212 209 return FALSE; 213 210 214 211 return lRes; 215 212 } 216 213 217 214 /*********************************************************************** 218 * GetSaveFileName95219 *220 * Creates an Save as common dialog box that lets the user select221 * the drive, directory, and the name of a file or set of files to open.222 *223 * IN : The FileOpenDlgInfos structure associated with the dialog224 * OUT : TRUE on success225 * FALSE on cancel, error, close or filename-does-not-fit-in-buffer.226 */227 BOOL WINAPI GetSaveFileName95(FileOpenDlgInfos *fodInfos)228 {229 230 LRESULT lRes;231 LPCVOID templateDlg;232 HRSRC hRes;233 HANDLE hDlgTmpl = 0;234 235 /* Create the dialog from a template */236 237 if(!(hRes = FindResourceA(COMDLG32_hInstance,MAKEINTRESOURCEA(IDD_SAVEDIALOG),RT_DIALOGA)))238 {239 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);240 return FALSE;241 }242 if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hRes )) ||243 !(templateDlg = LockResource( hDlgTmpl )))244 {245 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);246 return FALSE;247 }248 lRes = DialogBoxIndirectParamA(COMDLG32_hInstance,249 (LPDLGTEMPLATEA) templateDlg,250 fodInfos->ofnInfos.hwndOwner,251 (DLGPROC) FileOpenDlgProc95,252 (LPARAM) fodInfos);253 /* Unable to create the dialog*/254 if( lRes == -1)255 return FALSE;256 257 return lRes;258 }259 260 /***********************************************************************261 215 * GetFileDialog95A 262 216 * 263 217 * Copy the OPENFILENAMEA structure in a FileOpenDlgInfos structure. 264 * Call Get OpenFileName95 with this structure and clean the memory.218 * Call GetFileName95 with this structure and clean the memory. 265 219 * 266 220 * IN : The OPENFILENAMEA initialisation structure passed to … … 272 226 BOOL ret; 273 227 FileOpenDlgInfos *fodInfos; 274 275 /* Initialise FileOpenDlgInfos structure*/ 228 229 /* Initialise FileOpenDlgInfos structure*/ 276 230 fodInfos = (FileOpenDlgInfos*)MemAlloc(sizeof(FileOpenDlgInfos)); 277 231 memset(&fodInfos->ofnInfos,'\0',sizeof(*ofn)); fodInfos->ofnInfos.lStructSize = sizeof(*ofn); … … 300 254 s = s+strlen(s)+1; 301 255 s++; 302 x = MemAlloc(s-ofn->lpstrCustomFilter);256 x = (LPSTR)MemAlloc(s-ofn->lpstrCustomFilter); 303 257 memcpy(x,ofn->lpstrCustomFilter,s-ofn->lpstrCustomFilter); 304 258 fodInfos->ofnInfos.lpstrCustomFilter = (LPSTR)x; … … 333 287 if (ofn->lpstrDefExt) 334 288 { 335 fodInfos->ofnInfos.lpstrDefExt = MemAlloc(strlen(ofn->lpstrDefExt)+1);289 fodInfos->ofnInfos.lpstrDefExt = (LPSTR)MemAlloc(strlen(ofn->lpstrDefExt)+1); 336 290 strcpy((LPSTR)fodInfos->ofnInfos.lpstrDefExt,ofn->lpstrDefExt); 337 291 } … … 339 293 fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook; 340 294 341 //SvL: Bugfix; can be resource id342 295 if (HIWORD(ofn->lpTemplateName)) 343 296 { 297 fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(strlen(ofn->lpTemplateName)+1); 298 strcpy ((LPSTR)fodInfos->ofnInfos.lpTemplateName, ofn->lpTemplateName); 299 } 300 else 301 { 302 /* resource id */ 344 303 fodInfos->ofnInfos.lpTemplateName = ofn->lpTemplateName; 345 304 } … … 348 307 if(!ofn->lpstrInitialDir) 349 308 { 350 fodInfos->ofnInfos.lpstrInitialDir = MemAlloc(MAX_PATH);309 fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(MAX_PATH); 351 310 GetCurrentDirectoryA(MAX_PATH,(LPSTR)fodInfos->ofnInfos.lpstrInitialDir); 352 311 } … … 354 313 /* Initialise the dialog property */ 355 314 fodInfos->DlgInfos.dwDlgProp = 0; 356 315 fodInfos->DlgInfos.hwndCustomDlg = (HWND)NULL; 316 357 317 switch(iDlgType) 358 318 { 359 319 case OPEN_DIALOG : 360 ret = Get OpenFileName95(fodInfos);320 ret = GetFileName95(fodInfos); 361 321 break; 362 322 case SAVE_DIALOG : 363 323 fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG; 364 ret = Get SaveFileName95(fodInfos);324 ret = GetFileName95(fodInfos); 365 325 break; 366 326 default : … … 370 330 ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset; 371 331 ofn->nFileExtension = fodInfos->ofnInfos.nFileExtension; 332 333 /* 334 Transfer the combo index in the OPENFILENAME structure; 335 No support for custom filters, so nFilterIndex must be one-based. 336 */ 337 ofn->nFilterIndex = fodInfos->ofnInfos.nFilterIndex + 1; 338 372 339 if (fodInfos->ofnInfos.lpstrFilter) 373 340 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrFilter)); 374 if ( fodInfos->ofnInfos.lpTemplateName)341 if (HIWORD(fodInfos->ofnInfos.lpTemplateName)) 375 342 MemFree((LPVOID)(fodInfos->ofnInfos.lpTemplateName)); 376 343 if (fodInfos->ofnInfos.lpstrDefExt) … … 383 350 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrCustomFilter)); 384 351 385 if (fodInfos->ofnInfos.lpstrFile) 352 if (fodInfos->ofnInfos.lpstrFile) 386 353 { 387 354 strcpy(ofn->lpstrFile,fodInfos->ofnInfos.lpstrFile); 388 355 MemFree((LPVOID)fodInfos->ofnInfos.lpstrFile); 389 356 } 390 if (fodInfos->ofnInfos.lpstrFileTitle) 357 if (fodInfos->ofnInfos.lpstrFileTitle) 391 358 { 392 359 if (ofn->lpstrFileTitle) … … 404 371 * 405 372 * Copy the OPENFILENAMEW structure in a FileOpenDlgInfos structure. 406 * Call Get OpenFileName95 with this structure and clean the memory.373 * Call GetFileName95 with this structure and clean the memory. 407 374 * 408 375 * IN : The OPENFILENAMEW initialisation structure passed to … … 428 395 /* filter is a list... title\0ext\0......\0\0 */ 429 396 s = (LPWSTR)ofn->lpstrFilter; 430 397 431 398 while (*s) 432 399 s = s+lstrlenW(s)+1; … … 492 459 fodInfos->ofnInfos.lCustData = ofn->lCustData; 493 460 fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook; 494 //SvL: Bugfix 461 495 462 if (HIWORD(ofn->lpTemplateName)) 496 { 463 { 497 464 fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName)+1); 498 465 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpTemplateName,(LPWSTR)ofn->lpTemplateName); 499 466 } 467 else 468 { 469 /* resource id */ 470 fodInfos->ofnInfos.lpTemplateName = (LPSTR)ofn->lpTemplateName; 471 } 500 472 /* Initialise the dialog property */ 501 473 fodInfos->DlgInfos.dwDlgProp = 0; 502 474 503 475 switch(iDlgType) 504 476 { 505 477 case OPEN_DIALOG : 506 ret = Get OpenFileName95(fodInfos);478 ret = GetFileName95(fodInfos); 507 479 break; 508 480 case SAVE_DIALOG : 509 481 fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG; 510 ret = Get SaveFileName95(fodInfos);482 ret = GetFileName95(fodInfos); 511 483 break; 512 484 default : 513 485 ret = 0; 514 486 } 515 487 516 488 /* Cleaning */ 517 489 ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset; 518 490 ofn->nFileExtension = fodInfos->ofnInfos.nFileExtension; 491 492 /* 493 Transfer the combo index in the OPENFILENAME structure; 494 No support for custom filters, so nFilterIndex must be one-based. 495 */ 496 ofn->nFilterIndex = fodInfos->ofnInfos.nFilterIndex + 1; 497 519 498 if (fodInfos->ofnInfos.lpstrFilter) 520 499 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrFilter)); 521 if ( fodInfos->ofnInfos.lpTemplateName)500 if (HIWORD(fodInfos->ofnInfos.lpTemplateName)) 522 501 MemFree((LPVOID)(fodInfos->ofnInfos.lpTemplateName)); 523 502 if (fodInfos->ofnInfos.lpstrDefExt) … … 549 528 { 550 529 551 552 RECT rectParent,rectChild,rectCtrl,rectStc32;553 554 555 556 557 558 559 560 561 562 563 RECT rectTemp;564 GetWindowRect(hwndStc32,&rectStc32);565 MapWindowPoints(0, hwndChildDlg,(LPPOINT)&rectStc32,2);566 CopyRect(&rectTemp,&rectStc32); 567 568 SetRect(&rectStc32,rectStc32.left,rectStc32.top,rectStc32.left + (rectParent.right-rectParent.left),rectStc32.top+(rectParent.bottom-rectParent.top));569 SetWindowPos(hwndStc32,0,rectStc32.left,rectStc32.top,rectStc32.right-rectStc32.left,rectStc32.bottom-rectStc32.top,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE); 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 530 HWND hwndChild,hwndStc32; 531 RECT rectParent, rectChild, rectCtrl, rectStc32, rectTemp; 532 POINT ptMoveCtl; 533 HDWP handle; 534 POINT ptParentClient; 535 536 ptMoveCtl.x = ptMoveCtl.y = 0; 537 hwndStc32=GetDlgItem(hwndChildDlg,stc32); 538 GetClientRect(hwndParentDlg,&rectParent); 539 GetClientRect(hwndChildDlg,&rectChild); 540 if(hwndStc32) 541 { 542 GetWindowRect(hwndStc32,&rectStc32); 543 MapWindowPoints(0, hwndChildDlg,(LPPOINT)&rectStc32,2); 544 CopyRect(&rectTemp,&rectStc32); 545 546 SetRect(&rectStc32,rectStc32.left,rectStc32.top,rectStc32.left + (rectParent.right-rectParent.left),rectStc32.top+(rectParent.bottom-rectParent.top)); 547 SetWindowPos(hwndStc32,0,rectStc32.left,rectStc32.top,rectStc32.right-rectStc32.left,rectStc32.bottom-rectStc32.top,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE); 548 549 if(rectStc32.right < rectTemp.right) 550 { 551 ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left)); 552 ptMoveCtl.x = 0; 553 } 554 else 555 { 556 ptMoveCtl.x = (rectStc32.right - rectTemp.right); 557 ptParentClient.x = max((rectParent.right-rectParent.left),((rectChild.right-rectChild.left)+rectStc32.right-rectTemp.right)); 558 } 559 if(rectStc32.bottom < rectTemp.bottom) 560 { 561 ptParentClient.y = max((rectParent.bottom-rectParent.top),(rectChild.bottom-rectChild.top)); 562 ptMoveCtl.y = 0; 563 } 564 else 565 { 566 ptMoveCtl.y = (rectStc32.bottom - rectTemp.bottom); 567 ptParentClient.y = max((rectParent.bottom-rectParent.top),((rectChild.bottom-rectChild.top)+rectStc32.bottom-rectTemp.bottom)); 568 } 569 } 570 else 571 { 572 if( (GetWindow(hwndChildDlg,GW_CHILD)) == (HWND) NULL) 594 573 return; 595 ptParentClient.x = rectParent.right-rectParent.left; 596 ptParentClient.y = (rectParent.bottom-rectParent.top) + (rectChild.bottom-rectChild.top); 597 ptMoveCtl.y = rectParent.bottom-rectParent.top; 598 ptMoveCtl.x=0; 599 } 600 SetRect(&rectParent,rectParent.left,rectParent.top,rectParent.left+ptParentClient.x,rectParent.top+ptParentClient.y); 601 AdjustWindowRectEx( &rectParent,GetWindowLongA(hwndParentDlg,GWL_STYLE),FALSE,GetWindowLongA(hwndParentDlg,GWL_EXSTYLE)); 602 603 SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y, 604 SWP_NOZORDER ); 605 SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left), 606 (rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER); 607 608 hwndChild = GetWindow(hwndChildDlg,GW_CHILD); 609 handle = BeginDeferWindowPos( 1 ); 610 if(hwndStc32) 611 { 612 GetWindowRect(hwndStc32,&rectStc32); 613 MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2); 614 } 615 else 616 SetRect(&rectStc32,0,0,0,0); 617 if (hwndChild && handle) 618 { 619 do 620 { 621 if(hwndChild != hwndStc32) 622 { 623 if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE) 624 continue; 625 GetWindowRect(hwndChild,&rectCtrl); 626 MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2); 627 if(rectCtrl.top > rectStc32.top) 628 { 629 630 if(ptMoveCtl.x > 0) 631 rectCtrl.left += ptMoveCtl.x; 632 rectCtrl.top += ptMoveCtl.y; 633 handle = DeferWindowPos(handle, hwndChild, 0, rectCtrl.left, rectCtrl.top, 634 rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top, 635 SWP_NOSIZE | SWP_NOZORDER ); 636 } 637 } 638 } 639 while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL && handle); 640 } 641 if(handle) 642 EndDeferWindowPos( handle ); 643 handle = BeginDeferWindowPos( 1 ); 644 hwndChild = GetWindow(hwndParentDlg,GW_CHILD); 645 if(hwndStc32) 646 { 647 GetWindowRect(hwndStc32,&rectStc32); 648 MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2); 649 ptMoveCtl.x = rectStc32.left - 0; 650 ptMoveCtl.y = rectStc32.top - 0; 651 if (hwndChild && handle) 652 { 653 do 654 { 655 if(hwndChild != hwndChildDlg) 656 { 657 658 if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE) 659 continue; 660 GetWindowRect(hwndChild,&rectCtrl); 661 MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2); 662 663 rectCtrl.left += ptMoveCtl.x; 664 rectCtrl.top += ptMoveCtl.y; 665 666 handle = DeferWindowPos( handle, hwndChild, 0, rectCtrl.left, rectCtrl.top, 667 rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top, 668 SWP_NOSIZE |SWP_NOZORDER ); 669 } 670 } 671 while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL); 672 } 673 if(handle) 674 EndDeferWindowPos( handle ); 675 } 574 ptParentClient.x = rectParent.right-rectParent.left; 575 ptParentClient.y = (rectParent.bottom-rectParent.top) + (rectChild.bottom-rectChild.top); 576 ptMoveCtl.y = rectParent.bottom-rectParent.top; 577 ptMoveCtl.x=0; 578 } 579 SetRect(&rectParent,rectParent.left,rectParent.top,rectParent.left+ptParentClient.x,rectParent.top+ptParentClient.y); 580 AdjustWindowRectEx( &rectParent,GetWindowLongA(hwndParentDlg,GWL_STYLE),FALSE,GetWindowLongA(hwndParentDlg,GWL_EXSTYLE)); 581 582 SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y, 583 SWP_NOZORDER ); 584 SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left), 585 (rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER); 586 587 hwndChild = GetWindow(hwndChildDlg,GW_CHILD); 588 handle = BeginDeferWindowPos( 1 ); 589 if(hwndStc32) 590 { 591 GetWindowRect(hwndStc32,&rectStc32); 592 MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2); 593 } 594 else 595 SetRect(&rectStc32,0,0,0,0); 596 597 if (hwndChild && handle) 598 { 599 do 600 { 601 if(hwndChild != hwndStc32) 602 { 603 if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE) 604 continue; 605 GetWindowRect(hwndChild,&rectCtrl); 606 MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2); 607 608 /* 609 Check the initial position of the controls relative to the initial 610 position and size of stc32 (before it is expanded). 611 */ 612 if (rectCtrl.left > rectTemp.right && rectCtrl.top > rectTemp.bottom) 613 { 614 rectCtrl.left += ptMoveCtl.x; 615 rectCtrl.top += ptMoveCtl.y; 616 } 617 else if (rectCtrl.left > rectTemp.right) 618 rectCtrl.left += ptMoveCtl.x; 619 else if (rectCtrl.top > rectTemp.bottom) 620 rectCtrl.top += ptMoveCtl.y; 621 622 handle = DeferWindowPos(handle, hwndChild, 0, rectCtrl.left, rectCtrl.top, 623 rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top, 624 SWP_NOSIZE | SWP_NOZORDER ); 625 } 626 } 627 while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL && handle); 628 } 629 if(handle) 630 EndDeferWindowPos( handle ); 631 handle = BeginDeferWindowPos( 1 ); 632 hwndChild = GetWindow(hwndParentDlg,GW_CHILD); 633 634 if(hwndStc32) 635 { 636 GetWindowRect(hwndStc32,&rectStc32); 637 MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2); 638 ptMoveCtl.x = rectStc32.left - 0; 639 ptMoveCtl.y = rectStc32.top - 0; 640 if (hwndChild && handle) 641 { 642 do 643 { 644 if(hwndChild != hwndChildDlg) 645 { 646 647 if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE) 648 continue; 649 GetWindowRect(hwndChild,&rectCtrl); 650 MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2); 651 652 rectCtrl.left += ptMoveCtl.x; 653 rectCtrl.top += ptMoveCtl.y; 654 655 handle = DeferWindowPos( handle, hwndChild, 0, rectCtrl.left, rectCtrl.top, 656 rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top, 657 SWP_NOSIZE |SWP_NOZORDER ); 658 } 659 } 660 while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL); 661 } 662 if(handle) 663 EndDeferWindowPos( handle ); 664 } 676 665 677 666 } … … 683 672 switch(uMsg) 684 673 { 685 686 { 687 688 674 case WM_INITDIALOG: 675 { 676 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *)lParam; 677 procUserHook=NULL; 689 678 lParam = (LPARAM) &fodInfos->ofnInfos; 690 679 ArrangeCtrlPositions(hwnd,GetParent(hwnd)); 691 680 if(fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK) 692 693 694 695 return 0; 696 681 procUserHook = (WNDPROC) fodInfos->ofnInfos.lpfnHook; 682 if(procUserHook) 683 return CallWindowProcA(procUserHook,hwnd,uMsg,wParam,lParam); 684 return 0; 685 } } 697 686 if(procUserHook) 698 return CallWindowProcA(procUserHook,hwnd,uMsg,wParam,lParam); 699 return DefWindowProcA(hwnd,uMsg,wParam,lParam); 687 return CallWindowProcA(procUserHook,hwnd,uMsg,wParam,lParam); 688 return DefWindowProcA(hwnd,uMsg,wParam,lParam); 700 689 } 701 690 702 691 HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos,HWND hwnd) 703 692 { 704 LPCVOID templateDlg;693 LPCVOID lpTemplate; 705 694 HRSRC hRes; 706 695 HANDLE hDlgTmpl = 0; … … 708 697 if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATE || fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE) 709 698 { 710 711 712 if( !( templateDlg= LockResource( fodInfos->ofnInfos.hInstance)))713 714 715 716 717 718 719 720 721 699 if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE) 700 { 701 if( !(lpTemplate = LockResource( fodInfos->ofnInfos.hInstance))) 702 { 703 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 704 return (HWND)NULL; 705 } 706 707 } 708 else 709 { 710 if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos.hInstance), 722 711 (fodInfos->ofnInfos.lpTemplateName), RT_DIALOGA))) 723 724 725 726 727 712 { 713 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); 714 return (HWND)NULL; 715 } 716 if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos.hInstance), 728 717 hRes )) || 729 !( templateDlg= LockResource( hDlgTmpl )))730 731 732 733 734 735 736 hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,(LPCDLGTEMPLATEA)templateDlg,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);737 738 739 ShowWindow(hChildDlg,SW_SHOW);740 741 718 !(lpTemplate = LockResource( hDlgTmpl ))) 719 { 720 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 721 return (HWND)NULL; 722 } 723 } 724 725 hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,(LPCDLGTEMPLATEA)lpTemplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos); 726 if(hChildDlg) 727 { 728 ShowWindow(hChildDlg,SW_SHOW); 729 return hChildDlg; 730 } 742 731 } 743 732 else if(fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK && fodInfos->ofnInfos.lpfnHook) 744 733 { 745 746 747 748 749 750 751 752 753 754 755 756 734 RECT rectHwnd; 735 DLGTEMPLATE tmplate; 736 GetClientRect(hwnd,&rectHwnd); 737 tmplate.style = WS_CHILD | WS_CLIPSIBLINGS; 738 tmplate.dwExtendedStyle = 0; 739 tmplate.cdit = 0; 740 tmplate.x = 0; 741 tmplate.y = 0; 742 tmplate.cx = rectHwnd.right-rectHwnd.left; 743 tmplate.cy = rectHwnd.bottom-rectHwnd.top; 744 745 return CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos); 757 746 } 758 747 return (HWND)NULL; … … 760 749 761 750 /*********************************************************************** 751 * SendCustomDlgNotificationMessage 752 * 753 * Send CustomDialogNotification (CDN_FIRST -- CDN_LAST) message to the custom template dialog 754 */ 755 756 HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode) 757 { 758 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwndParentDlg,FileOpenDlgInfosStr); 759 if(!fodInfos) 760 return 0; 761 if(fodInfos->DlgInfos.hwndCustomDlg) 762 { 763 OFNOTIFYA ofnNotify; 764 ofnNotify.hdr.hwndFrom=hwndParentDlg; 765 ofnNotify.hdr.idFrom=0; 766 ofnNotify.hdr.code = uCode; 767 ofnNotify.lpOFN = &fodInfos->ofnInfos; 768 return SendMessageA(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify); 769 } 770 return TRUE; 771 } 772 773 /*********************************************************************** 774 * FILEDLG95_HandleCustomDialogMessages 775 * 776 * Handle Custom Dialog Messages (CDM_FIRST -- CDM_LAST) messages 777 */ 778 HRESULT FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 779 { 780 LPSTR lpstrFileSpec; 781 char lpstrCurrentDir[MAX_PATH]=""; 782 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); 783 if(!fodInfos) 784 return TRUE; 785 switch(uMsg) 786 { 787 case CDM_GETFILEPATH: 788 { 789 char lpstrPathSpec[MAX_PATH]=""; 790 GetDlgItemTextA(hwnd,IDC_FILENAME,(LPSTR)lParam, (int)wParam); 791 lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA((LPSTR)lParam); 792 strcpy(lpstrPathSpec,(LPSTR)lParam); 793 COMDLG32_PathRemoveFileSpecA(lpstrPathSpec); 794 if(!lpstrPathSpec[0]) 795 COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent, 796 lpstrPathSpec); 797 strcat(lpstrPathSpec,"\\"); 798 strcat(lpstrPathSpec,(LPSTR)lParam); 799 strcpy((LPSTR)lParam,(LPSTR)lpstrPathSpec); 800 } 801 return TRUE; 802 case CDM_GETFOLDERPATH: 803 if(lParam) 804 { 805 if(fodInfos) 806 { 807 COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent, 808 lpstrCurrentDir); 809 strncpy((LPSTR)lParam,lpstrCurrentDir,(int)wParam); 810 } 811 else 812 *((LPSTR)lParam)=0; 813 } 814 return TRUE; 815 case CDM_GETSPEC: 816 if(lParam) 817 { 818 GetDlgItemTextA(hwnd,IDC_FILENAME,(LPSTR)lParam, (int)wParam); 819 lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA((LPSTR)lParam); 820 if(lpstrFileSpec) 821 strcpy((LPSTR)lParam, lpstrFileSpec); 822 else 823 *((LPSTR)lParam)=0; 824 } 825 return TRUE; 826 case CDM_HIDECONTROL: 827 case CDM_SETCONTROLTEXT: 828 case CDM_SETDEFEXT: 829 FIXME("CDM_HIDECONTROL,CDM_SETCONTROLTEXT,CDM_SETDEFEXT not implemented\n"); 830 return TRUE; 831 } 832 return TRUE; 833 } 834 835 /*********************************************************************** 762 836 * FileOpenDlgProc95 763 837 * … … 766 840 HRESULT WINAPI FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 767 841 { 768 769 842 switch(uMsg) 770 843 { 771 844 case WM_INITDIALOG : 772 CreateTemplateDialog((FileOpenDlgInfos *)lParam,hwnd); 773 return FILEDLG95_OnWMInitDialog(hwnd, wParam, lParam); 845 846 /* Adds the FileOpenDlgInfos in the property list of the dialog 847 so it will be easily accessible through a GetPropA(...) */ 848 SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) lParam); 849 850 ((FileOpenDlgInfos *)lParam)->DlgInfos.hwndCustomDlg = 851 CreateTemplateDialog((FileOpenDlgInfos *)lParam,hwnd); 852 FILEDLG95_OnWMInitDialog(hwnd, wParam, lParam); 853 SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE); 854 return 0; 774 855 case WM_COMMAND: 775 856 return FILEDLG95_OnWMCommand(hwnd, wParam, lParam); … … 784 865 } 785 866 return FALSE; 786 867 787 868 case WM_GETISHELLBROWSER: 788 869 return FILEDLG95_OnWMGetIShellBrowser(hwnd); … … 792 873 793 874 default : 875 if(uMsg >= CDM_FIRST && uMsg <= CDM_LAST) 876 return FILEDLG95_HandleCustomDialogMessages(hwnd, uMsg, wParam, lParam); 794 877 return FALSE; 795 878 } … … 808 891 TRACE("\n"); 809 892 810 /* Adds the FileOpenDlgInfos in the property list of the dialog 811 so it will be easily accessible through a GetPropA(...) */ 812 SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) fodInfos); 813 893 /* Make sure the common control DLL is loaded */ 814 894 #ifndef __WIN32OS2__ 815 /* Make sure the common control DLL is loaded */816 895 InitCommonControls(); 817 896 #endif … … 875 954 /* OK button */ 876 955 case IDOK: 877 FILEDLG95_OnOpen(hwnd); 956 if(FILEDLG95_OnOpen(hwnd)) 957 SendCustomDlgNotificationMessage(hwnd,CDN_FILEOK); 878 958 break; 879 959 /* Cancel button */ … … 885 965 case IDC_FILETYPE: 886 966 FILEDLG95_FILETYPE_OnCommand(hwnd,wNotifyCode); 967 SendCustomDlgNotificationMessage(hwnd,CDN_TYPECHANGE); 887 968 break; 888 969 /* LookIn combo box */ … … 890 971 FILEDLG95_LOOKIN_OnCommand(hwnd,wNotifyCode); 891 972 break; 973 974 /* --- toolbar --- */ 892 975 /* Up folder button */ 893 case IDC_UPFOLDER:976 case FCIDM_TB_UPFOLDER: 894 977 FILEDLG95_SHELL_UpFolder(hwnd); 895 978 break; 979 /* New folder button */ 980 case FCIDM_TB_NEWFOLDER: 981 FILEDLG95_SHELL_NewFolder(hwnd); 982 break; 896 983 /* List option button */ 897 case IDC_LIST:984 case FCIDM_TB_SMALLICON: 898 985 FILEDLG95_SHELL_ExecuteCommand(hwnd,CMDSTR_VIEWLIST); 899 986 break; 900 987 /* Details option button */ 901 case IDC_DETAILS:988 case FCIDM_TB_REPORTVIEW: 902 989 FILEDLG95_SHELL_ExecuteCommand(hwnd,CMDSTR_VIEWDETAILS); 903 990 break; 904 /* New folder button */905 case IDC_NEWFOLDER:906 FILEDLG95_SHELL_NewFolder(hwnd);907 break;908 991 909 992 case IDC_FILENAME: … … 913 996 /* Do not use the listview selection anymore */ 914 997 fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW; 915 return 0; 998 return 0; 916 999 } 917 1000 … … 930 1013 SetWindowLongA(hwnd,DWL_MSGRESULT,(LONG)fodInfos->Shell.FOIShellBrowser); 931 1014 932 return TRUE; 1015 return TRUE; 933 1016 } 934 1017 … … 940 1023 static LRESULT FILEDLG95_InitUI(HWND hwnd) 941 1024 { 942 HIMAGELIST himlToolbar; 943 HICON hicon; 1025 TBBUTTON tbb[] = 1026 {{VIEW_PARENTFOLDER, FCIDM_TB_UPFOLDER, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 }, 1027 {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 }, 1028 {VIEW_NEWFOLDER, FCIDM_TB_NEWFOLDER, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 }, 1029 {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 }, 1030 {VIEW_LIST, FCIDM_TB_SMALLICON, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 }, 1031 {VIEW_DETAILS, FCIDM_TB_REPORTVIEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 }, 1032 }; 1033 TBADDBITMAP tba = { HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR }; 1034 RECT rectTB; 1035 944 1036 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); 945 1037 … … 951 1043 fodInfos->DlgInfos.hwndLookInCB = GetDlgItem(hwnd,IDC_LOOKIN); 952 1044 953 ShowWindow(GetDlgItem(hwnd,IDC_SHELLSTATIC),SW_HIDE); 954 /* Load the icons bitmaps */ 955 956 if((himlToolbar = COMDLG32_ImageList_LoadImageA(COMDLG32_hInstance, 957 MAKEINTRESOURCEA(IDB_TOOLBAR), 958 0, 959 1, 960 CLR_DEFAULT, 961 IMAGE_BITMAP, 962 0))) 963 { 964 /* Up folder icon */ 965 if((hicon = COMDLG32_ImageList_GetIcon(himlToolbar,0,ILD_NORMAL))) 966 SendDlgItemMessageA(hwnd,IDC_UPFOLDER,BM_SETIMAGE,(WPARAM)IMAGE_ICON,(LPARAM)hicon); 967 /* New folder icon */ 968 if((hicon = COMDLG32_ImageList_GetIcon(himlToolbar,1,ILD_NORMAL))) 969 SendDlgItemMessageA(hwnd,IDC_NEWFOLDER,BM_SETIMAGE,(WPARAM)IMAGE_ICON,(LPARAM)hicon); 970 /* List view icon */ 971 if((hicon = COMDLG32_ImageList_GetIcon(himlToolbar,2,ILD_NORMAL))) 972 SendDlgItemMessageA(hwnd,IDC_LIST,BM_SETIMAGE,(WPARAM)IMAGE_ICON,(LPARAM)hicon); 973 /* Detail view icon */ 974 if((hicon = COMDLG32_ImageList_GetIcon(himlToolbar,3,ILD_NORMAL))) 975 SendDlgItemMessageA(hwnd,IDC_DETAILS,BM_SETIMAGE,(WPARAM)IMAGE_ICON,(LPARAM)hicon); 976 /* Cleanup */ 977 COMDLG32_ImageList_Destroy(himlToolbar); 978 } 979 980 1045 /* construct the toolbar */ 1046 GetWindowRect(GetDlgItem(hwnd,IDC_TOOLBARSTATIC),&rectTB); 1047 MapWindowPoints( 0, hwnd,(LPPOINT)&rectTB,2); 1048 1049 fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, (LPSTR) NULL, 1050 WS_CHILD | WS_GROUP | TBSTYLE_TOOLTIPS | CCS_NODIVIDER | CCS_NORESIZE, 1051 0, 0, 150, 26, 1052 hwnd, (HMENU) IDC_TOOLBAR, COMMDLG_hInstance32, NULL); 1053 1054 SetWindowPos(fodInfos->DlgInfos.hwndTB, 0, 1055 rectTB.left,rectTB.top, rectTB.right-rectTB.left, rectTB.bottom-rectTB.top, 1056 SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); 1057 1058 SendMessageA(fodInfos->DlgInfos.hwndTB, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0); 1059 1060 /* fixme: use TB_LOADIMAGES when implemented */ 1061 /* SendMessageA(fodInfos->DlgInfos.hwndTB, TB_LOADIMAGES, (WPARAM) IDB_VIEW_SMALL_COLOR, HINST_COMMCTRL);*/ 1062 SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, (WPARAM) 12, (LPARAM) &tba); 1063 1064 SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSA, (WPARAM) 6,(LPARAM) &tbb); 1065 SendMessageA(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0); 981 1066 982 1067 /* Set the window text with the text specified in the OPENFILENAME structure */ 983 1068 if(fodInfos->ofnInfos.lpstrTitle) 984 SetWindowTextA(hwnd,fodInfos->ofnInfos.lpstrTitle); 1069 { 1070 SetWindowTextA(hwnd,fodInfos->ofnInfos.lpstrTitle); 1071 } 1072 else if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) 1073 { 1074 SetWindowTextA(hwnd,"Save"); 1075 } 985 1076 986 1077 /* Initialise the file name edit control */ … … 1000 1091 ShowWindow(GetDlgItem(hwnd,IDC_OPENREADONLY),SW_HIDE); 1001 1092 } 1002 1003 /* List View is selected by default */ 1004 SendDlgItemMessageA(hwnd, IDC_LIST, BM_SETCHECK,(WPARAM) BST_CHECKED,0); 1005 1093 /* change Open to Save */ 1094 if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) 1095 { 1096 SetDlgItemTextA(hwnd,IDOK,"Save"); 1097 } 1006 1098 return 0; 1007 1099 } … … 1011 1103 * 1012 1104 * Ok button WM_COMMAND message handler 1013 * 1105 * 1014 1106 * If the function succeeds, the return value is nonzero. 1015 1107 */ … … 1043 1135 char lpstrPathAndFile[MAX_PATH] = ""; 1044 1136 1045 /* Separate the file spec from the path spec 1046 e.g.: 1047 1048 1049 */ 1137 /* Separate the file spec from the path spec 1138 e.g.: 1139 lpstrSpecifiedByUser lpstrPathSpec lpstrFileSpec 1140 C:\TEXT1\TEXT2 C:\TEXT1 TEXT2 1141 */ 1050 1142 lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA(lpstrSpecifiedByUser); 1051 1143 strcpy(lpstrPathSpec,lpstrSpecifiedByUser); 1052 1144 COMDLG32_PathRemoveFileSpecA(lpstrPathSpec); 1053 1145 1146 /* Get the index of the selected item in the filetype combo box */ 1147 fodInfos->ofnInfos.nFilterIndex = (DWORD) CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB); 1148 1054 1149 /* Get the current directory name */ 1055 1150 COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent, 1056 1057 1058 /* Create an absolute path name */ 1151 lpstrCurrentDir); 1152 1153 /* Create an absolute path name */ 1059 1154 if(lpstrSpecifiedByUser[1] != ':') 1060 1155 { 1061 1156 switch(lpstrSpecifiedByUser[0]) 1062 1157 { 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 break;1075 /* Go to parent ..\TEXT */ 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 { 1092 1093 1094 1095 1096 1097 1098 1099 1158 /* Add drive spec \TEXT => C:\TEXT */ 1159 case '\\': 1160 { 1161 INT iCopy = 2; 1162 char lpstrTmp[MAX_PATH] = ""; 1163 if(!strlen(lpstrPathSpec)) 1164 iCopy = 3; 1165 strncpy(lpstrTmp,lpstrCurrentDir,iCopy); 1166 strcat(lpstrTmp,lpstrPathSpec); 1167 strcpy(lpstrPathSpec,lpstrTmp); 1168 } 1169 break; 1170 /* Go to parent ..\TEXT */ 1171 case '.': 1172 { 1173 INT iSize; 1174 char lpstrTmp2[MAX_PATH] = ""; 1175 LPSTR lpstrTmp = strrchr(lpstrCurrentDir,'\\'); 1176 iSize = lpstrTmp - lpstrCurrentDir; 1177 strncpy(lpstrTmp2,lpstrCurrentDir,iSize + 1); 1178 if(strlen(lpstrSpecifiedByUser) <= 3) 1179 strcpy(lpstrFileSpec,""); 1180 if(strcmp(lpstrPathSpec,"..")) 1181 strcat(lpstrTmp2,&lpstrPathSpec[3]); 1182 strcpy(lpstrPathSpec,lpstrTmp2); 1183 } 1184 break; 1185 default: 1186 { 1187 char lpstrTmp[MAX_PATH] = ""; 1188 if(strcmp(&lpstrCurrentDir[strlen(lpstrCurrentDir)-1],"\\")) 1189 strcat(lpstrCurrentDir,"\\"); 1190 strcpy(lpstrTmp,lpstrCurrentDir); 1191 strcat(lpstrTmp,lpstrPathSpec); 1192 strcpy(lpstrPathSpec,lpstrTmp); 1193 } 1194 1100 1195 } /* end switch */ 1101 1196 } … … 1103 1198 if(strlen(lpstrPathSpec)) 1104 1199 { 1105 /* Browse to the right directory */ 1106 COMDLG32_SHGetDesktopFolder(&psfDesktop); 1107 if((browsePidl = GetPidlFromName(psfDesktop,lpstrPathSpec))) 1108 { 1109 /* Browse to directory */ 1110 IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, 1111 browsePidl, 1112 SBSP_ABSOLUTE); 1113 COMDLG32_SHFree(browsePidl); 1114 } 1115 else 1116 { 1117 /* Path does not exist */ 1118 if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST) 1119 { 1120 MessageBoxA(hwnd, 1121 "Path does not exist", 1122 fodInfos->ofnInfos.lpstrTitle, 1123 MB_OK | MB_ICONEXCLAMATION); 1124 return FALSE; 1125 } 1126 } 1127 1128 strcat(lpstrPathAndFile,lpstrPathSpec); 1129 IShellFolder_Release(psfDesktop); 1200 /* Browse to the right directory */ 1201 COMDLG32_SHGetDesktopFolder(&psfDesktop); 1202 if((browsePidl = GetPidlFromName(psfDesktop,lpstrPathSpec))) 1203 { 1204 /* Browse to directory */ 1205 IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, 1206 browsePidl, 1207 SBSP_ABSOLUTE); 1208 COMDLG32_SHFree(browsePidl); 1130 1209 } 1131 1210 else 1132 1211 { 1133 strcat(lpstrPathAndFile,lpstrCurrentDir); 1212 /* Path does not exist */ 1213 if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST) 1214 { 1215 MessageBoxA(hwnd, 1216 "Path does not exist", 1217 fodInfos->ofnInfos.lpstrTitle, 1218 MB_OK | MB_ICONEXCLAMATION); 1219 return FALSE; 1220 } 1221 } 1222 1223 strcat(lpstrPathAndFile,lpstrPathSpec); 1224 IShellFolder_Release(psfDesktop); 1225 } 1226 else 1227 { 1228 strcat(lpstrPathAndFile,lpstrCurrentDir); 1134 1229 } 1135 1230 … … 1137 1232 COMDLG32_PathAddBackslashA(lpstrPathAndFile); 1138 1233 strcat(lpstrPathAndFile,lpstrFileSpec); 1139 1234 1140 1235 /* Update the edit field */ 1141 1236 SetDlgItemTextA(hwnd,IDC_FILENAME,lpstrFileSpec); 1142 1237 SendDlgItemMessageA(hwnd,IDC_FILENAME,EM_SETSEL,0,-1); 1143 1238 1144 1239 /* Don't go further if we dont have a file spec */ 1145 1240 if(!strlen(lpstrFileSpec) || !strcmp(lpstrFileSpec,lpstrPathSpec)) 1146 1147 1148 /* Time to check lpstrFileSpec */ 1241 return FALSE; 1242 1243 /* Time to check lpstrFileSpec */ 1149 1244 /* search => contains * or ? */ 1150 1245 /* browse => contains a directory name */ … … 1160 1255 MemFree((LPVOID)fodInfos->ShellInfos.lpstrCurrentFilter); 1161 1256 1162 1163 1164 1165 1257 fodInfos->ShellInfos.lpstrCurrentFilter = (LPWSTR)MemAlloc((strlen(lpstrFileSpec)+1)*2); 1258 lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter, 1259 (LPSTR)strlwr((LPSTR)lpstrFileSpec)); 1260 1166 1261 IShellView_Refresh(fodInfos->Shell.FOIShellView); 1167 1262 1168 1169 1263 if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB, 1264 lpstrFileSpec))) 1170 1265 CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB,iPos); 1171 1266 … … 1175 1270 /* browse if the user specified a directory */ 1176 1271 if((browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder, 1177 1272 lpstrFileSpec))) 1178 1273 { 1179 1274 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 1180 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1181 1, 1182 &browsePidl, 1183 &ulAttr); 1184 1185 /* Browse to directory */ 1186 if(ulAttr) 1275 int nMsgBoxRet; 1276 char lpstrFileExist[MAX_PATH + 50]; 1277 1278 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1279 1, 1280 &browsePidl, 1281 &ulAttr); 1282 1283 /* The file does exist, so ask the user if we should overwrite it */ 1284 if(fodInfos->ofnInfos.Flags & OFN_OVERWRITEPROMPT) 1285 { 1286 strcpy(lpstrFileExist, lpstrFileSpec); 1287 strcat(lpstrFileExist, " already exists.\nDo you want to replace it?"); 1288 1289 nMsgBoxRet = MessageBoxA(hwnd, 1290 lpstrFileExist, 1291 fodInfos->ofnInfos.lpstrTitle, 1292 MB_YESNO | MB_ICONEXCLAMATION); 1293 if(nMsgBoxRet == IDNO) return FALSE; 1294 } 1295 1296 /* Browse to directory */ 1297 if(ulAttr) 1187 1298 { 1188 1189 1190 1299 if(FAILED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, 1300 browsePidl, 1301 SBSP_RELATIVE))) 1191 1302 { 1192 1303 if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST) 1193 1304 { 1194 1195 1196 1197 1198 1199 1305 MessageBoxA(hwnd, 1306 "Path does not exist", 1307 fodInfos->ofnInfos.lpstrTitle, 1308 MB_OK | MB_ICONEXCLAMATION); 1309 COMDLG32_SHFree(browsePidl); 1310 return FALSE; 1200 1311 } 1201 1312 } 1202 1203 1204 } 1205 1313 COMDLG32_SHFree(browsePidl); 1314 return FALSE; 1315 } 1316 COMDLG32_SHFree(browsePidl); 1206 1317 } 1207 1318 else 1208 1319 { 1209 1210 1211 1320 /* File does not exist in current directory */ 1321 1322 /* The selected file does not exist */ 1212 1323 /* Tell the user the selected does not exist */ 1213 1324 if(fodInfos->ofnInfos.Flags & OFN_FILEMUSTEXIST) … … 1217 1328 char tmp[400]; 1218 1329 1219 LoadStringA(COMDLG32_hInstance,1220 1221 1222 1223 LoadStringA(COMDLG32_hInstance,1224 1225 1226 1330 LoadStringA(COMMDLG_hInstance32, 1331 IDS_FILENOTFOUND, 1332 lpstrNotFound, 1333 100); 1334 LoadStringA(COMMDLG_hInstance32, 1335 IDS_VERIFYFILE, 1336 lpstrMsg, 1337 100); 1227 1338 1228 1339 strcpy(tmp,fodInfos->ofnInfos.lpstrFile); … … 1232 1343 strcat(tmp,lpstrMsg); 1233 1344 1234 1235 1236 1237 1238 1345 MessageBoxA(hwnd, 1346 tmp, 1347 fodInfos->ofnInfos.lpstrTitle, 1348 MB_OK | MB_ICONEXCLAMATION); 1349 return FALSE; 1239 1350 } 1240 1351 /* Ask the user if he wants to create the file*/ … … 1243 1354 char tmp[100]; 1244 1355 1245 LoadStringA(COM DLG32_hInstance,IDS_CREATEFILE,tmp,100);1246 1247 1248 1356 LoadStringA(COMMDLG_hInstance32,IDS_CREATEFILE,tmp,100); 1357 1358 if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos.lpstrTitle, 1359 MB_YESNO | MB_ICONQUESTION)) 1249 1360 { 1250 1361 /* Create the file, clean and exit */ … … 1252 1363 return EndDialog(hwnd,TRUE); 1253 1364 } 1254 return FALSE; 1365 return FALSE; 1255 1366 } 1256 1367 } … … 1261 1372 if(!strrchr(lpstrPathAndFile,'.')) 1262 1373 { 1263 1264 1265 int iExt;1266 1267 1268 1374 /* if the file has no extension, append the selected 1375 extension of the filetype combo box */ 1376 int iExt; 1377 LPSTR lpstrExt; 1378 iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB); 1379 lpstrTemp = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iExt); 1269 1380 1270 1381 //SvL: Check pointer first 1271 1382 if(lpstrTemp != (LPSTR)-1) { 1272 1273 1274 1275 lpstrExt =MemAlloc(i);1276 1277 1278 1279 1280 lpstrExt =MemAlloc(strlen(lpstrTemp));1281 1282 1283 1284 1285 1286 lpstrExt =MemAlloc(strlen(fodInfos->ofnInfos.lpstrDefExt)+2);1287 1288 1289 1290 1291 1383 if((lpstrExt = strchr(lpstrTemp,';'))) 1384 { 1385 int i = lpstrExt - lpstrTemp; 1386 lpstrExt = (LPSTR)MemAlloc(i); 1387 strncpy(lpstrExt,&lpstrTemp[1],i-1); 1388 } 1389 else 1390 { 1391 lpstrExt = (LPSTR)MemAlloc(strlen(lpstrTemp)); 1392 strcpy(lpstrExt,&lpstrTemp[1]); 1393 } 1394 1395 if(!strcmp(&lpstrExt[1],"*") && fodInfos->ofnInfos.lpstrDefExt) 1396 { 1397 lpstrExt = (LPSTR)MemAlloc(strlen(fodInfos->ofnInfos.lpstrDefExt)+2); 1398 strcat(lpstrExt,"."); 1399 strcat(lpstrExt,(LPSTR) fodInfos->ofnInfos.lpstrDefExt); 1400 } 1401 strcat(lpstrPathAndFile,lpstrExt); 1402 } 1292 1403 } 1293 1404 /* Check that size size of the file does not exceed buffer size */ 1294 1405 if(strlen(lpstrPathAndFile) > fodInfos->ofnInfos.nMaxFile) 1295 1406 { 1296 1297 1298 1407 /* set error FNERR_BUFFERTOSMALL */ 1408 FILEDLG95_Clean(hwnd); 1409 return EndDialog(hwnd,FALSE); 1299 1410 } 1300 1411 strcpy(fodInfos->ofnInfos.lpstrFile,lpstrPathAndFile); … … 1302 1413 /* Set the lpstrFileTitle of the OPENFILENAME structure */ 1303 1414 if(fodInfos->ofnInfos.lpstrFileTitle) 1304 1305 1306 1307 1308 /* Check if the file is to be opened as read only */ 1415 strncpy(fodInfos->ofnInfos.lpstrFileTitle, 1416 lpstrFileSpec, 1417 fodInfos->ofnInfos.nMaxFileTitle); 1418 1419 /* Check if the file is to be opened as read only */ 1309 1420 if(BST_CHECKED == SendDlgItemMessageA(hwnd, 1310 1311 1312 1313 1421 IDC_OPENREADONLY, 1422 BM_GETSTATE,0,0)) 1423 SetFileAttributesA(fodInfos->ofnInfos.lpstrFile, 1424 FILE_ATTRIBUTE_READONLY); 1314 1425 1315 1426 /* nFileExtension and nFileOffset of OPENFILENAME structure */ … … 1319 1430 fodInfos->ofnInfos.nFileExtension = lpstrTemp - fodInfos->ofnInfos.lpstrFile + 1; 1320 1431 1321 1432 1322 1433 /* clean and exit */ 1323 1434 FILEDLG95_Clean(hwnd); … … 1340 1451 1341 1452 /* 1342 * Initialisation of the FileOpenDialogInfos structure 1453 * Initialisation of the FileOpenDialogInfos structure 1343 1454 */ 1344 1455 … … 1360 1471 1361 1472 /* Construct the IShellBrowser interface */ 1362 fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd); 1363 1473 fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd); 1474 1364 1475 return NOERROR; 1365 1476 } … … 1380 1491 1381 1492 if(SUCCEEDED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView, 1382 1383 1384 1493 SVGIO_BACKGROUND, 1494 &IID_IContextMenu, 1495 (LPVOID*)&pcm))) 1385 1496 { 1386 1497 ci.cbSize = sizeof(CMINVOKECOMMANDINFO); … … 1419 1530 * FILEDLG95_SHELL_NewFolder 1420 1531 * 1421 * Creates a new directory with New folder as name 1532 * Creates a new directory with New folder as name 1422 1533 * If the function succeeds, the return value is nonzero. 1423 1534 * FIXME: let the contextmenu (CMDSTR_NEWFOLDER) do this thing … … 1467 1578 * FILEDLG95_FILETYPE_Init 1468 1579 * 1469 * Initialisation of the file type combo box 1580 * Initialisation of the file type combo box 1470 1581 */ 1471 1582 static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd) … … 1502 1613 if(!lpstrExt) 1503 1614 break; 1504 1615 1505 1616 strcpy(lpstrExt,lpstrExtTmp); 1506 1617 1507 1618 iStrIndex += strlen(lpstrExt) +1; 1508 1619 1509 1620 /* Add the item at the end of the combo */ 1510 1621 CBAddString(fodInfos->DlgInfos.hwndFileTypeCB,lpstrTmp); … … 1552 1663 lpstrFilter = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, 1553 1664 iItem); 1554 if( (INT)lpstrFilter != CB_ERR)1665 if(lpstrFilter) 1555 1666 { 1556 1667 fodInfos->ShellInfos.lpstrCurrentFilter = (LPWSTR)MemAlloc((strlen(lpstrFilter)+1)*2); … … 1614 1725 1615 1726 } 1616 1727 1617 1728 /*********************************************************************** 1618 1729 * FILEDLG95_LOOKIN_Init 1619 1730 * 1620 * Initialisation of the look in combo box 1731 * Initialisation of the look in combo box 1621 1732 */ 1622 1733 static HRESULT FILEDLG95_LOOKIN_Init(HWND hwndCombo) 1623 1734 { 1624 IShellFolder 1625 IEnumIDList 1626 LPITEMIDLIST 1627 1628 LookInInfos *liInfos = (LookInInfos *)MemAlloc(sizeof(LookInInfos));1735 IShellFolder *psfRoot, *psfDrives; 1736 IEnumIDList *lpeRoot, *lpeDrives; 1737 LPITEMIDLIST pidlDrives, pidlTmp, pidlTmp1, pidlAbsTmp; 1738 1739 LookInInfos *liInfos = (LookInInfos *)MemAlloc(sizeof(LookInInfos)); 1629 1740 1630 1741 TRACE("\n"); … … 1651 1762 while (S_OK == IEnumIDList_Next(lpeRoot, 1, &pidlTmp, NULL)) 1652 1763 { 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1764 FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND); 1765 1766 /* special handling for CSIDL_DRIVES */ 1767 if (COMDLG32_PIDL_ILIsEqual(pidlTmp, pidlDrives)) 1768 { 1769 if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives))) 1770 { 1771 /* enumerate the drives */ 1772 if(SUCCEEDED(IShellFolder_EnumObjects(psfDrives, hwndCombo,SHCONTF_FOLDERS, &lpeDrives))) 1773 { 1774 while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL)) 1775 { 1776 pidlAbsTmp = COMDLG32_PIDL_ILCombine(pidlTmp, pidlTmp1); 1777 FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND); 1778 COMDLG32_SHFree(pidlAbsTmp); 1779 COMDLG32_SHFree(pidlTmp1); 1780 } 1781 IEnumIDList_Release(lpeDrives); 1782 } 1783 IShellFolder_Release(psfDrives); 1784 } 1785 } 1675 1786 COMDLG32_SHFree(pidlTmp); 1676 1787 } … … 1718 1829 { 1719 1830 ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, 1720 0, 1721 &sfi, 1722 sizeof (SHFILEINFOA), 1723 SHGFI_PIDL | SHGFI_SMALLICON | 1724 SHGFI_OPENICON | SHGFI_SYSICONINDEX | 1725 SHGFI_DISPLAYNAME ); 1831 0, 1832 &sfi, 1833 sizeof (SHFILEINFOA), 1834 SHGFI_PIDL | SHGFI_SMALLICON | 1835 SHGFI_OPENICON | SHGFI_SYSICONINDEX | 1836 SHGFI_DISPLAYNAME ); 1726 1837 } 1727 1838 else 1728 1839 { 1729 1840 ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, 1730 0, 1731 &sfi, 1841 0, 1842 &sfi, 1732 1843 sizeof (SHFILEINFOA), 1733 SHGFI_PIDL | SHGFI_SMALLICON | 1734 SHGFI_SYSICONINDEX | 1844 SHGFI_PIDL | SHGFI_SMALLICON | 1845 SHGFI_SYSICONINDEX | 1735 1846 SHGFI_DISPLAYNAME); 1736 1847 } … … 1755 1866 iIndentation = 0; 1756 1867 ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, 1757 0, 1758 &sfi, 1759 sizeof (SHFILEINFOA), 1760 SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_OPENICON 1868 0, 1869 &sfi, 1870 sizeof (SHFILEINFOA), 1871 SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_OPENICON 1761 1872 | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME ); 1762 1873 … … 1780 1891 rectText.bottom = pDIStruct->rcItem.bottom; 1781 1892 1782 1893 1783 1894 /* Draw the icon from the image list */ 1784 1895 COMDLG32_ImageList_Draw(ilItemImage, 1785 1896 sfi.iIcon, 1786 pDIStruct->hDC, 1787 rectIcon.left, 1788 rectIcon.top, 1789 ILD_TRANSPARENT ); 1897 pDIStruct->hDC, 1898 rectIcon.left, 1899 rectIcon.top, 1900 ILD_TRANSPARENT ); 1790 1901 1791 1902 /* Draw the associated text */ … … 1814 1925 { 1815 1926 LPSFOLDER tmpFolder; 1816 int iItem; 1927 int iItem; 1817 1928 1818 1929 iItem = CBGetCurSel(fodInfos->DlgInfos.hwndLookInCB); … … 1820 1931 if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB, 1821 1932 iItem))) 1822 1933 return FALSE; 1823 1934 1824 1935 … … 1831 1942 break; 1832 1943 } 1833 1944 1834 1945 } 1835 1946 return FALSE; … … 1846 1957 LPITEMIDLIST pidlNext; 1847 1958 SHFILEINFOA sfi; 1848 SFOLDER *tmpFolder = (SFOLDER *)MemAlloc(sizeof(SFOLDER));1959 SFOLDER *tmpFolder = (SFOLDER *)MemAlloc(sizeof(SFOLDER)); 1849 1960 LookInInfos *liInfos; 1850 1961 … … 1853 1964 if(!(liInfos = (LookInInfos *)GetPropA(hwnd,LookInInfosStr))) 1854 1965 return -1; 1855 1966 1856 1967 tmpFolder->m_iIndent = 0; 1857 1968 … … 1870 1981 if(tmpFolder->m_iIndent > liInfos->iMaxIndentation) 1871 1982 liInfos->iMaxIndentation = tmpFolder->m_iIndent; 1872 1983 1873 1984 COMDLG32_SHGetFileInfoA((LPSTR)pidl, 1874 1985 0, 1875 1986 &sfi, 1876 1987 sizeof(sfi), 1877 SHGFI_DISPLAYNAME | SHGFI_SYSICONINDEX 1988 SHGFI_DISPLAYNAME | SHGFI_SYSICONINDEX 1878 1989 | SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_ATTRIBUTES); 1879 1990 … … 1904 2015 * FILEDLG95_LOOKIN_InsertItemAfterParent 1905 2016 * 1906 * Insert an item below its parent 2017 * Insert an item below its parent 1907 2018 */ 1908 2019 static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd,LPITEMIDLIST pidl) 1909 2020 { 1910 2021 1911 2022 LPITEMIDLIST pidlParent = GetParentPidl(pidl); 1912 2023 int iParentPos; … … 1963 2074 } 1964 2075 } 1965 2076 1966 2077 CBSetCurSel(hwnd,iItemPos); 1967 2078 liInfos->uSelectedItem = iItemPos; … … 2057 2168 * GetName 2058 2169 * 2059 * Get the pidl's display name (relative to folder) and 2170 * Get the pidl's display name (relative to folder) and 2060 2171 * put it in lpstrFileName. 2061 * 2172 * 2062 2173 * Return NOERROR on success, 2063 2174 * E_FAIL otherwise … … 2082 2193 /* Get the display name of the pidl relative to the folder */ 2083 2194 if (SUCCEEDED(hRes = IShellFolder_GetDisplayNameOf(lpsf, 2084 pidl, 2085 dwFlags, 2195 pidl, 2196 dwFlags, 2086 2197 &str))) 2087 2198 { … … 2094 2205 * GetShellFolderFromPidl 2095 2206 * 2096 * pidlRel is the item pidl relative 2207 * pidlRel is the item pidl relative 2097 2208 * Return the IShellFolder of the absolute pidl 2098 2209 */ … … 2110 2221 if(SUCCEEDED(IShellFolder_BindToObject(psfParent, pidlAbs, NULL, &IID_IShellFolder, (LPVOID*)&psf))) 2111 2222 { 2112 2223 IShellFolder_Release(psfParent); 2113 2224 return psf; 2114 2225 } … … 2133 2244 pidlParent = COMDLG32_PIDL_ILClone(pidl); 2134 2245 COMDLG32_PIDL_ILRemoveLastID(pidlParent); 2135 2246 2136 2247 return pidlParent; 2137 2248 } … … 2140 2251 * GetPidlFromName 2141 2252 * 2142 * returns the pidl of the file name relative to folder 2253 * returns the pidl of the file name relative to folder 2143 2254 * NULL if an error occured 2144 2255 */ … … 2154 2265 if(!lpcstrFileName) 2155 2266 return NULL; 2156 2267 2157 2268 MultiByteToWideChar(CP_ACP, 2158 MB_PRECOMPOSED, 2159 lpcstrFileName, 2160 -1, 2161 (LPWSTR)lpwstrDirName, 2162 MAX_PATH); 2269 MB_PRECOMPOSED, 2270 lpcstrFileName, 2271 -1, 2272 (LPWSTR)lpwstrDirName, 2273 MAX_PATH); 2163 2274 2164 2275 IShellFolder_ParseDisplayName(psf, 0, … … 2167 2278 &ulEaten, 2168 2279 &pidl, 2169 NULL); 2280 NULL); 2170 2281 2171 2282 return pidl; … … 2197 2308 /* 2198 2309 * Memory allocation methods */ 2199 char*MemAlloc(UINT size)2200 { 2201 return (char *)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,size);2310 void *MemAlloc(UINT size) 2311 { 2312 return HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,size); 2202 2313 } 2203 2314
Note:
See TracChangeset
for help on using the changeset viewer.