Page 1 of 1

Webbrowser Toolbars

Posted: Mon Jul 12, 2010 9:10 pm
by Codex
ok so how to i add a toolstrip from a dll when it is running, like ie (internet explorer) or ff (firefox)

so lets say i have created the dll and then when my webbrowser is running i press browse for toolbars and i choose the dll i just made

so whats the code for browse and add; thats marked in Bold

hope u understand :)

Re: Webbrowser Toolbars

Posted: Tue Jul 13, 2010 12:25 am
by zachman61
ask codenstuff since he made the CnS browser with the addon feature which you could adapt

Re: Webbrowser Toolbars

Posted: Tue Jul 13, 2010 12:38 am
by mandai
I know I did a post about running applications directly from embedded resources a while back but it seems to have disappeared.

Anyway you could use it in the same way to run a selected function from a .Net dll/exe:

Note: this example would try to execute the Class1.test function with no parameters, from the file test.dll:
Code: Select all
    Private Sub btnRun_Click(sender As System.Object, e As System.EventArgs) Handles btnRun.Click

        Dim classAssembly As Assembly = Assembly.LoadFrom("test.dll")

        For Each t As Type In classAssembly.GetTypes()
            If t.IsClass Then

                If t.FullName = "Class1" Then

                    Dim instance As Object = Activator.CreateInstance(t)

                    Dim args As Object() = {} ' if your function takes parameters, put them in here

                    Dim result As Object = t.InvokeMember("test", BindingFlags.InvokeMethod, Type.DefaultBinder, instance, args)

                    Exit For
                End If

            End If
        Next

    End Sub

Re: Webbrowser Toolbars

Posted: Wed Jul 14, 2010 2:06 pm
by Codex
mandai can you help me step by step cause i dont get it?

i know i didnt say that in the first post, sorry

thanks

Re: Webbrowser Toolbars

Posted: Wed Jul 14, 2010 5:50 pm
by mandai
Ok step by step it would go like this:

1. Make the DLL library containing the public function. The function should return some useful objects such as a toolstrip control
2. Paste the above code into a function of your main project
3. Change the strings in the code to match what you want to run from your dll file (you would want to use the data that the function returns).