Skip to content

Commit

Permalink
working dragdrop from browser (but disabled)
Browse files Browse the repository at this point in the history
  • Loading branch information
janwilmans committed Jul 31, 2017
1 parent 3970db8 commit b706d56
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
1 change: 0 additions & 1 deletion DebugView++.sln
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ Global
{F7F5DB6E-B52D-46C1-9E40-43934514AEEB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{F7F5DB6E-B52D-46C1-9E40-43934514AEEB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{F7F5DB6E-B52D-46C1-9E40-43934514AEEB}.Debug|Win32.ActiveCfg = Debug|Any CPU
{F7F5DB6E-B52D-46C1-9E40-43934514AEEB}.Debug|Win32.Build.0 = Debug|Any CPU
{F7F5DB6E-B52D-46C1-9E40-43934514AEEB}.Debug|x64.ActiveCfg = Debug|Any CPU
{F7F5DB6E-B52D-46C1-9E40-43934514AEEB}.Debug|x64.Build.0 = Debug|Any CPU
{F7F5DB6E-B52D-46C1-9E40-43934514AEEB}.Debug|x86.ActiveCfg = Debug|Any CPU
Expand Down
11 changes: 4 additions & 7 deletions DebugView++/DropTargetSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ void DropTargetSupport::Unregister()

STDMETHODIMP DropTargetSupport::DragEnter(IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL /*pt*/, DWORD* pdwEffect)
{

*pdwEffect = DROPEFFECT_SCROLL;
CComPtr<IEnumFORMATETC> pEnum;
pDataObject->EnumFormatEtc(DATADIR_GET, &pEnum);
while (pEnum->Next(1, &m_fe, nullptr) == NO_ERROR)
Expand All @@ -42,8 +40,6 @@ STDMETHODIMP DropTargetSupport::DragEnter(IDataObject* pDataObject, DWORD /*grfK
break;
}
}
*pdwEffect = DROPEFFECT_COPY;

return S_OK;
}

Expand All @@ -60,13 +56,14 @@ STDMETHODIMP DropTargetSupport::DragLeave()

STDMETHODIMP DropTargetSupport::Drop(IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL /*pt*/, DWORD* pdwEffect)
{
auto stg = STGMEDIUM();
auto stg = STGMEDIUM();
pDataObject->GetData(&m_fe, &stg);
auto lpData = static_cast<LPCTSTR>(GlobalLock(stg.hGlobal));
auto lpData = static_cast<char*>(GlobalLock(stg.hGlobal));

//m_view.SetWindowText(lpData);
OutputDebugString(lpData);
OutputDebugStringA(lpData);
GlobalUnlock(stg.hGlobal);
ReleaseStgMedium(&stg);

*pdwEffect = DROPEFFECT_COPY;
return S_OK;
Expand Down
7 changes: 3 additions & 4 deletions DebugView++/LogView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,9 @@ LRESULT CLogView::OnCreate(const CREATESTRUCT* /*pCreate*/)

ApplyFilters();

// todo: find out why DropTargetSupport::DragEnter is never called...
CComObject<DropTargetSupport>::CreateInstance(&m_pDropTargetSupport);
m_pDropTargetSupport->AddRef();
m_pDropTargetSupport->Register(*this);
//CComObject<DropTargetSupport>::CreateInstance(&m_pDropTargetSupport);
//m_pDropTargetSupport->AddRef();
//m_pDropTargetSupport->Register(*this);

return 0;
}
Expand Down
2 changes: 2 additions & 0 deletions Win32Lib/Com.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ ComInitialization::ComInitialization(CoInit init)
HRESULT hr = CoInitializeEx(nullptr, init); //DrMemory: LEAK 264 direct bytes
if (FAILED(hr))
throw Win32Error(hr, "CoInitializeEx");
OleInitialize(nullptr);
}

ComInitialization::~ComInitialization()
{
OleUninitialize();
CoUninitialize();
}

Expand Down

0 comments on commit b706d56

Please sign in to comment.