Link to home
Start Free TrialLog in
Avatar of netslt
netslt

asked on

make internet explorer toolbar/button

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

Avatar of Daniellus83
Daniellus83
Flag of Netherlands image


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.

Ah,.... are you still interrested in this toolbar in IE ??
Avatar of netslt
netslt

ASKER

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 https://www.experts-exchange.com/questions/20890485/Adding-a-program-to-Internet-Explorer-toolbar.html ), I was hoping someone had migrated them to vb.net - ???


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 ...
Avatar of netslt

ASKER

OK, I see that you deserve more points for this... hope you make it!
Avatar of netslt

ASKER

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...
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...

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!
Avatar of netslt

ASKER

Thanks...
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
Avatar of netslt

ASKER

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!
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!
Avatar of netslt

ASKER

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?
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)

...And,.. did it work out?
Avatar of netslt

ASKER

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)?
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.
ASKER CERTIFIED SOLUTION
Avatar of Daniellus83
Daniellus83
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of netslt

ASKER

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!
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.
And... did you have succes?
Avatar of netslt

ASKER

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.
Okay, but don't forget the solution might get flushed after some time...
Avatar of netslt

ASKER

I know, I'll see that that will not happen!