Results 1 to 16 of 16

Thread: [2005] Make a program start up another program and preform action

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    115

    [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!

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [2005] Make a program start up another program and preform action

    VB Code:
    1. Process.Start("YourAppPath", "http://911tabs.com/search.php?search=" + TextBox1.Text + "&type=band")
    2.         'in your application put
    3.         If Environment.GetCommandLineArgs.Length > 0 Then
    4.             WebBrowseObject.navigate(Environment.GetCommandLineArgs(0))
    5.         End If
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    115

    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!

  4. #4
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [2005] Make a program start up another program and preform action

    Store your executable in the registry
    VB Code:
    1. Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\YourCompany\AppName", True).SetValue("ExePath", Application.ExecutablePath)
    And read them anytime you want
    VB Code:
    1. Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\YourCompany\AppName", False).GetValue("ExePath")
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    115

    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
    If Environment.GetCommandLineArgs.Length > 0 Then
    w.Navigate(Environment.GetCommandLineArgs(0))
    End If
    Last edited by Untouchab1e; Aug 28th, 2006 at 04:15 PM.

  6. #6
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    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
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    115

    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)
    Last edited by Untouchab1e; Aug 28th, 2006 at 04:42 PM.

  8. #8
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    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.
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    115

    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)
    Last edited by Untouchab1e; Aug 28th, 2006 at 04:52 PM.

  10. #10
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    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.
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    115

    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!

  12. #12
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

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

  13. #13
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    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
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  14. #14
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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.

  15. #15

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    115

    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?

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    115

    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width