Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2008 > Visual Basic 2008 Essentials
Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Essentials section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 10th, 2008, 06:32 PM
Authorized User
Join Date: Dec 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default HOWTO VB2008: VB6 ActiveX /WebBrowser

I have a VB6 Windows Application that uses the WebBrowser control to run extended
JavaScript. The WebBrowser document text (html + javascript + local activex <object> tag)
is directly set and invoked by the VB6 application. The invoked javascript calls the
extended class functionality provided by the VB6 ActiveX control and then generates output to
the WebBrowser document. Note, in this older scenario there is no web server required.

How would I do the above using VB2008?

At this point I have created a VB2008 class library (with 'Make assembly COM-Visible', 'Sign the Assembly', and a build followed by a run regasm /codebase). This should be the equivalent of the ActiveX control. Also I have built a VB6 application to see if I can reference the COM Callable Wrapper and the class library. NOTE: the class library does appear in the reference list and I'm able to invoke the class functions from VB6.

After creating a small VB2008 test application with the WebBrowser control on a form, I found that the <object reference> in the html doesn't load the class library. This was also a problem when using a simple html page in MSIE (allowed activex on the page).

The test application sets the WebBrowser's document to an html string (includes the javascript), but it isn't clear to me what html tag is needed to embed the class library so that it can be accessed by the javascript code. Similar examples I've seen left out some of the important details. I have tried:

<object id='mine' name='mine' classid='ActiveXDotNet.dll#ActiveDotNet.MyClassLib rary'></object>


<object id='mine' name='mine' classid='clsid:092EC730-6456-3B1C-BD27-C17A09533943'></object>

where the clsid is the one found via regedit search on the class library name.

Is there a better approach?

Detailed examples would be wonderful.

Any ideas are appreciated.

Old August 11th, 2008, 09:59 PM
Authorized User
Join Date: Dec 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts

When I set the Intranet security settings on IE7 to low and enable everything related to ActiveX and scripting then the Javascript can invoke functions in the class library. I have to reference it by using:

<object id='mine' name='mine' classid='clsid:092EC730-6456-3B1C-BD27-C17A09533943'></object>


Similar Threads
Thread Thread Starter Forum Replies Last Post
change page encoding in WebBrowser ActiveX control alexxx_ltd Visual C++ 2 December 16th, 2004 07:08 PM
Creation of ActiveX DLL with VB6 james gold VB Components 2 December 28th, 2003 04:02 PM
Can a VB6 ActiveX DLL reference a spreadsheet? james gold Pro VB 6 0 October 2nd, 2003 10:02 AM
Creation of ActiveX DLL with VB6 james gold Pro VB 6 2 September 10th, 2003 08:19 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.