| | |
How to read .ocx file in C++ (Not MFC)
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2007
Posts: 22
Reputation:
Solved Threads: 0
Hi vijayan,
Now I am trying to provide an activeXcontrol using ATL.
http://msdn2.microsoft.com/en-us/lib...y1(VS.80).aspx
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,
swetha.
Now I am trying to provide an activeXcontrol using ATL.
http://msdn2.microsoft.com/en-us/lib...y1(VS.80).aspx
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,
swetha.
•
•
Join Date: Nov 2007
Posts: 22
Reputation:
Solved Threads: 0
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[])
{
CoInitialize(NULL);
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);
if(SUCCEEDED(hr))
{
hr = mmap->get_MapID(&val);
itoa(val,val1,10);
if(val == NULL)
MessageBox(NULL,"HI","HI",MB_OK);
else
MessageBox(NULL,val1,"SUCCESS",MB_OK);
}
mmap.Release();
CoUninitialize();
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.
Regards,
swetha.
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[])
{
CoInitialize(NULL);
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);
if(SUCCEEDED(hr))
{
hr = mmap->get_MapID(&val);
itoa(val,val1,10);
if(val == NULL)
MessageBox(NULL,"HI","HI",MB_OK);
else
MessageBox(NULL,val1,"SUCCESS",MB_OK);
}
mmap.Release();
CoUninitialize();
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.
Regards,
swetha.
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
> But it is returning some negative value. What is the problem in this code.
what is the value of HRESULT hr after this call?
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.
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.
•
•
Join Date: Nov 2007
Posts: 22
Reputation:
Solved Threads: 0
Hi vijayan,
I am using the code from this below link.
http://msdn2.microsoft.com/en-us/lib...y1(VS.80).aspx
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,
Regards,
swetha.
I am using the code from this below link.
http://msdn2.microsoft.com/en-us/lib...y1(VS.80).aspx
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,
Regards,
swetha.
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
The example that you are trying to use requires Visual Studio 2005.
from the error messages
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/lib...y1(VS.71).aspx
if you are using Visual Studio 2005, then the code you are currently using ( from http://msdn2.microsoft.com/en-us/lib...y1(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
from the error messages
_Module undeclared identifier and CAtlExeModuleT undeclared identifier , it appears that you areusing 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/lib...y1(VS.71).aspx
if you are using Visual Studio 2005, then the code you are currently using ( from http://msdn2.microsoft.com/en-us/lib...y1(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
![]() |
Similar Threads
- Read text file to a certain point (C#)
- Read XML File in C/C++ (C++)
- read text file (C#)
- using a "for" loop to read a text file (VB.NET)
- read data from file (C++)
- read a dat file through C (C)
Other Threads in the C++ Forum
- Previous Thread: infinite loop in recursion-no clue
- Next Thread: conflict graph
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






