|
-
August 21st, 2007, 03:32 AM
#1
[RESOLVED] Problem using ActiveX control in C++
Hi, i am trying to use a third party ActiveX control in my C++ code. I do not know if the control can also be used from C++ since there was only a Visual Basic example with it.
In the stdafx.h i added the following lines:
Code:
#import <StrainBUSterNet.ocx> rename_namespace("StrainBUSterNetNameSpace")
using namespace StrainBUSterNetNameSpace;
The compiler gives some errors because it does not recognize some type declarations:
Code:
c:\local projects\uitest\debug\strainbusternet.tlh(208) : error C2146: syntax error : missing ';' before identifier 'Font'
c:\local projects\uitest\debug\strainbusternet.tlh(208) : error C2501: 'FontPtr' : missing storage-class or type specifiers
c:\local projects\uitest\debug\strainbusternet.tlh(208) : error C2501: 'Font' : missing storage-class or type specifiers
c:\local projects\uitest\debug\strainbusternet.tlh(628) : error C2146: syntax error : missing ';' before identifier 'GetFont'
c:\local projects\uitest\debug\strainbusternet.tlh(628) : error C2501: 'FontPtr' : missing storage-class or type specifiers
c:\local projects\uitest\debug\strainbusternet.tli(591) : error C2143: syntax error : missing ';' before 'tag::id'
c:\local projects\uitest\debug\strainbusternet.tli(591) : error C2433: 'FontPtr' : 'inline' not permitted on data declarations
c:\local projects\uitest\debug\strainbusternet.tli(591) : error C2501: 'FontPtr' : missing storage-class or type specifiers
c:\local projects\uitest\debug\strainbusternet.tli(591) : fatal error C1004: unexpected end of file found
Is there a way to prevent these errors?
For example the first error about Font refers to this definition in the .tlh file generated by the compiler:
Code:
struct __declspec(uuid("75d210d3-8272-11d5-b562-00a024338af6"))
_DStrainbusterNet : IDispatch
{
//
// Property data
//
...
FontPtr Font;
...
};
Some help is appreciated.
Time is fun when you're having flies 
-
August 21st, 2007, 03:53 AM
#2
Re: Problem using ActiveX control in C++
The 'FontPtr' class definition is missing. Usually the active X controls package definitions of the classes used with the package itself; I do not know what happened in this case. You will need to find the definition of FontPtr; I am guessing that it is some sort of typedef to a pointer to a class. May be it is one of the stardard VS defined classes related to Fonts.
Say no to supplying ready made code for homework/work assignments!!
Please rate this post!
-
August 21st, 2007, 04:27 AM
#3
Re: Problem using ActiveX control in C++
I found a bug article in the MSDN. http://support.microsoft.com/kb/224610
The following change prevents errors to occur
Code:
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#import "c:\\windows\\system32\\stdole2.tlb" rename_namespace("StrainBUSterNetNameSpace")
#import <StrainBUSterNet.ocx> rename_namespace("StrainBUSterNetNameSpace")
using namespace StrainBUSterNetNameSpace;
It is important to put the import statements after the MFC includes otherwise the compiler complaints about Windows.h already being included.
Time is fun when you're having flies 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|