CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #6
    Join Date
    Feb 2010
    Posts
    1

    Smile Re: ActiveX and IObjectSafetySiteLock,IObjectWithSite

    Thanks guys, I thought I'd chip in too. I had some trouble with the above directions. What I basically did was I followed this codeproject article: http://www.codeproject.com/KB/COM/CompleteActiveX.aspx on creating a simple MFC ActiveX control. I then wanted to use the SiteLock template on that example but had a thrilling time banging my head on the wall for a couple of days. This post really helped. I took your modifed sitelock.h and replaced the one I had and added the code you posted to my h and cpp files.

    I found that I needed to add DECLARE_INTERFACE_MAP() (after all the other DECLAREs) to my CYourctrl.h file.

    I also changed the following in GetInterfaceSafetyOptions:

    // Check expiry and if the activation URL is allowed
    if (!ControlExpired() && InApprovedDomain())
    {
    *pdwSupportedOptions = dwSupportedSafety;
    *pdwEnabledOptions = m_dwCurrentSafety;
    }
    else
    {
    *pdwSupportedOptions = 0; // Changed from dwSupportedSafety
    *pdwEnabledOptions = 0;
    }

    This way if the site doesn't belong to the approved list, safety will not be supported ( before I did that safety settings were working for both approved and unapproved sites) not sure what the logic with the m_dwCurrentSafety option is.

    I've attached the example project I was working on in case somebody else is having as much trouble dealing with this. As I understood from this post, the OleObject route is your only choice when you are working with MFC and the SiteLock template.

    Thanks for the effort guys
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured