Click here to Skip to main content
14,869,114 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: C++/MFC solution Convert string to integer only such that if it is alphanumeric or float it should show as invalid values. Pin
SoMad18-Jul-12 10:47
professionalSoMad18-Jul-12 10:47 
AnswerRe: C++/MFC solution Convert string to integer only such that if it is alphanumeric or float it should show as invalid values. Pin
Shivanand Gupta21-Aug-12 23:40
MemberShivanand Gupta21-Aug-12 23:40 
QuestionVisual Studio 10 Linker Pin
BarryPearlman15-Jul-12 14:52
MemberBarryPearlman15-Jul-12 14:52 
AnswerRe: Visual Studio 10 Linker Pin
Richard MacCutchan15-Jul-12 22:13
mveRichard MacCutchan15-Jul-12 22:13 
QuestionHow to unload a memory-resident system dll from memory? Pin
creative2628-Jun-12 10:50
Membercreative2628-Jun-12 10:50 
AnswerRe: How to unload a memory-resident system dll from memory? Pin
Richard MacCutchan28-Jun-12 22:26
mveRichard MacCutchan28-Jun-12 22:26 
QuestionHELP BUTTON Pin
Smart Zulu22-Jun-12 1:15
MemberSmart Zulu22-Jun-12 1:15 
QuestionUnable to drop a file on a new message in outlook 2007 Pin
sisrahul19-Jun-12 2:57
Membersisrahul19-Jun-12 2:57 
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 = PKDropKeysGetData ( 
                                        (PPGPKEYSSTRUCT)m_pKeysStruct, 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; 
} 

Rahul Sisondia

GeneralBug in ATL/MFC 8.0 CString Pin
XmlSeeker14-Jun-12 18:58
MemberXmlSeeker14-Jun-12 18:58 
GeneralRe: Bug in ATL/MFC 8.0 CString Pin
Richard MacCutchan14-Jun-12 21:48
mveRichard MacCutchan14-Jun-12 21:48 
QuestionATL - Raise Event to all clients and acces to same variable Pin
ljubek7414-Jun-12 7:08
Memberljubek7414-Jun-12 7:08 
AnswerRe: ATL - Raise Event to all clients and acces to same variable Pin
barneyman17-Jun-12 14:51
Memberbarneyman17-Jun-12 14:51 
GeneralRe: ATL - Raise Event to all clients and acces to same variable Pin
ljubek7418-Jun-12 2:02
Memberljubek7418-Jun-12 2:02 
QuestionMFC exe to ATL service Pin
es196812-Jun-12 3:39
Memberes196812-Jun-12 3:39 
AnswerRe: MFC exe to ATL service Pin
barneyman13-Jun-12 18:02
Memberbarneyman13-Jun-12 18:02 
QuestionAPI Decision Pin
Collin Biedenkapp11-Jun-12 18:53
MemberCollin Biedenkapp11-Jun-12 18:53 
AnswerRe: API Decision Pin
Richard MacCutchan11-Jun-12 22:01
mveRichard MacCutchan11-Jun-12 22:01 
Questionhow to use an interface as a parameter in other atl objects? Pin
astupidboy31-May-12 20:41
Memberastupidboy31-May-12 20:41 
AnswerRe: how to use an interface as a parameter in other atl objects? Pin
Richard MacCutchan31-May-12 21:26
mveRichard MacCutchan31-May-12 21:26 
GeneralRe: how to use an interface as a parameter in other atl objects? Pin
astupidboy31-May-12 22:29
Memberastupidboy31-May-12 22:29 
GeneralRe: how to use an interface as a parameter in other atl objects? Pin
Richard MacCutchan31-May-12 22:35
mveRichard MacCutchan31-May-12 22:35 
GeneralRe: how to use an interface as a parameter in other atl objects? Pin
astupidboy31-May-12 22:56
Memberastupidboy31-May-12 22:56 
GeneralRe: how to use an interface as a parameter in other atl objects? Pin
Richard MacCutchan31-May-12 23:08
mveRichard MacCutchan31-May-12 23:08 
GeneralRe: how to use an interface as a parameter in other atl objects? Pin
astupidboy31-May-12 23:24
Memberastupidboy31-May-12 23:24 
GeneralRe: how to use an interface as a parameter in other atl objects? Pin
barneyman3-Jun-12 17:58
Memberbarneyman3-Jun-12 17:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.