Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Trying to remove scrollbars from IE4 control

Posted on 1998-02-17
Medium Priority
Last Modified: 2013-11-20
I've been working with the IE4 activex control and have had mixed results handling the removal of the window decorations (scrollbars, 3dborders...).

The Driller example program showed me how to extend the undocumented COleControlSite to provide MSHTML the information to NOT include 3dborders and scrollbars on the documents.

This worked fine for my application - but only in a limited way.  I have a CView with webbrowser controls - 2 of them.  These are constructed at slightly different times and ONLY THE FIRST BROWSER HAS THE SCROLLBARS REMOVED (not yelling, just getting the main point across).  The second control does NOT use my extended COleControlSite and the extended function that tells the control to not include scrollbars and 3dborders.

My thoughts lately have been that this might work if I had these controls in a CDialog as opposed to a CView.  There seems to be quite a bit of CDialog code dedicated to ole control hosting and I don't think my CView is benefiting from this and might need it.  Driller uses a CDialog and I see that as the main difference in our applications (adding another webbrowser control to Driller has positive results).

I'm looking for a comprehensive answer that will hopefully solve my problem and give me more insight as to how the MFC/OLE/ActiveX stuff really works.
Question by:wormzer
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 15

Accepted Solution

Tommy Hui earned 3000 total points
ID: 1316298
The COleControlSite class is used as a place holder between your application and the control. It is used by the control to find out things about the container. Ultimately, this site is managed by a control container manager. Whenever a control is instantiated, it usually tries to find out things about its container. One of the things the IE control does is look for the IDocHostUIHandler interface. If the site supports this interface, then the control will use the interface for its customizations.

In this case, the control will ask the interface how to show the control through the IDocHostUIHandler::GetHostInfo() method. As you know, you can change the control to not display any 3d borders and scrollbars by using


This works as long as the control knows about the proper site/occmanager. Are you sure you have used the following lines from driller.cpp?

      CCustomOccManager *pMgr = new CCustomOccManager;

      // Create an IDispatch class for extending the Dynamic HTML Object Model
      m_pDispOM = new CImpIDispatch;

      // Set our control containment up but using our control container
      // management class instead of MFC's default

These are the most important ones. It does not matter whether you are using a dialog or a view. You can use the control in a window and it wouldn't matter. What you should try doing is confirm if the control is using the correct site by setting breakpoints on all of the member functions of custsite.cpp of driller.


Author Comment

ID: 1316299
This is good stuff - and its about where I've gotten in my own investigations.  Since I posted the question, I started tracing through the MFC stuff and saw where the MSHTML control was calling COleControlSite::XOleClientSite::QueryInterface, which then trickled down the chain of event maps - including the CCustomOleControlSite (my derivation) which only included just the one interface.  This was great to trace through because it gave me a good idea of what was supposed to happen.

The first control I create - it does a series of calls to this QueryInterface and the 27th one (I can tell by the 128 bit iid sent in) is the one that's calling for the IDocHostUIHandler interface - then calls my function sending the NOSCROLL and things.

The second control I create and navigate has a similar procession of calls to the XOleClientSite::QueryInterface with a few differences and NEVER calls for the IDocHostUIHandler and thus, never hears how I want the control decorated.

My thinking now is that it's something in the MSHTML that's making it NOT CALL FOR IDocHostUIHandler.  Under Driller it did for both controls.  Something in the way that I'm creating or navigating the second control is making it not call for my interface.  One I AM creating and navigating the second control during a OnBeforeNavigation from the first control...  MSHTML might not like this?  This smells of a non-reentrancy problem really, though, since the two controls should be separate in their actions.


Author Comment

ID: 1316300
Also - can you tell me what the heck this does:

// Create an IDispatch class for extending the Dynamic HTML Object Model
m_pDispOM = new CImpIDispatch;

From what I could tell it was completely unnecessary in Driller.  The whole example seemed to have lots of useless junk laying around (It can't even call the Drilling code the way it is off the CD!)

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Author Comment

ID: 1316301
Got it.

For some reason - my webbrowser2.h file had one of it's Create functions as NON-VIRTUAL.  That made it so that when I called pWebBrowser->Create (thinking it would call the appropriate Create function - webbrowser2/webbrowser) it was NOT VIRTUAL.

Anyways, thanks for the info and I'd still be willing to give you the points if you can explain what the IDispatch does in Driller (or would do if it was actually integrated in correctly).  What is the map that is found in CImpIDispatch doing and when would it be needed?
LVL 15

Expert Comment

by:Tommy Hui
ID: 1316302
There are times when the Explorer control needs to use the host to do things, to extend it. However, using a custom interface does not always work. So instead, the IDocHostUIHandler::GetExternal() is used to retrieve an IDispatch pointer. The IDispatch pointer can then be used by the control.


Author Comment

ID: 1316303
I was more looking for an explaination of how the little fake-mapping that is done in that IDispatch was supposed to work.  There was talk of "This should really be done with a type library but it is hacked togehter here with strings like 'xxyyzz'".  What are those?

I'm just looking for 750 points worth of info and you're almost there. :)
LVL 15

Expert Comment

by:Tommy Hui
ID: 1316304
An IDispatch has basically four functions:


GetTypeInfoCount is used to determine how many types there are in this object. GetTypeInfo is used to get the actual type information about the object. These two functions are only needed by full-blown browsers, they are not typically needed by controllers with a specific purpose.

The other two are used for dynamic invoking of methods within the object. Each method or property has an associated ID. This ID is unique within the object. A controller will need to use this ID for future call to Invoke(). For example, if the object has a function called Foo and it has an ID of 1, then a call to GetIDsOfName("Foo") will return 1.

A call to Invoke (1, DISPATCH_METHOD, args) will ultimately call into the Foo member function. The code in iDispImp.cpp uses an if statement to filter on the dispId to make sure that it is the right member function to call.

To handle IDispatch correctly, you should implement all of the four member functions mentioned above, but in this case, because it is very specific, then only a subset is really needed and hence the comments in the file.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question