Solved

make internet explorer toolbar/button

Posted on 2004-08-11
25
418 Views
Last Modified: 2012-05-05
Hello

I've found some code (here and in other places) to make internet explorer toolbar/button, but it is all for VB 6 and none for vb.net

Does anyone have a class for to add button/toolbar to ie that works with vb.net 2003?

That person might also have an answer to this: how can you after starting your application from the ie button read the url that is currently loaded in the ie window?

Thanks

0
Comment
Question by:netslt
  • 14
  • 10
25 Comments
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11778026

I have been searching ver very long for this (Toolbar in IE programmed in .Net) and found finally this example:

http://www.thecodeproject.com/csharp/dotnetbandobjects.asp

This is really the only thing that seems to be a little in this direction.

As you can see its NOT VB.Net but C#.net. Never-the-less its a VERY VERY basic and short(!) example. I think that this one should be relatively easy to rebuild in VB.Net


Try it and maybe you like it!

Daniël.

btw.: about the "seeing what URL is currently beeing loaded"-question: I have seen a DLL (Interop.SHDocVw.dll; its included ) that had a function like that in it. And of course a lot more than that (superb!). So if you include that one in your project, you'll be able to see those properties too.
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11787237

Ah,.... are you still interrested in this toolbar in IE ??
0
 

Author Comment

by:netslt
ID: 11787883
Yes, still interested, but I guess I'll not be able to rewrite the suggested code to vb.net (unfortunately not yet enough skilled to make it within reasonable time)

There are some vb6 classes around (eg complete code on http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20890485.html ), I was hoping someone had migrated them to vb.net - ???

0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11788125

I was asking cause I started rewriting the C#.net code into vb.net (about 10 hours of work; last 2 days). I got the code almost errorless, but have some problems to deal with. I have absolutly NO idea how much time that will take. One thing I am really sure about: the question where to find the code (available on the Internet) is worth less EE points than the question to rewrite it ;-)

Maybe I can help you in no time... Can promise nothing ...
0
 

Author Comment

by:netslt
ID: 11788600
OK, I see that you deserve more points for this... hope you make it!
0
 

Author Comment

by:netslt
ID: 11788653
I've also tried to get the code from 6 to .net for several hours, but there were about two errors left - and I don't know what would have happened at runtime... But my VB experience is about 2 weeks (although other languages for years, mainly scripting) so no wonder I don't get it...
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11788819
hehe,...

No worries,... I do program for years now (started @ 12 years old.. did not got it (a little feeling for it) until I was 16 or so...)

Anyways, I program VB.NET now for 1 year and VB I have done about 2 years before vb.net. Before that some amateuristic "Borland C" (MS-DOS).

So I cannot say I am a Pro (far from that actually!). But if you are creative enough (am I?) and can hold your breath for a while (is that an english saying?) and now how to seriously Google some up... then you can hack your way into it. Just keep goin'.. just keep goin'.

I can alway try to convert the VB6 code... only if I hadn't spend so much time already in this idea (...). Maybe if I am totally creazy I would try that too. (yes I AM freaking NUTS!)

For now, I am going to sleep.. tomorrow is a new day and I will give it another try. I should be close but I bumped into some serious sh*t since "...VB.Net doesn't fully supports so-called 'Implements' as C#.Net does....". Tomorrow will be a Google-day...
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11796772

okay... I think I did it...

I will need some more time to check and write a explanation. I will post it on my website. I just managed to rewrite the C# code that manages the communication between the explorer and the (to be written) toolbar-component.

Need to do some more testing,... I also need to find you some more about the way you get info from IE like address and browsing  commando's.

I will keep you up-to-date!
0
 

Author Comment

by:netslt
ID: 11796993
Thanks...
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11808721
Okay... ready!...

It was a pain in the ass to write it... but hey... someone had to do this ;-)

Here you have the code: www.danieltrommel.com/download/netslt.zip


Unfortunatly also this code might contain some (little) errors (in specific cases). I've eliminated already some things but let me know, I will try to handle it. I also will put this code on my website. But I though to give it right away to you since you have been waiting for it now for 5 (?) days (sorry; couldn't do it faster...)

I will try to explain as good as possible:

1) download the file and unzip
2) open first the 'Octopus' dir with the BandObject solution.
3) MAKE SURE (!) all the references are right,
4) Do a 'Build solution'

Now is the BandObject -sort of negotiator between your next app and IE- installed in the Assembly registry.

