Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8099953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:34:48+00:00 2026-06-05T22:34:48+00:00

I am facing a strange issue.It is working well with outlook 2K3 but not

  • 0

I am facing a strange issue.It is working well with outlook 2K3 but not anymore on outlook 2K7 and 2K10.

Problem –
If I drag a file from my application and drop onto the message body in a new message in outlook 2007 nothing happens. Instead the expected behavior is – file should attach to the message. It work well in outlook 2003 and I haven’t made any change in my code.
If I drag file from my application and drop on to windows desktop, it works without any problem. Now if I drag the same file from Windows desktop and drop onto the new message in outlook 2007, file gets attached. This leaves me guessing that there is something need to change in my code but I unable to figure out.

Investigation –

We have implemented the CFSTR_FILEDESCRIPTOR, CFSTR_FILECONTENTS and CF_TXT in the CDataObject::Getdata() method.
I have noticed is that in case of Outlook 2007, when I drop file (from my application) to message body in new message, only CFSTR_FILEDESCRIPTOR clipboard format is called.
While in case of Outlook 2003, if I drop file (from my application) to message body in new message CDataObject::GetData() is called two times, CFSTR_FILEDESCRIPTOR followed by CFSTR_FILECONTENTS clipboard formats.

In the second file contents are extracted since GetData is not called second time hence file is not attached to email. Following is the sample code.

Does anyone know what could be the reason? Or what else i can try to narrow down the issue.

STDMETHODIMP CDataObject::GetData ( 
            LPFORMATETC                pFE, 
            LPSTGMEDIUM         pSTM) 
{ 

HGLOBAL                                        hMem; 
LPFILEGROUPDESCRIPTOR        pfgd; 
UINT                                        uFormat, uBytes; 
    void*                                        p; 

    m_uFmtUsed = 0; 
    uFormat = pFE->cfFormat; 

    // FILEDESCRIPTOR format 
    if (uFormat == m_fe[0].cfFormat) 
    { 
            if (!(pFE->dwAspect & DVASPECT_CONTENT)) 
                    return DV_E_DVASPECT; 
    if (!(pFE->tymed & TYMED_HGLOBAL)) 
                    return DV_E_FORMATETC; 

        hMem=GlobalAlloc (GMEM_SHARE | GMEM_MOVEABLE, 
                            sizeof(FILEGROUPDESCRIPTOR)); 

            if (hMem == NULL) 
                    return STG_E_MEDIUMFULL; 

            pfgd = (LPFILEGROUPDESCRIPTOR)GlobalLock (hMem); 
            pfgd->cItems = 1; 
            pfgd->fgd[0].dwFlags = FD_ATTRIBUTES; 
            pfgd->fgd[0].dwFileAttributes = FILE_ATTRIBUTE_NORMAL; 
            lstrcpy (pfgd->fgd[0].cFileName, m_pszName); 

            GlobalUnlock (hMem); 

            pSTM->hGlobal = hMem; 
            pSTM->tymed = TYMED_HGLOBAL; 
            pSTM->pUnkForRelease = NULL; 
            m_uFmtUsed = uFormat; 
            return S_OK; 
    } 

    // FILECONTENTS clipboard format 
    else if (uFormat == m_fe[1].cfFormat) 
    { 
            if (!(pFE->dwAspect & DVASPECT_CONTENT)) 
                    return DV_E_DVASPECT; 
    if (!(pFE->tymed & TYMED_HGLOBAL)) 
                    return DV_E_FORMATETC; 

            if (!m_pData) 
            { 
                    m_pData = PKDropGetData ( 
                                    m_pStruct, FALSE, FALSE, &uBytes); 
            } 

        hMem = GlobalAlloc (GMEM_SHARE|GMEM_MOVEABLE, uBytes); 

            if (hMem == NULL) 
                    return STG_E_MEDIUMFULL; 

            p = GlobalLock (hMem); 
            memcpy (p, m_pData, uBytes); 
            GlobalUnlock (hMem); 

            pSTM->hGlobal = hMem; 
            pSTM->tymed = TYMED_HGLOBAL; 
            pSTM->pUnkForRelease = NULL; 
            m_uFmtUsed = uFormat; 
            return S_OK; 
    } 

.... 
..... 
.... 
    return DV_E_FORMATETC; 
} 


QueryGetData(LPFORMATETC pFE )
{
UINT uFormat = pFE->cfFormat;
BOOL bRet = FALSE;
if (uFormat == m_fe[0].cfFormat)            // filegroupdescriptor
{
bRet = (BOOL)(pFE->tymed & TYMED_HGLOBAL);
 }
else if (uFormat == m_fe[1].cfFormat)       // filecontents
{
    bRet = (BOOL)(pFE->tymed & TYMED_HGLOBAL);
}
else 
bRet = false; 

 ----
 ----
return (bRet ? S_OK : DV_E_FORMATETC);
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:34:50+00:00Added an answer on June 5, 2026 at 10:34 pm

    To debug this, run it up in the debugger and stick a break point on this line:

    // FILEDESCRIPTOR format  
    if (uFormat == m_fe[0].cfFormat) 
    

    Then step through.

    Notes:

    If it was being called twice before, once with CFSTR_FILEDESCRIPTOR and then again with CFSTR_FILECONTENTS, that means that it failed the first time, probably because you didn’t support the desired TYMED. Then it is trying again with CFSTR_FILECONTENTS.

    I suspect that CFSTR_FILEDESCRIPTOR never worked, and Outlook is simply no longer trying the second format after the first fails.

    • Did you specify a TYMED you don’t support in response to QueryGetData or EnumFORMATETC?

    If so, Outlook may be asking for FILEGROUPDESCRIPTOR in, say, an IStream, and when you return an error it is simply giving up.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing a strange issue wherein HTML5 Geolocation is not working only on
I am facing strange issue with our WCF service. The same code was working
I am facing a strange issue, working on my mac osx lion (under xcode4/clang,
I am working on a C# application and facing a strange issue here. I
we are facing a strange issue. we have a (custom)file upload control in our
I am facing a strange issue where-in my webpage does not load fully after
i am able to parse the XML file. but i am facing strange error.
While working with Jquery Mobile I am facing a strange issue. Jquery Mobile adds
I am facing a very strange issue in X-Cart, I am working on localhost.
I'm currently facing a strange issue whereby I did not get any errors from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.