Hello,
I do have a strange behavior in my application that I do not understand.
My configuration: VS2010, Win7
In my VS solution I have a project "TextControl" which contains of 4 basic wrapper classes for different ActiveX Controls. The wrappers were created automatically by VS.
In addition there is one main wrapper class that bundles the other 4.
Here is a part of the main wrapper's code (TextControl.h):
#include <stdafx.h>
#include <HTString.h>
#include <CDTX4OLE.h> //TX Text Control
#include <CDTXBBAR.h> //TX Text Control Button Bar
#include <CDTXSBAR.h> //TX Text Control Status Bar
#include <CDTXRULER.h> //TX text Control Ruler
class TextControl : public CWnd
{
public:
TextControl();
~TextControl();
BOOL Init(CWnd* parent, const CRect& tcRect, DWORD tcOpt = WS_VISIBLE | WS_TABSTOP);
HTString GetText();
void SetText(HTString text);
protected:
CDTX4OLE m_txCtrl; CDTXBBAR m_txBBar; CDTXSBAR m_txSBar; CDTXRULER m_txRuler;
private:
};
So the main wrapper owns an interface to each of the 4 wrappers. The project compiles w/o any error. But when I compile another project that makes use of "TextControl" then I receive the error C2146 in combination with C4430
The error occurs in above code in the following line:
CDTXBBAR m_txBBar;
and tells me that CDTXBBAR is not defined. I do not know why since the project that defines the TextControl compiles w/o any error.
If I comment this line there is no error at all - neither in the TextControl project nor in the one that uses the TextControl. This lets me think that there is something wrong with CDTXBBAR but can't figure it out.
Here is the content of CDTXBAR.h and .cpp
#pragma once
class CDTXBBAR : public CWnd
{
protected:
DECLARE_DYNCREATE(CDTXBBAR)
public:
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0xA8EF909, 0x46E5, 0x11E3, { 0xA5, 0x45, 0x0, 0x13, 0xD3, 0x50, 0x66, 0x7C } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID);
}
BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey);
}
public:
public:
unsigned long get_DisplayColor(long index)
{
unsigned long result;
static BYTE parms[] = VTS_I4 ;
InvokeHelper(0x1b, DISPATCH_PROPERTYGET, VT_UI4, (void*)&result, parms, index);
return result;
}
void put_DisplayColor(long index, unsigned long newValue)
{
static BYTE parms[] = VTS_I4 VTS_UI4 ;
InvokeHelper(0x1b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, index, newValue);
}
void AboutBox()
{
InvokeHelper(DISPID_ABOUTBOX, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
};
#include "stdafx.h"
#include "CDTXBBAR.h"
IMPLEMENT_DYNCREATE(CDTXBBAR, CWnd)
I already compared the other automatically generated wrappers with this one, but there is no difference.