Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1019113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:57:41+00:00 2026-05-16T10:57:41+00:00

I can’t seem to understand how i give my implementation of the IHttpSecurity::OnSecurityProblem to

  • 0

I can’t seem to understand how i give my implementation of the IHttpSecurity::OnSecurityProblem to my IWebBrowser2 object.

I know that i need to implement a class something like this:

class CServiceProvider : public IServiceProvider
{
public:
CServiceProvider();
~CServiceProvider(); 

    // IUnknown
    ULONG STDMETHODCALLTYPE AddRef();
    ULONG STDMETHODCALLTYPE Release();
    STDMETHODIMP QueryInterface(REFIID iid, void ** ppvObject);

//QueryService
STDMETHODIMP QueryService(REFGUID guidService,REFIID riid,void **ppv);

private:
 ULONG m_ulRefCnt;
};

And in the QueryService function when it requests the IID_IHttpSecurity i return my implementation of the IHttpSecurity interface.

But my problem is how i set the my service provider implementation on the IWebBrowser2 object and when?

My code is something like this:

IWebBrowser2 *_Browser;

IServiceProvider* pServiceProvider = NULL;
    _Browser->QueryInterface(
                IID_IServiceProvider, 
                (void**)&pServiceProvider);

    IHttpSecurity* pi;
    pServiceProvider->QueryService(IID_IHttpSecurity, &pi);


    _Browser->Navigate(url.AllocSysString(),
                       &flags,
                       &target_frame_name,
                       &post_data,
                       &headers);

The question this works like i’m thinking if yes how i do this then, and if not can you explain how this works and can be setted?

PS: i only whant to implement the IID_IHttpSecurity interface, all other interfaces requested on the QueryService should do the default implementation provided by the system…

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:57:41+00:00Added an answer on May 16, 2026 at 10:57 am

    I already figure out how this is done.

    Using MFC we only need to implement CCustomOccManager that implements the COccManager in witch the implementation of CreateSite function returns an implementation of our COleControlSite (example CCustomControlSite). In this class you will need to override at least the QueryService function of IServiceProvider interface and in this implementation supply yours IHttpSecurity implementation (when required by the interface).

    In the end the we register all this in the App InitInstance using the MFC function AfxEnableControlContainer.

    Code:

    // declare our custom control site to serve as the client site
    class CCustomControlSite:public COleControlSite
    {
    public:
        // constructor associates this site with the container
        CCustomControlSite(COleControlContainer *pCnt):COleControlSite(pCnt){}
    protected:
    DECLARE_INTERFACE_MAP();
    BEGIN_INTERFACE_PART(ServiceProvider, IServiceProvider)
    // declare the interface method(s)
    STDMETHOD(QueryService) ( 
                /* [in] */ REFGUID guidService,
                /* [in] */ REFIID riid,
                /* [out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
    END_INTERFACE_PART(ServiceProvider)
    };
    
    // declare our control container manager
    class CCustomOccManager :public COccManager
    {
    public:
        CCustomOccManager(){}
        // creates an instance of our custom control site and associates it with the container
        COleControlSite* CreateSite(COleControlContainer* pCtrlCont)
        {
            CCustomControlSite *pSite = new CCustomControlSite(pCtrlCont);
            return pSite;
        }
    };
    

    In the App InitInstance simple call AfxEnableControlContainer on our implementation:

    // Create a custom control container manager class so we can overide the client site
    CCustomOccManager *pMgr = new CCustomOccManager;
    
    // Set our control containment up but using our control container 
    // management class instead of MFC's default
    AfxEnableControlContainer(pMgr);
    

    If someone has the knowledge on how this is done without using MFC please let me know.

    Thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.