Solved

C2039 compiling errors

Posted on 2006-10-19
4
430 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
The dreaded error 1935 with VC++ 2008 Redistributable 12 88
SetCurrentDirectory path limit 7 105
c++ getting the first 10 characters of a char* string 11 90
Dialogbox API leak? 18 81
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

911 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

24 Experts available now in Live!

Get 1:1 Help Now