Click here to Skip to main content
11,479,034 members (62,517 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C++
I have created a simple MFC activex control. I have also added class "Add ATL Support to MFC" for the above project using Add->Add Class. now if I use CComPtr< T> x; its showing CComPtr undefined even though I have included atlbase.h and header files.
Posted 27-Dec-12 2:21am
Edited 27-Dec-12 3:06am
Richard MacCutchan at 27-Dec-12 8:27am
What type is T?
sandeepyes at 27-Dec-12 8:39am
Richard MacCutchan at 27-Dec-12 8:49am
Why not update your question with some proper detail. Passing one word answers really does not offer anything in the way of explanation.
sandeepyes at 27-Dec-12 22:51pm
I dont think its the problem with the type or variable. In Visual Studio its saying "CComPtr" is undefined, one of my friend told that the header files and their classes and functions are not loaded, so its not recognizing those keywords.
and the declaration is
CComPtr< IDispatch> spDoc;
I have used the source code from
I have included files WebPage.h and WebPage.cpp from above link for my project and facing the problem.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Problem solved. I just added ATL namespace as "using namespace ATL;" and the problem solved. thanks to all who helped.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 200
1 F-ES Sitecore 195
2 Frankie-C 120
3 OriginalGriff 105
4 DamithSL 95
0 Sergey Alexandrovich Kryukov 7,880
1 OriginalGriff 7,341
2 Sascha Lefèvre 3,064
3 Maciej Los 2,491
4 Richard Deeming 2,335

Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100