How to read .ocx file in C++ (Not MFC)

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2007
Posts: 22
Reputation: swethakiran is an unknown quantity at this point 
Solved Threads: 0
swethakiran swethakiran is offline Offline
Newbie Poster

Re: How to read .ocx file in C++ (Not MFC)

 
0
  #31
Dec 17th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 22
Reputation: swethakiran is an unknown quantity at this point 
Solved Threads: 0
swethakiran swethakiran is offline Offline
Newbie Poster

Re: How to read .ocx file in C++ (Not MFC)

 
0
  #32
Jan 11th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,089
Reputation: vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all 
Solved Threads: 164
vijayan121 vijayan121 is offline Offline
Veteran Poster

Re: How to read .ocx file in C++ (Not MFC)

 
0
  #33
Jan 11th, 2008
> 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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 22
Reputation: swethakiran is an unknown quantity at this point 
Solved Threads: 0
swethakiran swethakiran is offline Offline
Newbie Poster

Re: How to read .ocx file in C++ (Not MFC)

 
0
  #34
Jan 11th, 2008
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" :-)

Regards,
swetha.
Last edited by swethakiran; Jan 11th, 2008 at 4:43 am.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,089
Reputation: vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all 
Solved Threads: 164
vijayan121 vijayan121 is offline Offline
Veteran Poster

Re: How to read .ocx file in C++ (Not MFC)

 
0
  #35
Jan 11th, 2008
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?
Last edited by vijayan121; Jan 11th, 2008 at 8:34 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 22
Reputation: swethakiran is an unknown quantity at this point 
Solved Threads: 0
swethakiran swethakiran is offline Offline
Newbie Poster

Re: How to read .ocx file in C++ (Not MFC)

 
0
  #36
Jan 11th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,089
Reputation: vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all 
Solved Threads: 164
vijayan121 vijayan121 is offline Offline
Veteran Poster

Re: How to read .ocx file in C++ (Not MFC)

 
0
  #37
Jan 11th, 2008
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/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
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 22
Reputation: swethakiran is an unknown quantity at this point 
Solved Threads: 0
swethakiran swethakiran is offline Offline
Newbie Poster

Re: How to read .ocx file in C++ (Not MFC)

 
0
  #38
Jan 14th, 2008
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,
Regards,
swetha.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC