Solved

C2039 compiling errors

Posted on 2006-10-19
4
431 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
ID: 17770752
Did you forget to

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

?
0
 

Author Comment

by:lapucca
ID: 17770778
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
ID: 17770993
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
ID: 17771017
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

809 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