Visual Basic 6 And Internet Explorer 7

Since I installed Internet Explorer 7 all references to the library that holds the Web Browser control are broken. I see lots of people around the net are having the same issues and there is a simple solution.

2006-10-24 15:50:00.0

Visual Basic 6 And Internet Explorer 7

I am currently moving over to C# .NET for all my desktop programming but I have some legacy apps written in Visual Basic 6 that use the WebBrowser Control extensively. Plus, sometimes you dont want the overhead of .NET 2.0 just to knock out a quick app so Visual Basic 6.0 works perfectly in some scenarios.

Since I installed Internet Explorer 7 all references to the library that holds the Web Browser control are broken. I see lots of people around the net are having the same issues and there is a simple solution.

All you have to do is click Project and then Components, click Browse... and locate shdocvw.dll in the System 32 directory. This will restore the IDE back to referencing the correct .dll for the WebBrowser control and all other projects will load fine from then on.

UPDATE - Saturday 28th October 2006

I ran into a slight issue that took a while to figure out.
On the development machine, the VB6 IDE threw a strange error after the Navigate2 method is called. This error was something like "Runtime Exception -1 (FFFFFFF)". I couldnt figure out what it was because when I compiled the app and ran it outside VB IDE I didnt get the error. After a while I remembered that when I installed IE7 (I did this twice to see what would change on my machine) it reset some basic security settings. One of these is "Allow scripting of the WebBrowser Control". This was the culprit. If I checked this on, the IDE didnt throw the error.

Another thing to stress is that the end user of your application will have no problems if your VB6 App uses the WebBrowser control. Even if you have IE6 and they have IE7, your app is compatible.

As Tim mentions in the comments section, there are too many people knocking IE7 and having petty flame wars when in actual fact the impact of IE7 on legacy apps is minimal with the right information. Overall I am extremely happy with IE7 and am beginning to appreciate the effort Microsoft have put into it.

Add to your    DIGG This!    Technorati Cosmos Link    Post to Reddit    Add to your Furl    Add to Blinklist
Comments [53] - Leave a comment


Tim Shay said:
Thanks, Daniel! Worked like a charm.

I've been sifting through stacks of little flame wars about how old VB6 is, which language to convert to, what to uninstall if you don't like it... they're all missing the point. I've got VB6, .NET 1.1 and .NET 2.0 - all running various production programs. My job, in this case, was to move to IE7 on a development machine to prove that we shouldn't have problems with continued support at client locations where we have no control over what edition of IE they use! It was not a good experience to find that the project wouldn't load properly post-IE7.
Dan said:
Hi Tim, your more than welcome. I kinda got worried a bit when I installed and loaded my projects first and got the reference issues:-)

I have updated the entry above with something else I noticed.

gareth said:
Hey - many thanks for posting this - saved me a lot of time :)
James McComb said:
Thanks for increasing the signal-to-noise ratio on this issue. These tips have fixed both of my issues as well. Cheers!
Al Smith said:
Im having the same problems with VB6 and IE7.
Please could you give me some more details about how your 2 fixes are implemeted.
I set the component to shdocvw.dll but that didnt stop the runtime error.
I then tried to find the scripting thing in IE>Tools>custom> but Im not certain which one it is.

Thanks in advance
Kris said:
Perfect! saves all of us a lot of time! thank you very much
Jesper said:
Kristina said:
Hey, when you say "Allow scripting of the WebBrowser Control" what exactly do you mean. I figured out the way to solve the complete breakdown of library of controls but I also started geting this weird error. I am not sure what you reffer to when you say "Allow scripting of the WebBrowser Control". Where did you set this setting, in the IE or VB IDE?
Coddy said:
You're my savior ...
Mike said:
Thanks Mate!! I got into a sticky place with a client for whom I have a VBA form with the ActiveX browser. Worked like a charm. Thanks again.
Sherrie said:
Thanks a million!
Your solution saved me a great amount of time!
I'm still getting run-time errors, like run-time error -2, -3, -5 and others. Any ideas?
Algirdas said:
I'm sorry to see another Microsoft brain-washed victim. Really sorry Daniel.
Daniel said:
Algirdas, are you for real? Why you sorry for me?! You dont know the first thing about me. Please fuck off and rant in front of a mirror where there is someone that cares...
Orlando said:
I'm still getting run-time errors, Any ideas?
You're NOT my savior :)

Thanks in advance
Dagger said:
You can find this script choice here: Tools-->Menu-->Security-->Internet-->Custom level-->Allow scripting of Internet Explorer web browser control.

However, these solutions did not solve my problem. I still got this error after clicking a listbox link 2-4 times: "Run-Time error '-2 (fffffffe)'".

The solution to my problem was changing some registry settings, which is not changed by just changing the reference from ieframe.dll to shdocvw.dll in vb6.

Here is the key to change:
There are 2 keys in the subdirectories that needs changing, one is under "InProcServer32", the other is under "ToolboxBitmap32". Just change iframe.dll to shdocvw.dll wherever you see it. Good luck!
Dagger said:
Forgot to mention that you have to close down visual basic entirely after changing the keys to see this working.
Dagger said:
Seems like the slashes in the registry address got removed. Just search for 8856F961 and you should end up on the right location.

