 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jerry Lu Guest
|
Posted: Fri Oct 17, 2003 5:56 am Post subject: Help me to make my OCX control safety for Internet. |
|
|
Hi, all,
I made an ActiveX control, compress it into a cab file, adn signed it with
my certificate, but when I deploy it on my webpage, the explore always
prompts me that that active control is not safe.
Can any body help me?
Jerry Lu
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Oct 17, 2003 6:28 am Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
"Jerry Lu" <lucb (AT) northsec (DOT) com.cn> wrote
| Quote: | I made an ActiveX control, compress it into a cab file, adn
signed it with my certificate, but when I deploy it on my
webpage, the explore always prompts me that that active
control is not safe.
|
Your ActiveX object needs to either set up certain Registry settings for
script safety, or else implement the IObjectSafety interface instead. Have
a look at the following article for more information:
Signing and Marking ActiveX Controls
http://msdn.microsoft.com/library/en-us/dnaxctrl/html/msdn_signmark.asp
IObjectSafetyImpl Class
http://msdn.microsoft.com/library/en-us/vclib/html/_atl_iobjectsafetyimpl.asp
Gambit
|
|
| Back to top |
|
 |
Jerry Lu Guest
|
Posted: Tue Oct 21, 2003 8:43 am Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
Can you give me a demo? Thanks.
"Remy Lebeau (TeamB)" <gambit47.no.spam (AT) no (DOT) spam.yahoo.com> 写入消息新闻
:3f8f8b99$1 (AT) newsgroups (DOT) borland.com...
p
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Oct 21, 2003 5:24 pm Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
"Jerry Lu" <lucb (AT) northsec (DOT) com.cn> wrote
| Quote: | Can you give me a demo? Thanks.
|
Did you read the articles I directed you to? They tell you everything you
need to know. Either update your OCX's Impl class to set up the specified
Registry values for object safety, or else add IObjectSafetyImpl to the list
of ancestor classes that your Impl class derives from (or do both).
If you are using BCB5 or 6, then you can use the ATL's native support for
Component Categories in order to set up the Registry, fFor example:
#include <objsafe.h>
class TMyOCXImpl :
//...
public IObjectSafetyImpl<TMyOCXImpl,
INTERFACESAFE_FOR_UNTRUSTED_CALLER>
{
//...
public:
//...
BEGIN_COM_MAP(TMyOCXImpl)
COM_INTERFACE_ENTRY_IMPL(IObjectSafety)
END_COM_MAP()
BEGIN_CATEGORY_MAP(TMyOCXImpl)
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
END_CATEGORY_MAP()
};
Otherwise, if you are using a version of BCB prior to 5, then you will have
to change the Impl classe's UpdateRegistry() method to add/remove the
necessary Registry values manually.
Gambit
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Oct 23, 2003 8:33 am Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
"Jerry Lu" <lcbdl (AT) sohu (DOT) com> wrote
| Quote: | Error message is: [C++ Error] TestImpl.h(1: E2246
IObjectSafetyImpl<TTest,1> is not abstract public
single inheritance class hierarchy with no data
|
You never said anything about using TActiveForm. That changes everything,
as you can't use Multiple Inheritance with VCL objects except for abstract
interfaces, which IObjectSafetyImpl is not. I thought you were implementing
an actual interface declared in a TypeLibrary instead. You need to put
IObjectSatefyImpl into your TTestImpl class, not the TTest form. Make sure
that you are also updating the BEGIN_COM_MAP and BEGIN_CATEGORY_MAP
sections, as I showed earlier.
Gambit
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Oct 23, 2003 5:23 pm Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
"Jerry Lu" <lcbdl (AT) sohu (DOT) com> wrote
| Quote: | How to put IObjectSatefyImpl into your TTestImpl class
|
I already showed you earlier how to do that. Just replace "TMyOCXImpl" in
my example code with "TTestImpl" in your actual code.
Gambit
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Oct 24, 2003 1:46 am Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
"Jerry Lu" <lcbdl (AT) sohu (DOT) com> wrote
| Quote: | line 66 COM_INTERFACE_ENTRY_IMPL(IObjectSafety)
|
Change that line to this then:
COM_INTERFACE_ENTRY(IObjectSafety)
| Quote: | IObjectSafetyImpl
INTERFACESAFE_FOR_UNTRUSTED_DATA
|
Since you are specifying INTERFACESAFE_FOR_UNTRUSTED_DATA, you should add an
entry for CATID_SafeForInitializing to the category map as well.
Gambit
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Oct 24, 2003 2:36 am Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
"Jerry Lu" <lcbdl (AT) sohu (DOT) com> wrote
| Quote: | [C++ Error] TestImpl.h(66): E2031 Cannot cast from
'TTestImpl *' to 'IObjectSafety *'
|
I do not know what else to tell you at this point. It should be working by
now. By deriving from IObjectSafetyImpl, TTestImpl most certainly is, and
can be cast to, IObjectSafety, because IObjectSafetyImpl is derived from
IObjectSafety, so TTestImpl is as well.
Gambit
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Oct 24, 2003 4:43 am Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
"Jerry Lu" <lcbdl (AT) sohu (DOT) com> wrote
| Quote: | Can you give me a integrated BCB project, which
is a project for Internet-safe ActiveX control.
|
I've already explained and showed you everything I know about the subject,
sorry. Using IObjectSafety and/or the Category Map (or modify the Registry
manually) are the only ways to set up the safety system correctly.
Gambit
|
|
| Back to top |
|
 |
Jerry Lu Guest
|
Posted: Fri Oct 24, 2003 8:20 am Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
This is TestImpl.h file
There is an error appear when I compile it, I don't know how to solve it.
Error message is: [C++ Error] TestImpl.h(1: E2246 IObjectSafetyImpl<TTest,1>
is not abstract public single inheritance class hierarchy with no data
//$$---- Active Form HDR ---- (stActiveFormHdr)
//--------------------------------------------------------------------------
-
#ifndef TestImplH
#define TestImplH
//--------------------------------------------------------------------------
-
#include <classes.hpp>
#include <controls.hpp>
#include <stdCtrls.hpp>
#include <forms.hpp>
#include <objsafe.h>
#include "TestProj_TLB.h"
#include <AxCtrls.hpp>
//--------------------------------------------------------------------------
-
class TTest : public TActiveForm, IObjectSafetyImpl <TTest,
INTERFACESAFE_FOR_UNTRUSTED_CALLER>
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TTest(HWND ParentWindow);
__fastcall TTest(TComponent* AOwner): TActiveForm(AOwner) {};
};
//--------------------------------------------------------------------------
-
extern PACKAGE TTest *Test;
//--------------------------------------------------------------------------
-
//--------------------------------------------------------------------------
-
class ATL_NO_VTABLE TTestImpl:
VCLCONTROL_IMPL(TTestImpl, Test, TTest, ITest, DIID_ITestEvents)
{
void __fastcall ActivateEvent(TObject *Sender);
void __fastcall ClickEvent(TObject *Sender);
void __fastcall CreateEvent(TObject *Sender);
void __fastcall DblClickEvent(TObject *Sender);
void __fastcall DeactivateEvent(TObject *Sender);
void __fastcall DestroyEvent(TObject *Sender);
void __fastcall KeyPressEvent(TObject *Sender, char &Key);
void __fastcall PaintEvent(TObject *Sender);
public:
void InitializeControl()
{
m_VclCtl->OnActivate = ActivateEvent;
m_VclCtl->OnClick = ClickEvent;
m_VclCtl->OnCreate = CreateEvent;
m_VclCtl->OnDblClick = DblClickEvent;
m_VclCtl->OnDeactivate = DeactivateEvent;
m_VclCtl->OnDestroy = DestroyEvent;
m_VclCtl->OnKeyPress = KeyPressEvent;
m_VclCtl->OnPaint = PaintEvent;
}
// 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(TTestImpl)
VCL_CONTROL_COM_INTERFACE_ENTRIES(ITest)
END_COM_MAP()
//$$---- activex control license support (stActiveXControlLicensing)
// Licensing support
//
typedef TLicenseString<TTestImpl> 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"{C9A8AEB8-AE86-412B-B654-54C25255ED20}";
}
static const TCHAR* GetLicenseFileName()
{
return _T("TestProj.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(TTestImpl)
// PROP_PAGE(CLSID_TestPage)
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(TTestImpl, TTest);
// 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("TestProj.Test", 1);
protected:
STDMETHOD(_set_Font(IFontDisp** Value));
STDMETHOD(get_Active(VARIANT_BOOL* Value));
STDMETHOD(get_AlignDisabled(VARIANT_BOOL* Value));
STDMETHOD(get_AutoScroll(VARIANT_BOOL* Value));
STDMETHOD(get_AutoSize(VARIANT_BOOL* Value));
STDMETHOD(get_AxBorderStyle(TxActiveFormBorderStyle* Value));
STDMETHOD(get_BorderWidth(long* Value));
STDMETHOD(get_Caption(BSTR* Value));
STDMETHOD(get_Color(::OLE_COLOR* Value));
STDMETHOD(get_DoubleBuffered(VARIANT_BOOL* Value));
STDMETHOD(get_DropTarget(VARIANT_BOOL* Value));
STDMETHOD(get_Enabled(VARIANT_BOOL* Value));
STDMETHOD(get_Font(IFontDisp** Value));
STDMETHOD(get_HelpFile(BSTR* Value));
STDMETHOD(get_KeyPreview(VARIANT_BOOL* Value));
STDMETHOD(get_PixelsPerInch(long* Value));
STDMETHOD(get_PrintScale(TxPrintScale* Value));
STDMETHOD(get_Scaled(VARIANT_BOOL* Value));
STDMETHOD(get_Visible(VARIANT_BOOL* Value));
STDMETHOD(get_VisibleDockClientCount(long* Value));
STDMETHOD(set_AutoScroll(VARIANT_BOOL Value));
STDMETHOD(set_AutoSize(VARIANT_BOOL Value));
STDMETHOD(set_AxBorderStyle(TxActiveFormBorderStyle Value));
STDMETHOD(set_BorderWidth(long Value));
STDMETHOD(set_Caption(BSTR Value));
STDMETHOD(set_Color(::OLE_COLOR Value));
STDMETHOD(set_DoubleBuffered(VARIANT_BOOL Value));
STDMETHOD(set_DropTarget(VARIANT_BOOL Value));
STDMETHOD(set_Enabled(VARIANT_BOOL Value));
STDMETHOD(set_Font(IFontDisp* Value));
STDMETHOD(set_HelpFile(BSTR Value));
STDMETHOD(set_KeyPreview(VARIANT_BOOL Value));
STDMETHOD(set_PixelsPerInch(long Value));
STDMETHOD(set_PrintScale(TxPrintScale Value));
STDMETHOD(set_Scaled(VARIANT_BOOL Value));
STDMETHOD(set_Visible(VARIANT_BOOL Value));
};
//--------------------------------------------------------------------------
-
#endif
|
|
| Back to top |
|
 |
Jerry Lu Guest
|
Posted: Fri Oct 24, 2003 10:10 am Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
How to put IObjectSatefyImpl into your TTestImpl class
"Remy Lebeau (TeamB)" <gambit47.no.spam (AT) no (DOT) spam.yahoo.com> 写入消息新闻
:3f9791a3$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Jerry Lu" <lcbdl (AT) sohu (DOT) com> wrote in message
news:3f978f0f (AT) newsgroups (DOT) borland.com...
Error message is: [C++ Error] TestImpl.h(1: E2246
IObjectSafetyImpl<TTest,1> is not abstract public
single inheritance class hierarchy with no data
You never said anything about using TActiveForm. That changes everything,
as you can't use Multiple Inheritance with VCL objects except for abstract
interfaces, which IObjectSafetyImpl is not. I thought you were
implementing
an actual interface declared in a TypeLibrary instead. You need to put
IObjectSatefyImpl into your TTestImpl class, not the TTest form. Make
sure
that you are also updating the BEGIN_COM_MAP and BEGIN_CATEGORY_MAP
sections, as I showed earlier.
Gambit
|
|
|
| Back to top |
|
 |
Jerry Lu Guest
|
Posted: Sat Oct 25, 2003 1:01 am Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
I tried, but failed. This is my code in TestImpl.h and error message:
[C++ Error] TestImpl.h(66): E2394 Too few arguments passed to template
'IObjectSafetyImpl<T,dwSupportedSafety>'
[C++ Error] TestImpl.h(66): E2303 Type name expected
[C++ Error] TestImpl.h(66): E2141 Declaration syntax error
[C++ Error] TestImpl.h(66): E2139 Declaration missing ;
line 64 BEGIN_COM_MAP(TTestImpl)
line 65 VCL_CONTROL_COM_INTERFACE_ENTRIES(ITest)
line 66 COM_INTERFACE_ENTRY_IMPL(IObjectSafety)
line 67 END_COM_MAP()
//$$---- Active Form HDR ---- (stActiveFormHdr)
//--------------------------------------------------------------------------
-
#ifndef TestImplH
#define TestImplH
//--------------------------------------------------------------------------
-
#include <classes.hpp>
#include <controls.hpp>
#include <stdCtrls.hpp>
#include <forms.hpp>
#include <objsafe.h>
#include "TestProj_TLB.h"
#include <AxCtrls.hpp>
//--------------------------------------------------------------------------
-
class TTest : public TActiveForm
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TTest(HWND ParentWindow);
__fastcall TTest(TComponent* AOwner): TActiveForm(AOwner) {};
};
//--------------------------------------------------------------------------
-
extern PACKAGE TTest *Test;
//--------------------------------------------------------------------------
-
//--------------------------------------------------------------------------
-
class ATL_NO_VTABLE TTestImpl:
VCLCONTROL_IMPL(TTestImpl, Test, TTest, ITest, DIID_ITestEvents),
IObjectSafetyImpl<TTestImpl, INTERFACESAFE_FOR_UNTRUSTED_CALLER |
INTERFACESAFE_FOR_UNTRUSTED_DATA>
{
void __fastcall ActivateEvent(TObject *Sender);
void __fastcall ClickEvent(TObject *Sender);
void __fastcall CreateEvent(TObject *Sender);
void __fastcall DblClickEvent(TObject *Sender);
void __fastcall DeactivateEvent(TObject *Sender);
void __fastcall DestroyEvent(TObject *Sender);
void __fastcall KeyPressEvent(TObject *Sender, char &Key);
void __fastcall PaintEvent(TObject *Sender);
public:
void InitializeControl()
{
m_VclCtl->OnActivate = ActivateEvent;
m_VclCtl->OnClick = ClickEvent;
m_VclCtl->OnCreate = CreateEvent;
m_VclCtl->OnDblClick = DblClickEvent;
m_VclCtl->OnDeactivate = DeactivateEvent;
m_VclCtl->OnDestroy = DestroyEvent;
m_VclCtl->OnKeyPress = KeyPressEvent;
m_VclCtl->OnPaint = PaintEvent;
}
// 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(TTestImpl)
VCL_CONTROL_COM_INTERFACE_ENTRIES(ITest)
COM_INTERFACE_ENTRY_IMPL(IObjectSafety)
END_COM_MAP()
BEGIN_CATEGORY_MAP(TTestImpl)
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
END_CATEGORY_MAP()
//$$---- activex control license support (stActiveXControlLicensing)
// Licensing support
//
typedef TLicenseString<TTestImpl> 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"{C9A8AEB8-AE86-412B-B654-54C25255ED20}";
}
static const TCHAR* GetLicenseFileName()
{
return _T("TestProj.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(TTestImpl)
// PROP_PAGE(CLSID_TestPage)
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(TTestImpl, TTest);
// 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("TestProj.Test", 1);
protected:
STDMETHOD(_set_Font(IFontDisp** Value));
STDMETHOD(get_Active(VARIANT_BOOL* Value));
STDMETHOD(get_AlignDisabled(VARIANT_BOOL* Value));
STDMETHOD(get_AutoScroll(VARIANT_BOOL* Value));
STDMETHOD(get_AutoSize(VARIANT_BOOL* Value));
STDMETHOD(get_AxBorderStyle(TxActiveFormBorderStyle* Value));
STDMETHOD(get_BorderWidth(long* Value));
STDMETHOD(get_Caption(BSTR* Value));
STDMETHOD(get_Color(::OLE_COLOR* Value));
STDMETHOD(get_DoubleBuffered(VARIANT_BOOL* Value));
STDMETHOD(get_DropTarget(VARIANT_BOOL* Value));
STDMETHOD(get_Enabled(VARIANT_BOOL* Value));
STDMETHOD(get_Font(IFontDisp** Value));
STDMETHOD(get_HelpFile(BSTR* Value));
STDMETHOD(get_KeyPreview(VARIANT_BOOL* Value));
STDMETHOD(get_PixelsPerInch(long* Value));
STDMETHOD(get_PrintScale(TxPrintScale* Value));
STDMETHOD(get_Scaled(VARIANT_BOOL* Value));
STDMETHOD(get_Visible(VARIANT_BOOL* Value));
STDMETHOD(get_VisibleDockClientCount(long* Value));
STDMETHOD(set_AutoScroll(VARIANT_BOOL Value));
STDMETHOD(set_AutoSize(VARIANT_BOOL Value));
STDMETHOD(set_AxBorderStyle(TxActiveFormBorderStyle Value));
STDMETHOD(set_BorderWidth(long Value));
STDMETHOD(set_Caption(BSTR Value));
STDMETHOD(set_Color(::OLE_COLOR Value));
STDMETHOD(set_DoubleBuffered(VARIANT_BOOL Value));
STDMETHOD(set_DropTarget(VARIANT_BOOL Value));
STDMETHOD(set_Enabled(VARIANT_BOOL Value));
STDMETHOD(set_Font(IFontDisp* Value));
STDMETHOD(set_HelpFile(BSTR Value));
STDMETHOD(set_KeyPreview(VARIANT_BOOL Value));
STDMETHOD(set_PixelsPerInch(long Value));
STDMETHOD(set_PrintScale(TxPrintScale Value));
STDMETHOD(set_Scaled(VARIANT_BOOL Value));
STDMETHOD(set_Visible(VARIANT_BOOL Value));
};
//--------------------------------------------------------------------------
-
#endif
|
|
| Back to top |
|
 |
Jerry Lu Guest
|
Posted: Sat Oct 25, 2003 2:19 am Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
There are errors below:
[C++ Error] TestImpl.h(66): E2031 Cannot cast from 'TTestImpl *' to
'IObjectSafety *'
[C++ Error] TestImpl.h(66): E2293 ) expected
[C++ Error] TestImpl.h(66): E2139 Declaration missing ;
//$$---- Active Form HDR ---- (stActiveFormHdr)
//--------------------------------------------------------------------------
-
#ifndef TestImplH
#define TestImplH
//--------------------------------------------------------------------------
-
#include <classes.hpp>
#include <controls.hpp>
#include <stdCtrls.hpp>
#include <forms.hpp>
#include <objsafe.h>
#include "TestProj_TLB.h"
#include <AxCtrls.hpp>
//--------------------------------------------------------------------------
-
class TTest : public TActiveForm
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TTest(HWND ParentWindow);
__fastcall TTest(TComponent* AOwner): TActiveForm(AOwner) {};
};
//--------------------------------------------------------------------------
-
extern PACKAGE TTest *Test;
//--------------------------------------------------------------------------
-
//--------------------------------------------------------------------------
-
class ATL_NO_VTABLE TTestImpl:
VCLCONTROL_IMPL(TTestImpl, Test, TTest, ITest, DIID_ITestEvents),
IObjectSafetyImpl<TTestImpl, INTERFACESAFE_FOR_UNTRUSTED_CALLER |
INTERFACESAFE_FOR_UNTRUSTED_DATA>
{
void __fastcall ActivateEvent(TObject *Sender);
void __fastcall ClickEvent(TObject *Sender);
void __fastcall CreateEvent(TObject *Sender);
void __fastcall DblClickEvent(TObject *Sender);
void __fastcall DeactivateEvent(TObject *Sender);
void __fastcall DestroyEvent(TObject *Sender);
void __fastcall KeyPressEvent(TObject *Sender, char &Key);
void __fastcall PaintEvent(TObject *Sender);
public:
void InitializeControl()
{
m_VclCtl->OnActivate = ActivateEvent;
m_VclCtl->OnClick = ClickEvent;
m_VclCtl->OnCreate = CreateEvent;
m_VclCtl->OnDblClick = DblClickEvent;
m_VclCtl->OnDeactivate = DeactivateEvent;
m_VclCtl->OnDestroy = DestroyEvent;
m_VclCtl->OnKeyPress = KeyPressEvent;
m_VclCtl->OnPaint = PaintEvent;
}
// 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(TTestImpl)
VCL_CONTROL_COM_INTERFACE_ENTRIES(ITest)
COM_INTERFACE_ENTRY(IObjectSafety)
END_COM_MAP()
BEGIN_CATEGORY_MAP(TTestImpl)
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
IMPLEMENTED_CATEGORY(CATID_SafeForInitializing)
END_CATEGORY_MAP()
//$$---- activex control license support (stActiveXControlLicensing)
// Licensing support
//
typedef TLicenseString<TTestImpl> 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"{C9A8AEB8-AE86-412B-B654-54C25255ED20}";
}
static const TCHAR* GetLicenseFileName()
{
return _T("TestProj.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(TTestImpl)
// PROP_PAGE(CLSID_TestPage)
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(TTestImpl, TTest);
// 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("TestProj.Test", 1);
protected:
STDMETHOD(_set_Font(IFontDisp** Value));
STDMETHOD(get_Active(VARIANT_BOOL* Value));
STDMETHOD(get_AlignDisabled(VARIANT_BOOL* Value));
STDMETHOD(get_AutoScroll(VARIANT_BOOL* Value));
STDMETHOD(get_AutoSize(VARIANT_BOOL* Value));
STDMETHOD(get_AxBorderStyle(TxActiveFormBorderStyle* Value));
STDMETHOD(get_BorderWidth(long* Value));
STDMETHOD(get_Caption(BSTR* Value));
STDMETHOD(get_Color(::OLE_COLOR* Value));
STDMETHOD(get_DoubleBuffered(VARIANT_BOOL* Value));
STDMETHOD(get_DropTarget(VARIANT_BOOL* Value));
STDMETHOD(get_Enabled(VARIANT_BOOL* Value));
STDMETHOD(get_Font(IFontDisp** Value));
STDMETHOD(get_HelpFile(BSTR* Value));
STDMETHOD(get_KeyPreview(VARIANT_BOOL* Value));
STDMETHOD(get_PixelsPerInch(long* Value));
STDMETHOD(get_PrintScale(TxPrintScale* Value));
STDMETHOD(get_Scaled(VARIANT_BOOL* Value));
STDMETHOD(get_Visible(VARIANT_BOOL* Value));
STDMETHOD(get_VisibleDockClientCount(long* Value));
STDMETHOD(set_AutoScroll(VARIANT_BOOL Value));
STDMETHOD(set_AutoSize(VARIANT_BOOL Value));
STDMETHOD(set_AxBorderStyle(TxActiveFormBorderStyle Value));
STDMETHOD(set_BorderWidth(long Value));
STDMETHOD(set_Caption(BSTR Value));
STDMETHOD(set_Color(::OLE_COLOR Value));
STDMETHOD(set_DoubleBuffered(VARIANT_BOOL Value));
STDMETHOD(set_DropTarget(VARIANT_BOOL Value));
STDMETHOD(set_Enabled(VARIANT_BOOL Value));
STDMETHOD(set_Font(IFontDisp* Value));
STDMETHOD(set_HelpFile(BSTR Value));
STDMETHOD(set_KeyPreview(VARIANT_BOOL Value));
STDMETHOD(set_PixelsPerInch(long Value));
STDMETHOD(set_PrintScale(TxPrintScale Value));
STDMETHOD(set_Scaled(VARIANT_BOOL Value));
STDMETHOD(set_Visible(VARIANT_BOOL Value));
};
//--------------------------------------------------------------------------
-
#endif
|
|
| Back to top |
|
 |
Jerry Lu Guest
|
Posted: Sat Oct 25, 2003 2:52 am Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
Thanks a lot for your help, I am not very familiar with BCB, but I have to
make this ActiveX control. Please help me if you will.
Can you give me a integrated BCB project, which is a project for
Internet-safe ActiveX control.
Thanks again.
|
|
| Back to top |
|
 |
Jerry Lu Guest
|
Posted: Sat Oct 25, 2003 11:00 am Post subject: Re: Help me to make my OCX control safety for Internet. |
|
|
I solved all errors, the program is listed below, but after I signed and
deploied it to my website, that no-safe message still appear. Is there any
mistake in my program?
//$$---- Active Form HDR ---- (stActiveFormHdr)
//--------------------------------------------------------------------------
-
#ifndef SysInfoImpl1H
#define SysInfoImpl1H
//--------------------------------------------------------------------------
-
#include <classes.hpp>
#include <controls.hpp>
#include <stdCtrls.hpp>
#include <forms.hpp>
#include "SysInfoCtl_TLB.h"
#include <AxCtrls.hpp>
#include <stdio.h>
#include <nb30.h>
#include "DiskPhyID.h"
#include <objsafe.h>
//--------------------------------------------------------------------------
-
class TSysInfo : public TActiveForm
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TSysInfo(HWND ParentWindow);
__fastcall TSysInfo(TComponent* AOwner): TActiveForm(AOwner) {};
};
//--------------------------------------------------------------------------
-
extern PACKAGE TSysInfo *SysInfo;
//--------------------------------------------------------------------------
-
//--------------------------------------------------------------------------
-
class ATL_NO_VTABLE TSysInfoImpl:
VCLCONTROL_IMPL(TSysInfoImpl, SysInfo, TSysInfo, ISysInfo,
DIID_ISysInfoEvents),
public IObjectSafetyImpl<TSysInfoImpl,
INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA>
{
void __fastcall ActivateEvent(TObject *Sender);
void __fastcall ClickEvent(TObject *Sender);
void __fastcall CreateEvent(TObject *Sender);
void __fastcall DblClickEvent(TObject *Sender);
void __fastcall DeactivateEvent(TObject *Sender);
void __fastcall DestroyEvent(TObject *Sender);
void __fastcall KeyPressEvent(TObject *Sender, char &Key);
void __fastcall PaintEvent(TObject *Sender);
bool __fastcall GetMAC(char *Mac);
public:
void InitializeControl()
{
m_VclCtl->OnActivate = ActivateEvent;
m_VclCtl->OnClick = ClickEvent;
m_VclCtl->OnCreate = CreateEvent;
m_VclCtl->OnDblClick = DblClickEvent;
m_VclCtl->OnDeactivate = DeactivateEvent;
m_VclCtl->OnDestroy = DestroyEvent;
m_VclCtl->OnKeyPress = KeyPressEvent;
m_VclCtl->OnPaint = PaintEvent;
}
// 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(TSysInfoImpl)
VCL_CONTROL_COM_INTERFACE_ENTRIES(ISysInfo)
COM_INTERFACE_ENTRY(IObjectSafety)
END_COM_MAP()
BEGIN_CATEGORY_MAP(TSysInfoImpl)
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
IMPLEMENTED_CATEGORY(CATID_SafeForInitializing)
END_CATEGORY_MAP()
// 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(TSysInfoImpl)
// PROP_PAGE(CLSID_SysInfoPage)
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(TSysInfoImpl, TSysInfo);
// 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("SysInfoCtl.SysInfo", 1);
protected:
STDMETHOD(_set_Font(IFontDisp** Value));
STDMETHOD(get_Active(VARIANT_BOOL* Value));
STDMETHOD(get_AlignDisabled(VARIANT_BOOL* Value));
STDMETHOD(get_AutoScroll(VARIANT_BOOL* Value));
STDMETHOD(get_AutoSize(VARIANT_BOOL* Value));
STDMETHOD(get_AxBorderStyle(TxActiveFormBorderStyle* Value));
STDMETHOD(get_BorderWidth(long* Value));
STDMETHOD(get_Caption(BSTR* Value));
STDMETHOD(get_Color(::OLE_COLOR* Value));
STDMETHOD(get_DoubleBuffered(VARIANT_BOOL* Value));
STDMETHOD(get_DropTarget(VARIANT_BOOL* Value));
STDMETHOD(get_Enabled(VARIANT_BOOL* Value));
STDMETHOD(get_Font(IFontDisp** Value));
STDMETHOD(get_HelpFile(BSTR* Value));
STDMETHOD(get_KeyPreview(VARIANT_BOOL* Value));
STDMETHOD(get_PixelsPerInch(long* Value));
STDMETHOD(get_PrintScale(TxPrintScale* Value));
STDMETHOD(get_Scaled(VARIANT_BOOL* Value));
STDMETHOD(get_Visible(VARIANT_BOOL* Value));
STDMETHOD(get_VisibleDockClientCount(long* Value));
STDMETHOD(set_AutoScroll(VARIANT_BOOL Value));
STDMETHOD(set_AutoSize(VARIANT_BOOL Value));
STDMETHOD(set_AxBorderStyle(TxActiveFormBorderStyle Value));
STDMETHOD(set_BorderWidth(long Value));
STDMETHOD(set_Caption(BSTR Value));
STDMETHOD(set_Color(::OLE_COLOR Value));
STDMETHOD(set_DoubleBuffered(VARIANT_BOOL Value));
STDMETHOD(set_DropTarget(VARIANT_BOOL Value));
STDMETHOD(set_Enabled(VARIANT_BOOL Value));
STDMETHOD(set_Font(IFontDisp* Value));
STDMETHOD(set_HelpFile(BSTR Value));
STDMETHOD(set_KeyPreview(VARIANT_BOOL Value));
STDMETHOD(set_PixelsPerInch(long Value));
STDMETHOD(set_PrintScale(TxPrintScale Value));
STDMETHOD(set_Scaled(VARIANT_BOOL Value));
STDMETHOD(set_Visible(VARIANT_BOOL Value));
STDMETHOD(get_PCID(BSTR* Value));
STDMETHOD(get_HDID(BSTR* Value));
STDMETHOD(get_HDModel(BSTR* Value));
STDMETHOD(get_Mac(BSTR* Value));
};
//--------------------------------------------------------------------------
-
#endif
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|