Clone
ixen <ixen@copyhandler.com>
committed
on 12 Nov 16
Improved shell extension integration to allow cooperating with Q-Dir and Everything (and possibly with a whole lot of different software) (CShow more
Improved shell extension integration to allow cooperating with Q-Dir and Everything (and possibly with a whole lot of different software) (CH-266).

Show less

ParallelizeReaderWriter + 3 more
src/chext/TShellExtData.cpp (+4 -2)
498 498         {
499 499                 STGMEDIUM medium;
500 500                 hResult = piDataObject->GetData(&fe, &medium);
501 501                 if(SUCCEEDED(hResult) && !medium.hGlobal)
502 502                         hResult = E_FAIL;
503 503                 if(SUCCEEDED(hResult))
504 504                 {
505 505                         // specify operation
506 506                         DWORD* pdwData = (DWORD*)GlobalLock(medium.hGlobal);
507 507                         if(pdwData)
508 508                         {
509 509                                 m_dwIDataObjectDropEffect = *pdwData;
510 510                                 GlobalUnlock(medium.hGlobal);
511 511                         }
512 512                         else
513 513                                 hResult = E_FAIL;
514 514                 }
515 515
516 516                 ReleaseStgMedium(&medium);
517 517         }
  518         else if(hResult == DV_E_CLIPFORMAT || hResult == DV_E_FORMATETC)
  519                 hResult = S_FALSE;      // no drop effect supplied
518 520
519 521         return hResult;
520 522 }
521 523
522 524 HRESULT TShellExtData::ReadClipboard()
523 525 {
524 526         HRESULT hResult = S_FALSE;
525 527
526 528         if(IsClipboardFormatAvailable(CF_HDROP))
527 529         {
528 530                 // read paths from clipboard
529 531                 if(!OpenClipboard(nullptr))
530 532                         return E_FAIL;
531 533
532 534                 HANDLE hClipboardData = GetClipboardData(CF_HDROP);
533 535                 if(!hClipboardData)
534 536                         hResult = E_FAIL;
535 537
536 538                 if(SUCCEEDED(hResult))
537 539                 {
 
544 546                                 hClipboardData = GetClipboardData(nFormat);
545 547                                 if(!hClipboardData)
546 548                                         hResult = E_FAIL;
547 549                                 else
548 550                                 {
549 551                                         LPVOID pClipboardData = GlobalLock(hClipboardData);
550 552                                         if(!pClipboardData)
551 553                                                 hResult = E_FAIL;
552 554                                         else
553 555                                                 m_dwClipboardDropEffect = *((DWORD*)pClipboardData);
554 556
555 557                                         GlobalUnlock(hClipboardData);
556 558                                 }
557 559                         }
558 560                 }
559 561
560 562                 CloseClipboard();
561 563
562 564                 return hResult;
563 565         }
564           else
  566
565 567         return S_FALSE;
566 568 }
567 569
568 570 bool TShellExtData::IsSameDrive(const chcore::TSmartPath& spPath1, const chcore::TSmartPath& spPath2) const
569 571 {
570 572         // NOTE: see operator== in TSmartPath for comments on path case sensitivity and possible issues with it
571 573         return (spPath1.HasDrive() && spPath2.HasDrive() && spPath1.GetDrive() == spPath2.GetDrive())
572 574                         || (spPath1.IsNetworkPath() && spPath2.IsNetworkPath() && spPath1.GetServerName() == spPath2.GetServerName());
573 575 }
574 576
575 577 void TShellExtData::ReadDefaultSelectionStateFromMenu(HMENU hMenu)
576 578 {
577 579         // it's none by default
578 580         m_eDefaultSystemMenuAction = eAction_None;
579 581
580 582         BOOST_ASSERT(hMenu != nullptr);
581 583         if(hMenu)
582 584         {
583 585                 MENUITEMINFO mii;
584 586                 mii.cbSize = sizeof(MENUITEMINFO);