5) open the Samplebar solution
6) Check the references! You should hook in the BandObject.dll (or so) correctly.
7) do also a build solution
8) now open Internet Explorer,
9) right-click on the grey area next to you addressbar and buttons to see if you "HelloWordBar" is select-able in the pop-up-menu
10) select and make sure a bar with button AND textbox is visible.

functionalities:

the bar (if correctly installed/openend) should show you a msgbox every time you navigate to another site (as you asked),.. and you should be able to type e.g. www.danieltrommel.com in the textbox and -when button is clicked- the IE window should navigate to the address typed in the textbox!

Extra notes:

> Both solutions have 2 projects, one of them is always a "RegisterLib" project. This is a clever solution to automatically install the assembly into the registry and MMC. Since this install has to be done last (after a build of the main program), the build order has to be correct (I ve done that already for you).

> Once the BandObject is Build, you won't need to recompile this again, only if this code is changed.

> The "explorer" variable lets you set/get all (...) the propertys of the open IE window. So you can get the current URL (Explorer.LocationURL) or set an URL: Explorer.Navigate("www.yourfavwebsite.domain")

> you can easily handle IE window events :

        Sub DownloadBegin(ByVal URL As String) Handles Explorer.NavigateComplete
            MessageBox.Show(URL)
        End Sub

Check for this the code behind the msgbox-window with the current URL.  


I hope this will help you,...

Daniël
0
 

Author Comment

by:netslt
ID: 11808853
Thanks for this.

When opening the octopus project I get an error:
[Error creating assembly manifest: Error reading Keyfile 'K:\MijnDocs\Visual Studio Projects.......\c#\SampleBars\samplebar.snk

(Also I have only VB.NET standard, so any C stuff will not work here.)

I hope you can fix it!
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11808912
yes....

sorry..

Before you can register your ddl into the MMC, you have to give it a strong name. This is to make sure it's your app (handy for companys) like a unique code. This you can make (quite complicated by hand) but finally there is a file make.

The should be a .snk file in the octopus dir: "BandObjectKey.snk"

If you change in the Assembly.vb:


<Assembly: AssemblyKeyFile("K:\MijnDocs\Visual Studio Projects\testen\IE browser component\C#\SampleBars-c\samplebar.snk")>


to


<Assembly: AssemblyKeyFile("...\\\\yourlocation\\\\BandObjectKey.snk")>



>>>> So it has NOTHING to do with C#. This was only a directory thing...

---------------

BUT A BETTER way to do this, is downloading the tool I use (super handy!!) from http://www.remotesoft.com/ (FREE!!) called "Octopus". When installed, you can right-click on the Assembly.vb file (in solution-explorer) an choose "Digitally sign". That should also do the trick.

Then you have for future use this handy tool installed!
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:netslt
ID: 11810843
I'll check it as soon as I have the time.

Regarding Octopus: I did not find any free download on remotesoft.com - where is it exactly?
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11811634
I am really sorry, I got a little mixed up:

the App is Deadbolt.Net : https://secure.interscapeusa.com/Register/Downloads.aspx   (left icon; no registration needed)

(the other webpage is the webservice I used to convert a part of the source-code from csharp to vbnet)
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11833583

...And,.. did it work out?
0
 

Author Comment

by:netslt
ID: 11838160
I was able to sign it with the tool you recommendet.

But when opening the BandObject Project I get the following error:

The application for Project "...netslt\Octopus\RegisterLIb\RegisterLib.vcproj" is not installed.

Please make sure that the Application for the Project Type (.vcproj) is installed.

I've not tried to install everything yet (some projects have to get finished this week...), but I wonder how you can combine the process - ie having an application that installs itself into IE with one click (Instead of having two projects)?
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11838713
OKay...

sorry for the fuzzy things.. Its not very simple...

I will explain it first:

The file: RegisterLib.vcproj is a project file without any .vb foms of code files...
So you have this solution (BandObject) with 2 project: The original project + this RegisterLib.
The only thing this project is ment for is the automatic install of the build BandObject.dll in the first project of the solution BandObject. So the RegisterLib is the finishing touch you can say.

Now solving the problem:

You can do 2 things... (1) get the registerlib to work. But I remembered you'd no C# installed. Don't worry! This is a C++ project. So you should be able to use it!! (2) The other way is, doing by hand what this Utility does..

(ad1) Try this go get it work:

 - Delete the RegisterLib from you project (Right-Click on RegisterLib in the Solution Explorer and choose Remove)
 - Add this Project again: (rightclick in Solutionexplorer on the topmost item and choose Add>Existing Project.. browse to the file RegisterLib.vcproj and add)


(ad2) Do it by hand:

 - Open the " Visual Studio .Net 2003 Command Prompt ".  (you can find it in the Start-menu>YourVSnet2003Map>Visual Studio .NET Tools)

 - Go to the directory where the Build BandObject.dll is. (So do first a "Build BandObject...")
 - Type this into the prompt:

       gacutil /if BandObject.dll
       gacutil /if Interop.SHDocVw.dll

- Then the .dlls are being added to the Assembly Cache ("...Assembly successfully added to the cache...") and you are able to Build the SampleBar.

---------------------------------------------------------------

To avoid same problems with the Sample-bar project (has also a RegistLib):

It works the same (opening the VS.Net2003 Command Prompt), but now you type this:

       gacutil /if SampleBar_VB.NET.dll
       regasm SampleBar_VB.NET.dll

----------------------------------------------------------------

Anyway: it easier for you (and anyone) to install the RegistLib utility.


How to do this automatic? Okay.. I am now going to isolate the utilitys to get this thing to work on its self... need some time.
0
 
LVL 4

Accepted Solution

by:
Daniellus83 earned 500 total points
ID: 11838912
hello Netslt,..

I made you an easy one: http://www.danieltrommel.com/download/netslt2.zip

Download it.. and you'll see I deleted the RegisterLib things.. and added in the \bin directories a Register.bat file.

Run this Register.Bat after you did a Build of the dll. One note: look in the \bin\output directory for .txt files. They carry the output of the register.bar commands. So you can see if the Registering was a SUCCES....

About the install on other machines:

> make sure they have .Net Framework (v1.1) installed: http://www.microsoft.com/downloads/details.aspx?FamilyID=262d25e3-f589-4842-8157-034d1e7cf3a3&displaylang=en

> They have also to run the Register.at.

Note: of course you can combine those 2 register.bat files. Only make sure the BandObject.dll is installed first.


I will now gonna try this with my project on my brother machine. You will recieve a post (later) on the succes or not.


Daniël
0
 

Author Comment

by:netslt
ID: 11838986
Thanks, I'll try.

For the software: VB.NET Standard includes only Visual Basic, no C# and no C++ etc.

For the installation: I just wonder why it is not possible to add the whole thing that registers the ie button as a Class to the project that should be called from the button - I've seen they have it done it in VB 6 - its simply a class that adds the correct entries to the registry. Why do we need a separate dll here that has to be registered before etc? (Sorry for asking again, I just want to understand what's going on).

