| | |
How to read .ocx file in C++ (Not MFC)
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
the generated header file that you posted contains
and your #import is
these are not consistent with each other (no_namespace => do not generate a namespace)
you need to recompile your code after making any modification to the #import to get the
newly generated header file. i suspect you have not done that.
if (and only if) your header generates definitions inside
add a using namespace MMAPLib; directive right after the #import
then either of these should work
or
#pragma once
#pragma pack(push, 8)
#include <comdef.h>
namespace MMAPLib {
// ...
} // namespace MMAPLiband your #import is
#import "c:\WINNT\system32\MMap.ocx" \
named_guids LIBID_MMAPLib,DIID_DMMap,DIID_DMMapEvents,CLSID_MMap \
no_namespace MMAPLibyou need to recompile your code after making any modification to the #import to get the
newly generated header file. i suspect you have not done that.
if (and only if) your header generates definitions inside
namespace MMAPLib { add a using namespace MMAPLib; directive right after the #import
then either of these should work
C++ Syntax (Toggle Plain Text)
CoCreateInstance( CLSID_MMap, 0, CLSCTX_ALL, DIID__DMMap, reinterpret_cast <void**>(&pMP) );
C++ Syntax (Toggle Plain Text)
CoCreateInstance( __uuidof( MMap ), 0, CLSCTX_ALL, __uuidof( _DMMap ), reinterpret_cast <void**>(&pMP) );
Last edited by vijayan121; Nov 29th, 2007 at 9:48 am.
•
•
Join Date: Nov 2007
Posts: 22
Reputation:
Solved Threads: 0
How u told in previous mail like that only I did modifications in my code.Again same problem is coming.Now , I am sending the mmap.cpp,mmap.h and also mmap.tlh.
If you dont mind can you tell what changes again need to do.
/************************mmap.tlh file***************************/
/*****************************mmap.cpp*************************************/
/********************************mmap.h***************************/
Now also again I am getting error is that 'CLSID_MMap' : undeclared identifier
'DIID__DMMap' : undeclared identifier
I have one doubt that is it necessary to do changes in mmap.h file also?
Please tell me the sollution what I did wrong.Hope you will give the reply.
Thanks & Regards,
swetha
If you dont mind can you tell what changes again need to do.
/************************mmap.tlh file***************************/
c++ Syntax (Toggle Plain Text)
#pragma once #pragma pack(push, 8) #include <comdef.h> namespace MMAPLib { // // Forward references and typedefs // struct __declspec(uuid("d5f63c22-b3d3-11d0-b8f0-0020af344e0a")) /* dispinterface */ _DMMap; struct __declspec(uuid("d5f63c23-b3d3-11d0-b8f0-0020af344e0a")) /* dispinterface */ _DMMapEvents; struct /* coclass */ MMap; // // Smart pointer typedef declarations // _COM_SMARTPTR_TYPEDEF(_DMMap, __uuidof(IDispatch)); _COM_SMARTPTR_TYPEDEF(_DMMapEvents, __uuidof(IDispatch)); // // Type library items // struct __declspec(uuid("d5f63c22-b3d3-11d0-b8f0-0020af344e0a")) _DMMap : IDispatch { // // Property data // __declspec(property(get=GetMapNorth,put=PutMapNorth)) double MapNorth; __declspec(property(get=GetMapSouth,put=PutMapSouth)) double MapSouth; .......................... .... .. .. .. }; struct __declspec(uuid("d5f63c23-b3d3-11d0-b8f0-0020af344e0a")) _DMMapEvents : IDispatch { // // Wrapper methods for error-handling // // Methods: HRESULT MovePosition ( double X, double Y ); HRESULT Click ( ); HRESULT DblClick ( ); .... ..... ..... }; struct __declspec(uuid("d5f63c24-b3d3-11d0-b8f0-0020af344e0a")) MMap; // [ default ] dispinterface _DMMap // [ default, source ] dispinterface _DMMapEvents // // Named GUID constants initializations // extern "C" const GUID __declspec(selectany) LIBID_MMAPLib = {0xd5f63c21,0xb3d3,0x11d0,{0xb8,0xf0,0x00,0x20,0xaf,0x34,0x4e,0x0a}}; extern "C" const GUID __declspec(selectany) DIID__DMMap = {0xd5f63c22,0xb3d3,0x11d0,{0xb8,0xf0,0x00,0x20,0xaf,0x34,0x4e,0x0a}}; extern "C" const GUID __declspec(selectany) DIID__DMMapEvents = {0xd5f63c23,0xb3d3,0x11d0,{0xb8,0xf0,0x00,0x20,0xaf,0x34,0x4e,0x0a}}; extern "C" const GUID __declspec(selectany) CLSID_MMap = {0xd5f63c24,0xb3d3,0x11d0,{0xb8,0xf0,0x00,0x20,0xaf,0x34,0x4e,0x0a}}; // // Wrapper method implementations // #include "c:\mmap-nov-16\mmap\debug\MMap.tli" } // namespace MMAPLib #pragma pack(pop) /******************************end the mmap.tlh file***************************/
/*****************************mmap.cpp*************************************/
c++ Syntax (Toggle Plain Text)
#import "c:\WINNT\system32\MMap.ocx" \ named_guids LIBID_MMAPLib,CLSID_MMap,DIID__DMMap,DIID__DMMapEvents using namespace MMAPLib; #include "stdafx.h" #include <cassert> #include<windows.h> #include "mmap.h" void main() { CoInitialize( NULL ); _DMMap* pMap = 0; HRESULT hr = CoCreateInstance(CLSID_MMap, 0, CLSCTX_ALL, DIID__DMMap, reinterpret_cast <void **>(&pMap)); assert(SUCCEEDED(hr)); hr = pMap->GetMapID(); assert(SUCCEEDED(hr)); pMap ->Release(); CoUninitialize(); } /**********************end the mmap.cpp file**********************************/
/********************************mmap.h***************************/
c++ Syntax (Toggle Plain Text)
class _DMMap { public: double GetMapID(); void PutMapID(double); double Release(); }; //_DMMap DIID__DMMap; /**********************end the mmap.h file******************************/
Now also again I am getting error is that 'CLSID_MMap' : undeclared identifier
'DIID__DMMap' : undeclared identifier
I have one doubt that is it necessary to do changes in mmap.h file also?
Please tell me the sollution what I did wrong.Hope you will give the reply.
Thanks & Regards,
swetha
Last edited by Ancient Dragon; Nov 30th, 2007 at 10:06 am. Reason: add code tags
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
looks like you are compiling with the /Yu"stdafx.h" compiler option. new projects in Visual C++ set this option by default to increase compilation speed. (to change the option, use the Project.Settings.C++.Precompiled Headers dialog.)
the Visual C++ Programmer's Guide explains the behavior you see:
http://msdn2.microsoft.com/en-us/lib...6c(VS.71).aspx
this means, everything in your code file before the #include "stdafx.h" line is completely ignored, because the compiler assumes that the necessary information is in your precompiled header.
you can fix the problem by one of these ways
a. move the #import directive and the using namespace directive after the other #include statements. in particular #include "stdafx.h"
b. move the #import directive and the using namespace directive into stdafx.h
c. turn off precompiled headers option (set it to not using precompiled headers)
then clean (or delete the .pch file) and rebuild you project.
the Visual C++ Programmer's Guide explains the behavior you see:
•
•
•
•
"The compiler treats all code occurring before the .h file as precompiled. It skips to just beyond the #include directive associated with the .h file, uses the code contained in the .pch file, and then compiles all code after filename.."
this means, everything in your code file before the #include "stdafx.h" line is completely ignored, because the compiler assumes that the necessary information is in your precompiled header.
you can fix the problem by one of these ways
a. move the #import directive and the using namespace directive after the other #include statements. in particular #include "stdafx.h"
b. move the #import directive and the using namespace directive into stdafx.h
c. turn off precompiled headers option (set it to not using precompiled headers)
then clean (or delete the .pch file) and rebuild you project.
Last edited by vijayan121; Nov 30th, 2007 at 10:06 am.
•
•
Join Date: Nov 2007
Posts: 22
Reputation:
Solved Threads: 0
Hi vijayan,
Thank you very much for ur prompt replies.
I tried all your suggestions. However, I am getting syntax errors in mmap.tlh file while reading it like the following
error C2146: syntax error : missing ';' before identifier 'BackPicture'
error C2501: 'PicturePtr' : missing storage-class or type specifiers
etc...
I am including #import and namespace in image.cpp file. Similarly, do I need to include anything in image.h file? Whether I include definition of _DMMap(dispinterface in mmap.tlh) as class in image.h file or doesn't inculde image.h in cpp file, it didn't make any difference to the result.
MDSN help suggested to the following. However, I am not sure on how to do it and whether to do it or not.
"The path specified by the /I (additional include directories) compiler option, except it the compiler is searching for a type library that was referenced from another type library with the no_registry attribute"
http://msdn2.microsoft.com/en-us/lib...b6(vs.80).aspx
Thanks a lot for ur prompt responses and listening to my queries. I am new to this and there are no expertize in this small company where I am working.
Regards,
Swetha
Thank you very much for ur prompt replies.
I tried all your suggestions. However, I am getting syntax errors in mmap.tlh file while reading it like the following
error C2146: syntax error : missing ';' before identifier 'BackPicture'
error C2501: 'PicturePtr' : missing storage-class or type specifiers
etc...
I am including #import and namespace in image.cpp file. Similarly, do I need to include anything in image.h file? Whether I include definition of _DMMap(dispinterface in mmap.tlh) as class in image.h file or doesn't inculde image.h in cpp file, it didn't make any difference to the result.
MDSN help suggested to the following. However, I am not sure on how to do it and whether to do it or not.
"The path specified by the /I (additional include directories) compiler option, except it the compiler is searching for a type library that was referenced from another type library with the no_registry attribute"
http://msdn2.microsoft.com/en-us/lib...b6(vs.80).aspx
Thanks a lot for ur prompt responses and listening to my queries. I am new to this and there are no expertize in this small company where I am working.
Regards,
Swetha
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
first do this. create a small project which contains only a main.cpp as follows.
does this compile and link without errors?
if no, post the complete error message(s) generated by the compiler/linker and the complete .tlh file that was generated.
if yes, run the program. does it run without errors?
c++ Syntax (Toggle Plain Text)
#include <cassert> #include<windows.h> #import "c:\WINNT\system32\MMap.ocx" named_guids using namespace MMAPLib; void main() { CoInitialize( 0 ); _DMMap* pMap = 0; HRESULT hr = CoCreateInstance(CLSID_MMap, 0, CLSCTX_ALL, DIID__DMMap,reinterpret_cast <void**>(&pMap)); assert(SUCCEEDED(hr)); pMap->Release(); CoUninitialize(); }
if no, post the complete error message(s) generated by the compiler/linker and the complete .tlh file that was generated.
if yes, run the program. does it run without errors?
•
•
Join Date: Nov 2007
Posts: 22
Reputation:
Solved Threads: 0
Hi vijayan,
How u told like that only i was doing from starting onwards.But the errors are coming.
I think I already sent MMap.tlh file in previous mails.So,now I am sending while compiling which errors I am getting.
/********************ERRORS**************************/
C:\mmap-nov-16\Radar\Radar.cpp(8) : error C2017: illegal escape sequence
c:\mmap-nov-16\radar\debug\mmap.tlh(148) : error C2146: syntax error : missing ';' before identifier 'BackPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(148) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(148) : error C2501: 'BackPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(164) : error C2146: syntax error : missing ';' before identifier 'Font'
c:\mmap-nov-16\radar\debug\mmap.tlh(164) : error C2501: 'FontPtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(164) : error C2501: 'Font' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(178) : error C2146: syntax error : missing ';' before identifier 'MapPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(178) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(178) : error C2501: 'MapPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(260) : error C2146: syntax error : missing ';' before identifier 'ObjectPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(260) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(260) : error C2501: 'ObjectPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(288) : error C2146: syntax error : missing ';' before identifier 'WaypointPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(288) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(288) : error C2501: 'WaypointPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(360) : error C2146: syntax error : missing ';' before identifier 'GetBackPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(360) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(376) : error C2146: syntax error : missing ';' before identifier 'GetFont'
c:\mmap-nov-16\radar\debug\mmap.tlh(376) : error C2501: 'FontPtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(390) : error C2146: syntax error : missing ';' before identifier 'GetMapPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(390) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(472) : error C2146: syntax error : missing ';' before identifier 'GetObjectPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(472) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(500) : error C2146: syntax error : missing ';' before identifier 'GetWaypointPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(500) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tli(180) : error C2143: syntax error : missing ';' before 'tag::id'
c:\mmap-nov-16\radar\debug\mmap.tli(180) : error C2433: 'PicturePtr' : 'inline' not permitted on data declarations
c:\mmap-nov-16\radar\debug\mmap.tli(180) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tli(180) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\Radar.sbr': No such file or directory
Error executing bscmake.exe.
Radar.exe - 31 error(s), 0 warning(s)
/*****************************************End the errors*********************************/
One more thing is that if I am trying with other *.ocx file, it is compiling with out any errors.But if Iam trying with mmap.ocx file only these errors are getting.
What may be the reason?
Please give reply as early as possible.
Thanks And Regards,
swetha.
How u told like that only i was doing from starting onwards.But the errors are coming.
I think I already sent MMap.tlh file in previous mails.So,now I am sending while compiling which errors I am getting.
/********************ERRORS**************************/
C:\mmap-nov-16\Radar\Radar.cpp(8) : error C2017: illegal escape sequence
c:\mmap-nov-16\radar\debug\mmap.tlh(148) : error C2146: syntax error : missing ';' before identifier 'BackPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(148) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(148) : error C2501: 'BackPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(164) : error C2146: syntax error : missing ';' before identifier 'Font'
c:\mmap-nov-16\radar\debug\mmap.tlh(164) : error C2501: 'FontPtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(164) : error C2501: 'Font' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(178) : error C2146: syntax error : missing ';' before identifier 'MapPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(178) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(178) : error C2501: 'MapPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(260) : error C2146: syntax error : missing ';' before identifier 'ObjectPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(260) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(260) : error C2501: 'ObjectPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(288) : error C2146: syntax error : missing ';' before identifier 'WaypointPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(288) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(288) : error C2501: 'WaypointPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(360) : error C2146: syntax error : missing ';' before identifier 'GetBackPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(360) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(376) : error C2146: syntax error : missing ';' before identifier 'GetFont'
c:\mmap-nov-16\radar\debug\mmap.tlh(376) : error C2501: 'FontPtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(390) : error C2146: syntax error : missing ';' before identifier 'GetMapPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(390) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(472) : error C2146: syntax error : missing ';' before identifier 'GetObjectPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(472) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(500) : error C2146: syntax error : missing ';' before identifier 'GetWaypointPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(500) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tli(180) : error C2143: syntax error : missing ';' before 'tag::id'
c:\mmap-nov-16\radar\debug\mmap.tli(180) : error C2433: 'PicturePtr' : 'inline' not permitted on data declarations
c:\mmap-nov-16\radar\debug\mmap.tli(180) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tli(180) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\Radar.sbr': No such file or directory
Error executing bscmake.exe.
Radar.exe - 31 error(s), 0 warning(s)
/*****************************************End the errors*********************************/
One more thing is that if I am trying with other *.ocx file, it is compiling with out any errors.But if Iam trying with mmap.ocx file only these errors are getting.
What may be the reason?
Please give reply as early as possible.
Thanks And Regards,
swetha.
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
> C:\mmap-nov-16\Radar\Radar.cpp(8) : error C2017: illegal escape sequence
this is the first error reported by the compiler. what is this Radar.cpp file? and what does it contain? in paticular what does line 8 look like?
i repeat: create a small project which contains only a main.cpp. with only these 16 lines of code
and post the results.
also rename mmap.ocx as mmap.ocx.txt and upload that too. (click on the 'Manage Attachments' button)
this is the first error reported by the compiler. what is this Radar.cpp file? and what does it contain? in paticular what does line 8 look like?
i repeat: create a small project which contains only a main.cpp. with only these 16 lines of code
c++ Syntax (Toggle Plain Text)
#include <cassert> #include<windows.h> #import "c:\WINNT\system32\MMap.ocx" named_guids using namespace MMAPLib; void main() { CoInitialize( 0 ); _DMMap* pMap = 0; HRESULT hr = CoCreateInstance(CLSID_MMap, 0, CLSCTX_ALL, DIID__DMMap,reinterpret_cast <void**>(&pMap)); assert(SUCCEEDED(hr)); pMap->Release(); CoUninitialize(); }
also rename mmap.ocx as mmap.ocx.txt and upload that too. (click on the 'Manage Attachments' button)
Last edited by vijayan121; Dec 3rd, 2007 at 10:26 am.
•
•
Join Date: Nov 2007
Posts: 22
Reputation:
Solved Threads: 0
radar.cpp is new/modified file name of earlier image.cpp. Both of them are same. Very sorry for the confusion. When I keep attribute named_guids, I am getting the 1st error. And, if I remove it, I am not getting it.
I am getting the following errors in mmap.tlh with the code what you mentioned. I am getting the same errors even if I keep empty main function with #import.
I sent the OCX file to your gmail ID as it's confidential file.
c:\mmap-nov-16\radar\debug\mmap.tlh(148) : error C2146: syntax error : missing ';' before identifier 'BackPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(148) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(148) : error C2501: 'BackPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(164) : error C2146: syntax error : missing ';' before identifier 'Font'
c:\mmap-nov-16\radar\debug\mmap.tlh(164) : error C2501: 'FontPtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(164) : error C2501: 'Font' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(178) : error C2146: syntax error : missing ';' before identifier 'MapPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(178) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(178) : error C2501: 'MapPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(260) : error C2146: syntax error : missing ';' before identifier 'ObjectPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(260) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(260) : error C2501: 'ObjectPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(288) : error C2146: syntax error : missing ';' before identifier 'WaypointPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(288) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(288) : error C2501: 'WaypointPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(360) : error C2146: syntax error : missing ';' before identifier 'GetBackPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(360) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(376) : error C2146: syntax error : missing ';' before identifier 'GetFont'
c:\mmap-nov-16\radar\debug\mmap.tlh(376) : error C2501: 'FontPtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(390) : error C2146: syntax error : missing ';' before identifier 'GetMapPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(390) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(472) : error C2146: syntax error : missing ';' before identifier 'GetObjectPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(472) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(500) : error C2146: syntax error : missing ';' before identifier 'GetWaypointPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(500) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tli(180) : error C2143: syntax error : missing ';' before 'tag::id'
c:\mmap-nov-16\radar\debug\mmap.tli(180) : error C2433: 'PicturePtr' : 'inline' not permitted on data declarations
c:\mmap-nov-16\radar\debug\mmap.tli(180) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tli(180) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\Radar.sbr': No such file or directory
Error executing bscmake.exe.
I am getting the following errors in mmap.tlh with the code what you mentioned. I am getting the same errors even if I keep empty main function with #import.
I sent the OCX file to your gmail ID as it's confidential file.
c:\mmap-nov-16\radar\debug\mmap.tlh(148) : error C2146: syntax error : missing ';' before identifier 'BackPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(148) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(148) : error C2501: 'BackPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(164) : error C2146: syntax error : missing ';' before identifier 'Font'
c:\mmap-nov-16\radar\debug\mmap.tlh(164) : error C2501: 'FontPtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(164) : error C2501: 'Font' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(178) : error C2146: syntax error : missing ';' before identifier 'MapPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(178) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(178) : error C2501: 'MapPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(260) : error C2146: syntax error : missing ';' before identifier 'ObjectPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(260) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(260) : error C2501: 'ObjectPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(288) : error C2146: syntax error : missing ';' before identifier 'WaypointPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(288) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(288) : error C2501: 'WaypointPicture' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(360) : error C2146: syntax error : missing ';' before identifier 'GetBackPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(360) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(376) : error C2146: syntax error : missing ';' before identifier 'GetFont'
c:\mmap-nov-16\radar\debug\mmap.tlh(376) : error C2501: 'FontPtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(390) : error C2146: syntax error : missing ';' before identifier 'GetMapPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(390) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(472) : error C2146: syntax error : missing ';' before identifier 'GetObjectPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(472) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tlh(500) : error C2146: syntax error : missing ';' before identifier 'GetWaypointPicture'
c:\mmap-nov-16\radar\debug\mmap.tlh(500) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tli(180) : error C2143: syntax error : missing ';' before 'tag::id'
c:\mmap-nov-16\radar\debug\mmap.tli(180) : error C2433: 'PicturePtr' : 'inline' not permitted on data declarations
c:\mmap-nov-16\radar\debug\mmap.tli(180) : error C2501: 'PicturePtr' : missing storage-class or type specifiers
c:\mmap-nov-16\radar\debug\mmap.tli(180) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\Radar.sbr': No such file or directory
Error executing bscmake.exe.
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
there is nothing wrong with the mmap.ocx file.
i have been able to #import the file and build it without errors.
note: i am NOT using precompiled headers.
however, it appears that the file is licensed, and so i get a
run-time error 'Class is not licensed for use' when i try to instantiate it.
i suppose that you have the license key with you, and you would be
able to instantiate it.
i have been able to #import the file and build it without errors.
note: i am NOT using precompiled headers.
however, it appears that the file is licensed, and so i get a
run-time error 'Class is not licensed for use' when i try to instantiate it.
i suppose that you have the license key with you, and you would be
able to instantiate it.
c++ Syntax (Toggle Plain Text)
#include <iostream> #include <windows.h> #import "C:\\cygwin\\home\\projects\\ocx_read\\mmap_read\\MMap.ocx" \ no_namespace no_smart_pointers raw_native_types named_guids int main() { CoInitialize(0) ; { _DMMap* pmmap = 0 ; HRESULT hr = CoCreateInstance( CLSID_MMap, 0, CLSCTX_ALL, DIID__DMMap, reinterpret_cast<void**>(&pmmap) ) ; if( SUCCEEDED(hr) ) { std::cout << "succeeded in creating an instance " "of mmap\n" ; pmmap->Release() ; } else { char strerror[128] ; FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM, 0, hr, 0, strerror, sizeof(strerror), 0 ) ; std::cout << "error: " << strerror ; } } CoUninitialize() ; } /*** output: error: Class is not licensed for use */
Last edited by vijayan121; Dec 3rd, 2007 at 2:08 pm.
•
•
Join Date: Nov 2007
Posts: 22
Reputation:
Solved Threads: 0
Hi Vijayan,
I got licensed version of the file and able to compile it successfuly. While executing it, program is quitting with "Abnormal program termination". I debugged it and it's terminating at the ollowing line/function call. Program entered into the function definition in .tlh header file and then terminated immediately.
pMP->GetMapID();
If I don't call above function in the code, it's working fine without doing anything. Also, if I keep alone pMP ->Release(); function call at the end, it's still working fine without doing anything.
Am I missing something in above function call? Or do I need to call the function differently?
Thanks a lot for ur help,
Regards,
Swetha
I got licensed version of the file and able to compile it successfuly. While executing it, program is quitting with "Abnormal program termination". I debugged it and it's terminating at the ollowing line/function call. Program entered into the function definition in .tlh header file and then terminated immediately.
pMP->GetMapID();
If I don't call above function in the code, it's working fine without doing anything. Also, if I keep alone pMP ->Release(); function call at the end, it's still working fine without doing anything.
Am I missing something in above function call? Or do I need to call the function differently?
Thanks a lot for ur help,
Regards,
Swetha
![]() |
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






