Solved

C2039 compiling errors

Posted on 2006-10-19
4
429 Views
Last Modified: 2008-02-01
I've created a empty project and added a ATL class to it.  I then copy the ATL cpp files and the header file and add it to my C++ COM project.

I'm getting a lot of compiling error C2039 like those listed below.  I double cliked to see the definition of those structure and the members are part of the structure's defintion.  I can also type . or -> and the intellisense would bring up the members including those complained in the errors as valid members to select from.  It's very odd.  How can I correct this?  Thanks.

Error      55      error C2039: 'aObjects' : is not a member of 'DSOBJECTNAMES'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      54
Error      28      error C2039: 'cfFormat' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      21
Error      45      error C2039: 'cfFormat' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      42
Error      31      error C2039: 'dwAspect' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      23
Error      48      error C2039: 'dwAspect' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      44
Error      38      error C2039: 'hGlobal' : is not a member of 'tagSTGMEDIUM'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      29
Error      42      error C2039: 'hGlobal' : is not a member of 'tagSTGMEDIUM'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      35
Error      53      error C2039: 'hGlobal' : is not a member of 'tagSTGMEDIUM'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      50
Error      59      error C2039: 'hGlobal' : is not a member of 'tagSTGMEDIUM'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      58
Error      33      error C2039: 'lindex' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      24
Error      49      error C2039: 'lindex' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      45
Error      30      error C2039: 'ptd' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      22
Error      47      error C2039: 'ptd' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      43
Error      34      error C2039: 'tymed' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      25
Error      50      error C2039: 'tymed' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      46


--
Thanks.
0
Comment
Question by:lapucca
  • 2
  • 2
4 Comments
 
LVL 86

Expert Comment

by:jkr
Comment Utility
Did you forget to

#include <Dsclient.h>
#include <objidl.h>

?
0
 

Author Comment

by:lapucca
Comment Utility
I added "#include <objidl.h>" but I'm still getting those errors.  Here are all my include files and their orders.  Thanks.

#include <Objbase.h>
#include <asn1.h>
#include <activeds.h>
#include <aclapi.h>
#include <atlbase.h>
#include <atlconv.h>
#include "Adsprop.h"
#include <shlobj.h>
#include "Dsclient.h"
#include <objidl.h>
#include "blob.h"
#include "debug.h"
#include "globals.h"
#include <comdef.h>
#include <commctrl.h>
#include <comutil.h>
#include <crtdbg.h>
#include <Iads.h>
#include <mmc.h>
#include <string.h>
#include <tchar.h>
#include <vector>
#include "resource.h"
#include <string>
#include <windows.h>
#include "winldap.h"
#include "Sddl.h."
#include <stdio.h>
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
Comment Utility
Hm, could you post the code where the errors occur?

BTW, put

#include <windows.h>

at the top of the include list.
0
 

Author Comment

by:lapucca
Comment Utility
I moved the windows.h to the top and the errors are still there.

I'm still working on the code that you pointed me to a couple of days ago, http://windowssdk.msdn.microsoft.com/en-us/library/ms676867(VS.80).aspx.  It didn't work when I add those codes to my existing C++ COM project that creates extended property page.  I now am trying to put most of those code into an ATL class and I added that to my C++ COM Project as a new class but I'm going through new compilation errors.  Below are some of the code where the errors are from.  As I mentioned earlier, it's strange that the intelliesense shows it's a valid member and so does the definition of the struct.

Here is the code for the 1st error message for aObjects:

HWND CreateADsNotificationObject(IDataObject *pDataObject)
{
    STGMEDIUM   stm;
    FORMATETC   fe;
    HRESULT     hr;
    HWND        hwndNotifyObject = NULL;

    /*
    The "DsAdminMultiSelectClipFormat" clipboard format is supported by the
    data object if the Active Directory Users and Computers snap-in supports
    multi-selection property sheets.
    */
    fe.cfFormat = RegisterClipboardFormat(TEXT("DsAdminMultiSelectClipFormat"));
    fe.ptd = NULL;
    fe.dwAspect = DVASPECT_CONTENT;
    fe.lindex = -1;
    fe.tymed = TYMED_HGLOBAL;
    hr = pDataObject->GetData(&fe, &stm);
    if (SUCCEEDED(hr))
    {
        PWSTR pwzUniqueID = (LPWSTR)GlobalLock(stm.hGlobal);

        if (pwzUniqueID)
        {
            hr = ADsPropCreateNotifyObj(pDataObject, pwzUniqueID, &hwndNotifyObject);

            GlobalUnlock(stm.hGlobal);
        }
           
        ReleaseStgMedium(&stm);
    }
    else
    {
        fe.cfFormat = RegisterClipboardFormat(CFSTR_DSOBJECTNAMES);
        fe.ptd = NULL;
        fe.dwAspect = DVASPECT_CONTENT;
        fe.lindex = -1;
        fe.tymed = TYMED_HGLOBAL;
        hr = pDataObject->GetData(&fe, &stm);
        if(SUCCEEDED(hr))
        {
            LPDSOBJECTNAMES pdson = (LPDSOBJECTNAMES)GlobalLock(stm.hGlobal);

            if(pdson)
            {
                LPWSTR  pwszName = (LPWSTR)((LPBYTE)pdson + pdson->aObjects[0].offsetName);
               
                hr = ADsPropCreateNotifyObj(pDataObject, pwszName, &hwndNotifyObject);

                GlobalUnlock(stm.hGlobal);
            }
           
            ReleaseStgMedium(&stm);
        }
    }

    return hwndNotifyObject;

}
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now