With this change I do not need to modify any script settings.
aston said:
i have the problem that with IE 7 my program will not load youtube movies, and will popup error messages! it works with the IE 6 control everything works with the IE 7 control exept youtube movies and other movies, even allowing scipting... doesn't work, if you know how add me on msn or email me at or (I use both)
My application did stuff on the "status message changed" event, so I needed to enable both "Allow scripting of Internet Explorer web browser control" and ""Allow status bar updates via script" in the IE7 security settings. Scroll through all those settings and see if there's any others that might need enabling for your application.
"Display video and animation on a webpage that does not use external media player" comes to mind for the previous poster, for example.
HakanKursad said:
Thank you for posting.
Dan said:
No problem, thanks to everyone who commented.
Fabrizio said:
Thank you very much for solving this strange bug.
HappyKillmore said:
Thanks you Daniel for posting this! Thank you Dagger for solving my problem!!!!
Ronald Cordina said:
The post by dagger saved my day!!!
Malvin said:
Dagger provided solution worked. Thanks very much. I almost lost the day over this problem
Shakil said:
Thanks man! You are a STAR! You saved me a lot of grief. Thanks a ton!!!
greg said:
i use vb and cant find the web browser control can you help me thanks
Lewis Liu said:
Thanks for your blog. It solves my problem.
Russell Edwards said:
This fix worked beautifully for a time, then the problem reappeared after a Windows update. Only now the error is showing against the method. Eg: In the command:

WebBrowser1.ExecWB OLECMDID_PAGESETUP, 0, Null, Null

The error originally showed against OLECMDID_PAGESETUP, now it shows against .ExecWB

Has anyone else experienced this?
Russell Edwards said:
I found the fix to my problem (above). Needed to remove all Webbrowser controls from my project, delete Microsoft Internet Controls (Project, Components), then reverse the process.
babu said:
Thanks Tim...this works ..even i had the same problem but the solution what u gave fits perfect in this case..thanks a ton..
IE 7 fails to work with applications built with Iframes..i do have this problem any solution for this TIM some functions were not working...The application is in .net fully javascript C# oriented...
babu said:
Im sorry thanks Mr.Daniel...and tim that extends to u too...
Jeffrey said:
Hi Daniel
Thank you very much. Was facing the same problem, and this post helped to overcome it.
Nipop said:
One million of thanks... You really save my neck, this solve all my problems... Thanks for sharing this solution...
Gunnar said:
Thank you for solving this problem. It was driving me nuts. And I have found nothing at MSDN, Microsoft and so forth. Microsoft should be first in line to tell us.
Gunnar said:
I thought for a moment that this trick really worked even for me, but i does not. What did I miss?
dpSubi1 said:
Great! I was struggling on the run time error past couple of hours.

Keep you your good work.
hiafasdf said:

finally DOOD
The date is now 12/07/2007 and I have just installed the production version of IE-7 after putting it off for some time. When I rebooted my machine the exact same problem you described happened with a VB6 application I am working on. I am happy to say that your solution worked perfectly. The problem still occurs and your solution still works. A hardy thanks. You sure saved me a ton of time! ...Don
Appelforce said:
I've tried your "solution", it does not work for me, I?m sorry to say
leon said:
u save my day!
Darth Man said:
I have Internet Explorer 7 but i can use Vb6 to amke webbrowsers :P
Tim said:
I just ran into this problem after a Windows Update and it broke my apps. I've been using IE 7 for many months and never had this problem, now the latest update broke my apps. I tried all the fixes lifted (even updated the registry) and they're still broke. Anybody have any other fixes for this?
Larry said:
Thanks Daniel. You saved me tons of time on this one.
Ed Purdy said:
I am using the WebBrowser control and I am getting errors. When IE7 was installed, the VB project reference to Microsoft Internet Controls no longer pointed to a file (dll or oca) that contained the WebBrowser control. Where does the WebBrowser control reside now??
Azz said:
Dagger!!! I'm guessing a few years later then you posted your message - BUT.. You've just become my hero! :-)

I've been looking hours to solve that problem. And your reg solution worked. Cheers!
gandhi said:
This is excellent post. I solved problem which I was facing in one my VB6 application since last 03 days.

Additional guidance regarding registry setting by dagger was very helpful as the setting from IE7 didn't worked for me. Changing registry setting along with IE7 setting worked perfectly.

Ganaraj said:
Thanks Dagger its working.
Sujeet said:
thanks Dagger, it worked for me.
del said:
I've been trying several vb6 browsers, and none would work more than once. They always had the "ieframe.dll" error.
I've tried and tried but the only solution that worked was yours. (project, components, browse)
Why didn't I think of that?
Thank you very much!
Mel said:
I am facing a similar issue, but not related to WebBroser controls.

My issue is that my application that has embedded VB OCX objects crashes when there are information submitted on servlets (.do or .jsp) on IE7. The crashing happens at random though from simply booking of flights to submitting company related info.

The app does not crash on IE, but only on IE7. Any clues as to why this is happening and possible solutions?
Related Articles