Click here to Skip to main content
15,031,017 members
Articles / Desktop Programming / MFC
Posted 19 Sep 2004


20 bookmarked

Customize Web Browser ActiveX and change its inbuilt settings

Rate me:
Please Sign up or sign in to vote.
3.73/5 (8 votes)
19 Sep 20042 min read
This article demonstrates how to change Web Browser ActiveX inbuilt settings. In this article, two major tasks are implemented: hide default scroll and disable right click.

Sample application screen


Internet Explorer is a very powerful tool for showing all types of images (JPEG/GIF etc.) and web files (HTML, ASP etc.). This is the tool that can be used as multipurpose picture/document viewer. That's what I tried to use. But that was not the end. That was starting of my problem.


Web Browser ActiveX has some problems when it displays Picture/Document.

  1. It shows vertical scroll bar in right side even if there is no need of that.
  2. It allows user to right click and choose Options as in Internet Explorer.


It was very hard to find a solution to this problem, as that solution was hidden. Four main files were added in this project to solve this problem.

  1. custsite.h & custsite.cpp
  2. idispimp.h & idispimp.cpp

These files are interfaces to reach into the Web Browser Control. These classes can control the internals of Web Browser such as scroll, right click etc.

How to use (link) these classes:

Step I: Open header file of your application class. E.g.: in my sample project, it is InternetExplorerExperimentApp.h. Add the following code in the class:

class CImpIDispatch* m_pDispOM;

Step II: Open CPP file of your application class. E.g.: InternetExplorerExperimentApp.Cpp. Add the following code:

  • Add header files:
    #include <..\src\occimpl.h>
    #include "custsite.h"
  • Add code in function InitInstance() just in starting of function:
    CCustomOccManager *pMgr = new CCustomOccManager;
    // Create an IDispatch class for extending the Dynamic HTML Object Model
    m_pDispOM = new CImpIDispatch;

Step III: Open Custsite.cpp and add global variable as declared in application's .cpp file, with extern.

extern CInternetExplorerExperimentApp theApp;

Step IV: Add main project header file in both files:

  1. custsite.h
  2. idispimp.h

What I did to hide scroll bar:

// * CImpIDocHostUIHandler::GetHostInfo
// *
// * Purpose: Called at initialization
// *
  CCustomControlSite::XDocHostUIHandler::GetHostInfo( DOCHOSTUIINFO* pInfo )

    METHOD_PROLOGUE(CCustomControlSite, DocHostUIHandler)
    // Just Comment following lines & you'll see scroll bar.
    pInfo->dwDoubleClick = DOCHOSTUIDBLCLK_DEFAULT;
    return S_OK;

That's the end. Now, you have a direction, and if you find anything new, please let me know also. See you soon with another magic.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Sumit Kapoor
Software Developer (Senior)
India India
Working in Patni Computer Systems, Noida(INDIA). I like to work in C/C++ even from my school time & mostly worked using C++, VC++, COM.

I want to give something bigger than biggest to IT field. Try is going on.

I like to make friends.
That’s all about me.

Ok! See you.
Have a nice Life.

Comments and Discussions

QuestionZoom out window Pin
cbir systems13-May-08 20:56
Membercbir systems13-May-08 20:56 
QuestionAlternative way Pin
fate9319-Mar-08 16:09
Memberfate9319-Mar-08 16:09 
Generalcompiling errors ! Pin
Don Box22-Jun-06 6:05
MemberDon Box22-Jun-06 6:05 
GeneralRe: compiling errors ! Pin
prezess14-Oct-06 14:18
Memberprezess14-Oct-06 14:18 
QuestionPrevent Web Pages from Being Saved in Cache Pin
razvar15-Nov-05 22:37
Memberrazvar15-Nov-05 22:37 
QuestionHow can I create a WebBrowser Contrl with C Pin
ftts27-Sep-05 14:03
Memberftts27-Sep-05 14:03 
AnswerRe: How can I create a WebBrowser Contrl with C Pin
Sumit Kapoor27-Sep-05 14:05
MemberSumit Kapoor27-Sep-05 14:05 
Generalwith WCE 420 Pin
IFranco26-Jul-05 15:25
MemberIFranco26-Jul-05 15:25 
GeneralRe: with WCE 420 Pin
Sumit Kapoor26-Jul-05 23:18
MemberSumit Kapoor26-Jul-05 23:18 
GeneralProblem with borders around images Pin
Virendra Sharma2-Jun-05 5:41
MemberVirendra Sharma2-Jun-05 5:41 
GeneralRe: Problem with borders around images Pin
Alexander Jost25-Jun-05 23:49
MemberAlexander Jost25-Jun-05 23:49 
GeneralUnable to compile Pin
vyjesh21-Jan-05 19:59
Membervyjesh21-Jan-05 19:59 
GeneralRe: Unable to compile Pin
Sumit Kapoor23-Jan-05 19:05
MemberSumit Kapoor23-Jan-05 19:05 
GeneralRe: Unable to compile Pin
Paul the Great24-Oct-06 5:38
MemberPaul the Great24-Oct-06 5:38 
GeneralRe: Unable to compile Pin
Darko@Hot7-Jul-08 6:23
MemberDarko@Hot7-Jul-08 6:23 
GeneralWant IE And IpHelper Help Pin
eiteit23-Nov-04 4:58
Membereiteit23-Nov-04 4:58 
GeneralRe: Want IE And IpHelper Help Pin
Sumit Kapoor23-Nov-04 17:15
MemberSumit Kapoor23-Nov-04 17:15 
GeneralRe: Want IE And IpHelper Help Pin
eiteit23-Nov-04 21:00
Membereiteit23-Nov-04 21:00 
GeneralRe: Want IE And IpHelper Help Pin
Sumit Kapoor24-Nov-04 19:27
MemberSumit Kapoor24-Nov-04 19:27 
Generaliphlpapi.lib Pin
Sumit Kapoor24-Nov-04 19:38
MemberSumit Kapoor24-Nov-04 19:38 
GeneralRe: iphlpapi.lib Pin
eiteit26-Nov-04 7:24
Membereiteit26-Nov-04 7:24 
GeneralRe: iphlpapi.lib Pin
Sumit Kapoor28-Nov-04 20:18
MemberSumit Kapoor28-Nov-04 20:18 
GeneralNot working somehow Pin
Anonymous18-Oct-04 3:02
MemberAnonymous18-Oct-04 3:02 
GeneralRe: Not working somehow Pin
mmanyen3-Jan-05 9:31
Membermmanyen3-Jan-05 9:31 
QuestionRe: Not working somehow Pin
cbir systems17-Oct-07 2:43
Membercbir systems17-Oct-07 2:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.