Board index » cppbuilder » Sample code to turn off IE warning messages

Sample code to turn off IE warning messages

In the .h file:
//---------------------------------------------------------------------------
class ATL_NO_VTABLE TActiveFormXImpl:
  VCLCONTROL_IMPL(TActiveFormXImpl, ActiveFormX, TActiveFormX,
IActiveFormX, DIID_IActiveFormXEvents),
  public IPersistPropertyBagImpl<TActiveFormXImpl>,
  public IObjectSafetyImpl<TActiveFormXImpl>
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
....

  STDMETHOD(SetInterfaceSafetyOptions)(REFIID riid, DWORD
dwSupportedOptions,
     DWORD dwEnabledOptions );
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In the .cpp file:

STDMETHODIMP TActiveFormXImpl::SetInterfaceSafetyOptions( REFIID riid,
   DWORD dwSupportedOptions, DWORD dwEnabledOptions )
{
   if ( riid == IID_IPersistPropertyBag ) {
      if ( dwEnabledOptions != INTERFACESAFE_FOR_UNTRUSTED_DATA )
         return E_FAIL;
      return S_OK;
   }
   return
IObjectSafetyImpl<TActiveFormXImpl>::SetInterfaceSafetyOptions( riid,
      dwSupportedOptions, dwEnabledOptions );

Quote
}

Alex
--
HotSend - portable documents technology
http://www.hotsend.com/
eFax - get your faxes via email - Free !
http://www.efax.com
 

Re:Sample code to turn off IE warning messages


Thanks Alex-
I will plug it in (with the obvious changes required) and give a whirl..
Quote
"Alex Bakaev [TeamB]" wrote:

> In the .h file:
> //---------------------------------------------------------------------------
> class ATL_NO_VTABLE TActiveFormXImpl:
>   VCLCONTROL_IMPL(TActiveFormXImpl, ActiveFormX, TActiveFormX,
> IActiveFormX, DIID_IActiveFormXEvents),
>   public IPersistPropertyBagImpl<TActiveFormXImpl>,
>   public IObjectSafetyImpl<TActiveFormXImpl>
>    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> ....

>   STDMETHOD(SetInterfaceSafetyOptions)(REFIID riid, DWORD
> dwSupportedOptions,
>      DWORD dwEnabledOptions );
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> In the .cpp file:

> STDMETHODIMP TActiveFormXImpl::SetInterfaceSafetyOptions( REFIID riid,
>    DWORD dwSupportedOptions, DWORD dwEnabledOptions )
> {
>    if ( riid == IID_IPersistPropertyBag ) {
>       if ( dwEnabledOptions != INTERFACESAFE_FOR_UNTRUSTED_DATA )
>          return E_FAIL;
>       return S_OK;
>    }
>    return
> IObjectSafetyImpl<TActiveFormXImpl>::SetInterfaceSafetyOptions( riid,
>       dwSupportedOptions, dwEnabledOptions );
> }

> Alex
> --
> HotSend - portable documents technology
> http://www.hotsend.com/
> eFax - get your faxes via email - Free !
> http://www.efax.com

Re:Sample code to turn off IE warning messages


I forgot to copy this piece:

BEGIN_COM_MAP(TActiveFormXImpl)
  VCL_CONTROL_COM_INTERFACE_ENTRIES(IActiveFormX)
  COM_INTERFACE_ENTRY_IMPL( IPersistPropertyBag )
  COM_INTERFACE_ENTRY_IMPL( IObjectSafety )
END_COM_MAP()

Alex

Quote
Bart wrote:

[snip]

Re:Sample code to turn off IE warning messages


Thanks again Alex-
I just started to copy this into place and it hit me, that I did not
specify, that I am trying to get this to work in a BCB3 project. Will
this make any difference?

TIA

Quote
"Alex Bakaev [TeamB]" wrote:

> I forgot to copy this piece:

> BEGIN_COM_MAP(TActiveFormXImpl)
>   VCL_CONTROL_COM_INTERFACE_ENTRIES(IActiveFormX)
>   COM_INTERFACE_ENTRY_IMPL( IPersistPropertyBag )
>   COM_INTERFACE_ENTRY_IMPL( IObjectSafety )
> END_COM_MAP()

> Alex

> Bart wrote:
> [snip]

Re:Sample code to turn off IE warning messages


Sorry, I should have been clearer..
The reason for the last question is that I noticed that my project did
not include the template for the IPersysPropertyBagImpl in the class
declaration. So my declaration looks a bit different.
I don't know whether this is due to an option that I took at the wizard
or if it is a difference in the BCB3 vs 4 file generation.

TIA

Quote
"Alex Bakaev [TeamB]" wrote:

> I forgot to copy this piece:

> BEGIN_COM_MAP(TActiveFormXImpl)
>   VCL_CONTROL_COM_INTERFACE_ENTRIES(IActiveFormX)
>   COM_INTERFACE_ENTRY_IMPL( IPersistPropertyBag )
>   COM_INTERFACE_ENTRY_IMPL( IObjectSafety )
> END_COM_MAP()

> Alex

> Bart wrote:
> [snip]

Re:Sample code to turn off IE warning messages


Bart, the code is for BCB4. The general idea still applies - your
control has to implement and expose the IObjectSafety interface.

Alex

Quote
Bart wrote:

[snip]

Re:Sample code to turn off IE warning messages


Thanks for the example code. It's in and compiles (now for some testing
<grin>).
Can you point me to an article so that I can make better sense of what
this does.?

TIA..

Quote
"Alex Bakaev [TeamB]" wrote:

> Bart, the code is for BCB4. The general idea still applies - your
> control has to implement and expose the IObjectSafety interface.

> Alex

> Bart wrote:
> [snip]

Re:Sample code to turn off IE warning messages


This is from a book ( I think Beginning ATL COM programming or something
like this ).

Alex

Quote
Bart wrote:

> Thanks for the example code. It's in and compiles (now for some testing
> <grin>).
> Can you point me to an article so that I can make better sense of what
> this does.?

> TIA..

> "Alex Bakaev [TeamB]" wrote:

> > Bart, the code is for BCB4. The general idea still applies - your
> > control has to implement and expose the IObjectSafety interface.

> > Alex

> > Bart wrote:
> > [snip]

--
HotSend - portable documents technology
http://www.hotsend.com/
eFax - get your faxes via email - Free !
http://www.efax.com

Re:Sample code to turn off IE warning messages


Alex-
You're a gentleman and a scholar..
Thanks for all your help.
This solution worked wonderfully.
Quote
"Alex Bakaev [TeamB]" wrote:

> This is from a book ( I think Beginning ATL COM programming or something
> like this ).

> Alex

> Bart wrote:

> > Thanks for the example code. It's in and compiles (now for some testing
> > <grin>).
> > Can you point me to an article so that I can make better sense of what
> > this does.?

> > TIA..

> > "Alex Bakaev [TeamB]" wrote:

> > > Bart, the code is for BCB4. The general idea still applies - your
> > > control has to implement and expose the IObjectSafety interface.

> > > Alex

> > > Bart wrote:
> > > [snip]

> --
> HotSend - portable documents technology
> http://www.hotsend.com/
> eFax - get your faxes via email - Free !
> http://www.efax.com

Re:Sample code to turn off IE warning messages


Thank you for the kind words ;) Glad it's working.

Alex

Quote
Bart wrote:

[snip]

Other Threads