Hi vijayan,

Now I am trying to provide an activeXcontrol using ATL.

The link what you have given containing some sample code.So I tried like that manner only.
But while compiling I am getting some errors which are related to ATLWIN.H andATLCOM.H like
"ATLWIN.H:_Module is undefined"
In these two files all errors are related to this "_Module" .

And in this below code,

class CHostActiveXModule : public CAtlExeModuleT<CHostActiveXModule>
public :

CMainWindow m_wndMain;

I am getting error like "CAtlExeModuleT:undefined base class"

So please vijayan tell me the sollution for this.I struck in middle.
Hope you will give reply.

Thanks & Regards,

Hi vijayan,

Now, I am tyring to read ocx file using ATL.
I am sending the code how I have tried.

# import "C:\Program Files\GMS\Bin\MMap.ocx"  no_namespace \
raw_dispinterfaces \
raw_native_types named_guids

#include <atlbase.h>

//#include <atlcom.h>
//#include <atlhost.h>
//#include <atlctl.h>

int _tmain(int argc, _TCHAR* argv[])
HRESULT hr;// = S_OK;

CComBSTR bstrVersionInfo;
CComPtr<_DMMap> mmap;

Picture* pic;
enumMoveMapMode*  mode;// = 0;
short val ;
char val1[10];

hr = mmap.CoCreateInstance ( __uuidof(MMap), 0 , CLSCTX_INPROC_SERVER);


hr = mmap->get_MapID(&val);
if(val == NULL)


return TRUE;


This code was compiling successfully.But it was not reading that ocx file.
I am using this get_mapid function to get the map id.But it is returning some negative value. What is the problem in this code.

Hope will give reply as early as possible.


> But it is returning some negative value. What is the problem in this code.
what is the value of HRESULT hr after this call? hr = mmap->get_MapID(&val); is it S_OK? if not what is it? in visual studio, you coul use the Error Lookup tool to get a human readable error description.

also, you would get better mileage from a forum if you do not direct questions to any specific member. even if that member is currently active, there may be others who are more knowlegeable about the problem and would be able to guide you in a better way.

It was returning the error again CATASTROPHIC FAILURE. What have to do to acieve this problem.
What is the nex step I have to do?

Please help me to come out from this problem.

Forgot to tell you that "HAPPY NEW YEAR" :-)


ok. we need to revert to your post #31 and resume from there.
are you using visual VC++ 2005 (visual studio 2005)?
have you fixed the error '_Module is undefined' ?
and the error 'undefined base class' ?
and been able to compile your code?

Hi vijayan,

I am using the code from this below link.


In this code if I am including atlwin.h and atlhost.h header files I am getting errors like " ATLWIN.H: _Module undeclared identifier".

If I am not including those header files I am getting errors like "CWndClassInfo is not declared by ATL" (some thing like this eroor.But not exactly this error).

class CHostActiveXModule : public CAtlExeModuleT<CHostActiveXModule>
public :

And also I am getting some other errors like "CAtlExeModuleT undeclared identifier".

Thanks a lot,

The example that you are trying to use requires Visual Studio 2005.
from the error messages _Module undeclared identifier and CAtlExeModuleT undeclared identifier , it appears that you are
using an earlier version of visual studio (and ATL).

if you are using Visual Studio 2003, then the example code to use is in http://msdn2.microsoft.com/en-us/library/9d0714y1(VS.71).aspx

if you are using Visual Studio 2005, then the code you are currently using ( from http://msdn2.microsoft.com/en-us/library/9d0714y1(VS.80).aspx ) should compile without errors.

that the error you get refers to a global symbol _Module indicates that you are trying to use Visual C++ 6.0. this will not work at all. you need to move to Visual Studio 2003 or later.

note: if are still onVisual C++ 6.0, then it makes sense to go directly to Visual Studio 2008. in this case, use the example code from http://msdn2.microsoft.com/en-us/library/9d0714y1.aspx

Yeah.I am using Visual C++-6.0 .

Ok vijayan, I will try in Visual Studio 2005 and I will tell about the status of this code.

Thanku very much,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.