[2005] Make a program start up another program and preform action
Well, ok, il try to explain as best as I can.
I have created this tabbed based web browser, and with this i am going to create some plug-ins, like various search plug'ins etc. What i need to know though, is, lets say i have a directory in my web browser install dir called "plugins", and there i have exe's of small plugin programs ive made. Now, how would the command be, on these plugins to make the webbrowser navigate?
Now i only have:
Code:
System.Diagnostics.Process.Start("http://911tabs.com/search.php?search=" + TextBox1.Text + "&type=band")
and this opens up in the default web browser, I want it to show up in my own web browser..
Cheers!
Re: [2005] Make a program start up another program and preform action
VB Code:
Process.Start("YourAppPath", "http://911tabs.com/search.php?search=" + TextBox1.Text + "&type=band")
'in your application put
If Environment.GetCommandLineArgs.Length > 0 Then
WebBrowseObject.navigate(Environment.GetCommandLineArgs(0))
End If
Re: [2005] Make a program start up another program and preform action
Thank you! Another question though, what would be the easiest way to set the application path concidering the plugin is in a subfolder in the application folder.
/folder/application.exe
/folder/plugins/plugin.exe
I would like not to use "c:\program files\folder\application.exe" because it may differ from computer to computer.
Cheers!
Re: [2005] Make a program start up another program and preform action
Store your executable in the registry
VB Code:
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\YourCompany\AppName", True).SetValue("ExePath", Application.ExecutablePath)
And read them anytime you want
VB Code:
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\YourCompany\AppName", False).GetValue("ExePath")
Re: [2005] Make a program start up another program and preform action
Thanks loads. For some reason though, it only results in my webbrowser application being opened, but it doesnt navigate anywhere.. will fiddle around a bit and see if I can fix it! Thanks so much.
EDIT: Just to double check, where in my code should i put
Quote:
If Environment.GetCommandLineArgs.Length > 0 Then
w.Navigate(Environment.GetCommandLineArgs(0))
End If
Re: [2005] Make a program start up another program and preform action
in the Load event handler of your main form (the browser)
or in the Sub Main() if you have one
Re: [2005] Make a program start up another program and preform action
Yeh, but thinking this is a webbrowser, the main form is already loaded as the plugin is accessible from the webbrowser itself, so unless the webbrowser application is closed it wont work.. Sorry for being such a newbie.
EDIT: When placed in the Load event, when the form loads normally (Without the plugin command) then the browser navigates to my .exe file and prompts me to download it :P)
Re: [2005] Make a program start up another program and preform action
it's okay, no problem....
But if the program is already loaded and the plug-in is accessible from the program itself, then make it do the work directly.
you only have to put the plug-in and the app in the same NameSpace.
Re: [2005] Make a program start up another program and preform action
hmm, ok, i will try, but i guess i would like it to work the other way, because i may wanna make it easy to make plugins which you can just put in the pluginfolder yourself without actually having to put it in the application, if you see what I mean? And btw, i have no idea how to put the plugin (which is a normal project) into another project (the webbrowser)
Re: [2005] Make a program start up another program and preform action
Quote:
Originally Posted by Untouchab1e
hmm, ok, i will try, but i guess i would like it to work the other way, because i may wanna make it easy to make plugins which you can just put in the pluginfolder yourself without actually having to put it in the application, if you see what I mean? And btw, i have no idea how to put the plugin (which is a normal project) into another project (the webbrowser)
Not in another project, just use the same NameSpace for both projects.
Re: [2005] Make a program start up another program and preform action
Hmm, i feel utterly stupid right now, but ive never done anything like this before..
What namespace are you referring to? Could you give me an example? And what do you mean by "Put the program in the app"?
Really appreciate it!
Re: [2005] Make a program start up another program and preform action
Quote:
Originally Posted by Untouchab1e
Thank you! Another question though, what would be the easiest way to set the application path concidering the plugin is in a subfolder in the application folder.
/folder/application.exe
/folder/plugins/plugin.exe
I would like not to use "c:\program files\folder\application.exe" because it may differ from computer to computer.
Cheers!
Application.Startuppath will return the path to the exe.
So you can get your plugins folder like so
VB Code:
Dim PluginPath as String = application.Startuppath & "\plugins\"
and it will always be right no matter where the user installed the application.
I would also stay away from the registry and use an XML file that is local the the app. This makes the app very easy to move. You could simply copy the entire folder from one PC to the other and it will work. No need to copy registry entires and such. Also working with the registry opens up a can of permissions worms. Sure it works fine on your machine, but that is because your machine is running the .NET framework at full trust. Another system may only be running at partial trust, and the registry is one of the things limited by that.
Re: [2005] Make a program start up another program and preform action
Quote:
Originally Posted by kleinma
I would also stay away from the registry and use an XML file that is local the the app. This makes the app very easy to move. You could simply copy the entire folder from one PC to the other and it will work. No need to copy registry entries and such.
You are right about the permissions thing, but reg values are set at run-time, so you still can copy the folder to another computer nothing will happen
Re: [2005] Make a program start up another program and preform action
Quote:
Originally Posted by ComputerJy
You are right about the permissions thing, but reg values are set at run-time, so you still can copy the folder to another computer nothing will happen
I was just speaking in general terms. I used to use the registry a lot, because it was pretty easy to use, and seemed to be the "norm" for applications. However using XML files located in the applications directory, or for individual user profile use, the Application Data in documents and settings, is a lot easier to work with.
Re: [2005] Make a program start up another program and preform action
I am still really unsure about how to actually make this plugin\browser thingie work! Can anyone help? :)
Re: [2005] Make a program start up another program and preform action
Sorry for the bump, but there must be some sort of solution? Thanks a million!