By the way one of my daughters is also playing the cello. She is 10 now and started playing when she was 5. I like the intstrument a lot!
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11839167
Haha.. nice! Always makes me happy to hear that people play the cello. I started a lot older (about 10; play now 11 years till now..that makes me... ;-) ). I love to do it. Esspecially playing together with Piano (is a must!).

The answers: You are right about the reg.keys and VB6.... They are ALSO include in the BandObject Solution; take a look at the BandObject.vb sourcecode; at the bottom are 9un)register functions.

But now you are working with .Net Dlls (with COM interface/communication..etc) and they need to be registered in the .Net Assembly! And thats what these tools are doing!

I don't really know if these things can be done with a routine from within the application... I really don't know. The original C# project is done by somebody whois is smart enough to figure out, but has'nt done it like you say.

Although: he has made the RegisterLib VC-project!... But that doens't work on you Configuration and it also gives trouble installing on other machines....


But if you wanna distribute your Samplebar:

Make an installer (add a "Setup and deployment project" to your solution) that holds all the dll with the tools and Register.bat file,... (and the .Net Framework?!) and let it all install properly...

{{I must say: I have never made such an installer... but it should be do-able... I might gonna make one myself soon ;-) }}


About the seperate dll's: You should be able to combine those things... (I should try) but it makes it so complicated... And you can re-use the BandObject.dll for other Bars again without the need to include the code again and again...

I hope I explained (...) enough.. feeeeeeeeeeel freeeee to ask more ;-)

Daniël.
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11880944
And... did you have succes?
0
 

Author Comment

by:netslt
ID: 11889537
Not yet, still very busy with other things - I guess it will take untill next week that I can have a look at it again.
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11889905
Okay, but don't forget the solution might get flushed after some time...
0
 

Author Comment

by:netslt
ID: 11890032
I know, I'll see that that will not happen!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now