CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    11

    Why my CView derived class can't register a COleDropTarget?

    I still can't register COleDropTarget, I had try it in my CView derived class, CFormView derived class and CListView derived class, register return a 0. I find the problem is :

    BOOL COleDropTarget::Register(CWnd* pWnd)
    {
    ASSERT_VALID(this);
    ASSERT(m_hWnd == NULL); // registering drop target twice?
    ASSERT_VALID(pWnd);

    LPUNKNOWN lpUnknown = (LPUNKNOWN)GetInterface(&IID_IUnknown);
    ASSERT(lpUnknown != NULL);

    // the object must be locked externally to keep LRPC connections alive
    if (CoLockObjectExternal(lpUnknown, TRUE, FALSE) != S_OK)
    >> return FALSE;
    .
    .
    .
    }
    CoLockObjectExternal(lpUnknown, TRUE, FALSE) return a not S_OK, why? and how could I get it?
    Thanks!!!


  2. #2
    Join Date
    Apr 1999
    Posts
    11

    Some new problem

    I write a class derived from CWnd, and create COleDropTarget for it, Register this COleDropTarget in OnCreate() function.
    In most time, it's can't work, but some time(in debug mode) it can work.
    Why?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured