📄 mycomponentimpl1.h
字号:
//$$---- activex control header ---- (stActiveXControlHeader)
//---------------------------------------------------------------------------
#ifndef MyComponentImpl1H
#define MyComponentImpl1H
//---------------------------------------------------------------------------
#include "MyControl_TLB.h"
#include "MyComponent.h"
#include "Unit1.h"
class ATL_NO_VTABLE TMyComponentXImpl:
VCLCONTROL_IMPL(TMyComponentXImpl, MyComponentX, TMyComponent, IMyComponentX, DIID_IMyComponentXEvents)
{
void __fastcall ClickEvent(TObject *Sender);
void __fastcall CountChangedEvent(TObject *Sender, int &Count);
public:
void InitializeControl()
{
m_VclCtl->OnClick = ClickEvent;
m_VclCtl->OnCountChanged = CountChangedEvent;
}
// The COM MAP entries declares the interfaces your object exposes (through
// QueryInterface). CComRootObjectEx::InternalQueryInterface only returns
// pointers for interfaces in the COM map. VCL controls exposed as OCXes
// have a minimum set of interfaces defined by the
// VCL_CONTROL_COM_INTERFACE_ENTRIES macro. Add other interfaces supported
// by your object with additional COM_INTERFACE_ENTRY[_xxx] macros.
//
BEGIN_COM_MAP(TMyComponentXImpl)
VCL_CONTROL_COM_INTERFACE_ENTRIES(IMyComponentX)
END_COM_MAP()
//$$---- activex control license support (stActiveXControlLicensing)
// Licensing support
//
typedef TLicenseString<TMyComponentXImpl> TLicenseClassImpl;
DECLARE_CLASSFACTORY2(TLicenseClassImpl)
// Add logic to determine whether this Control is properly licensed on this machine
// in the following method..
//
static const WCHAR* GetLicenseString()
{
return L"{F41DB251-D9A0-48E6-A40E-5F05918910CF}";
}
static const TCHAR* GetLicenseFileName()
{
return _T("MyControl.lic");
}
static BOOL IsLicenseValid()
{
// By default we validate the license by verifying that the
// license string GUID is in the .LIC file generated by the Wizard.
//
// You may replace the logic of this routine to implement another
// method to verify that your control is properly licensed.
//
return TValidateLicense::IsGUIDInFile(GetLicenseString(), GetLicenseFileName());
}
// The PROPERTY map stores property descriptions, property DISPIDs,
// property page CLSIDs and IDispatch IIDs. You may use use
// IPerPropertyBrowsingImpl, IPersistPropertyBagImpl, IPersistStreamInitImpl,
// and ISpecifyPropertyPageImpl to utilize the information in you property
// map.
//
// NOTE: The BCB Wizard does *NOT* maintain your PROPERTY_MAP table. You must
// add or remove entries manually.
//
BEGIN_PROPERTY_MAP(TMyComponentXImpl)
// PROP_PAGE(CLSID_MyComponentXPage)
PROP_PAGE(CLSID_PropertyPage1)
END_PROPERTY_MAP()
/* DECLARE_VCL_CONTROL_PERSISTENCE(CppClass, VclClass) is needed for VCL
* controls to persist via the VCL streaming mechanism and not the ATL mechanism.
* The macro adds static IPersistStreamInit_Load and IPersistStreamInit_Save
* methods to your implementation class, overriding the methods in IPersistStreamImpl.
* This macro must be manually undefined or removed if you port to C++Builder 4.0. */
DECLARE_VCL_CONTROL_PERSISTENCE(TMyComponentXImpl, TMyComponent);
// The DECLARE_ACTIVEXCONTROL_REGISTRY macro declares a static 'UpdateRegistry'
// routine which registers the basic information about your control. The
// parameters expected by the macro are the ProgId & the ToolboxBitmap ID of
// your control.
//
DECLARE_ACTIVEXCONTROL_REGISTRY("MyControl.MyComponentX", 1);
protected:
STDMETHOD(AboutBox());
STDMETHOD(DrawTextBiDiModeFlagsReadingOnly(long* Value));
STDMETHOD(get_BevelInner(TxBevelCut* Value));
STDMETHOD(get_BevelKind(TxBevelKind* Value));
STDMETHOD(get_BevelOuter(TxBevelCut* Value));
STDMETHOD(get_BevelWidth(long* Value));
STDMETHOD(get_Count(long* Value));
STDMETHOD(get_Cursor(short* Value));
STDMETHOD(get_DoubleBuffered(TOLEBOOL* Value));
STDMETHOD(get_Enabled(TOLEBOOL* Value));
STDMETHOD(get_Visible(TOLEBOOL* Value));
STDMETHOD(get_VisibleDockClientCount(long* Value));
STDMETHOD(InitiateAction());
STDMETHOD(IsRightToLeft(TOLEBOOL* Value));
STDMETHOD(set_BevelInner(TxBevelCut Value));
STDMETHOD(set_BevelKind(TxBevelKind Value));
STDMETHOD(set_BevelOuter(TxBevelCut Value));
STDMETHOD(set_BevelWidth(long Value));
STDMETHOD(set_Count(long Value));
STDMETHOD(set_Cursor(short Value));
STDMETHOD(set_DoubleBuffered(TOLEBOOL Value));
STDMETHOD(set_Enabled(TOLEBOOL Value));
STDMETHOD(set_Visible(TOLEBOOL Value));
STDMETHOD(UseRightToLeftReading(TOLEBOOL* Value));
STDMETHOD(UseRightToLeftScrollBar(TOLEBOOL* Value));
};
//---------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -