Results 1 to 10 of 10

Thread: Adding to Internet Explorer Right Click

  1. #1

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125

    Adding to Internet Explorer Right Click

    I have found how to add a menu item to the right click menu, when you right click on a link in Internet Explorer, using the registry, and I know how to make it do something when clicked, but I don't know how do do what I want. I want to use VBScript, which is how you make the menu item do something, to shell my program and send the selected link to my program. I've looked at a few scripts I have from other programs, like the Download Accelerator Plus script, but that uses JavaScript, and an activeX dll, which I don't know how to use. I've figured out how to get the selected link's URL, using the .href property, but now I want to know how to open my program. Is there a way to shell my program with VBScript?

    Thanks
    Joey

    (If I didn't make my self clear -- which I'm pretty sure I didn't -- just post a reply if you think you can help)
    <removed by admin>

  2. #2
    Fanatic Member Redth's Avatar
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    551
    i think know exactly how to help you...

    it's kinda lengthy to explain here right now as i'm going to sleep in a minute.. .but i will tell u i know how to do it ...

    i will hafta dig up some older code... i used this on my program... serial vault.... which can be downloaded on cnet...

    took me lot of searching and asking around

    but what my program does, is u right click any selected text in internet explorer, and click the new right click menu entry that my program added, then it takes the selected text from Internet explorer and adds it to the command line whilst shelling my app.. then my app picks it up off the command line and voila!!!

    is this basically what you're trying to do?


    to shell your program through vbscript you will need to make a launcher dll.. basically a dll that shells the app that u can call through vbscript

    not too tough...

    i'll post some code and such tomorrow..

  3. #3
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    I am not sure if this will help, but here is an example of how you can add links to IE contex menu, using plain Javascript.

    http://www.vbforums.com/showthread.p...hlight=context

    Hope this helps.

    Danial
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  4. #4

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    Thanks, but I'm not adding them to Internet Explorer. I am trying to add them to my program, called StorURL, which is a bookmark manager. I'm pretty sure Redth knows what I want, I'll just wait for him to reply.
    <removed by admin>

  5. #5
    Fanatic Member Redth's Avatar
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    551
    ok sorry man..

    was at school

    ok.. i can't find the source to the dll i made... but i'll try to make it up again...


    umm in the meantime if u wish, u can contact me on icq or msn or aim....


    22921863
    [email protected]
    Redth@MotoX2

    be back with some code in a bit

  6. #6
    Fanatic Member Redth's Avatar
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    551
    Ok... here it goes....

    create a new active X Dll project


    ok...

    name the project "Launcher" and the class "MyLauncher"

    now paste this code into the class:

    VB Code:
    1. Public Sub Launch(PathName As String)
    2.     'Shell the Path that was passed to the dll
    3.     Shell (PathName), vbNormalFocus
    4. End Sub

    this makes a sub that of course shells it...

    that's it for the dll.. you can compile it and put it in the windows\system32 directory... now make sure you register it (run "REGSVR32 C:\Windows\System32\MyLauncher.Dll")

    that's that...

    now to call it with the selected text, i have a javascript example.. i had a vbscript example but it seems to have disappeared...

    umm.. you said you already had the vbscript to get the selected value... so if u have that... this is how you should call the object from vbscript:

    VB Code:
    1. Dim objLauncher
    2.  
    3. 'create instance of the launcher activex dll
    4. Set objLauncher = System.CreateObject("Launcher.MyLauncher")
    5.  
    6. 'call the launch function, providing the path to the file to launch
    7. objLauncher.Launch("C:\Program Files\My Program\MyProgram.exe " & varSelectedText)
    8.  
    9. 'Clean up object when we're finished
    10. Set objLauncher = Nothing


    that's about all there is to it...

    now of course you probly won't know the installed path of your application, so you might want to add a Public Function to your dll project that gets the installed path from a registry value or something...

    example:

    VB Code:
    1. Public Function InstallPath() As String
    2.     InstallPath = GetSetting("MyProgram", "InstallPath", "Path")
    3. End Sub


    so your whole project will look like:

    VB Code:
    1. Public Sub Launch(PathName As String)
    2.     'Shell the Path that was passed to the dll
    3.     Shell (PathName), vbNormalFocus
    4. End Sub
    5.  
    6. Public Sub InstallPath()
    7.     InstallPath = GetSetting("MyProgram", "InstallPath", "Path")
    8. End Sub


    and to do this with the installpath function in vbscript go:

    VB Code:
    1. Dim objLauncher
    2. Dim varInstallPath
    3.  
    4. 'create instance of the launcher activex dll
    5. Set objLauncher = System.CreateObject("Launcher.MyLauncher")
    6.  
    7. 'fill variable with the install path to your program retrieved from the dll...
    8. varInstallPath = objLauncher.InstallPath()
    9.  
    10. 'call the launch function, providing the path to the file to launch
    11. objLauncher.Launch(varInstallPath & "\MyProgram.exe " & varSelectedText)
    12.  
    13. 'Clean up object when we're finished
    14. Set objLauncher = Nothing




    this should do what you need it to do...
    note, in both vbscript examples varSelectedText is a variable containing the string that your existing code has already retrieved

    umm what else... i guess security could be an issue.. you might want to just send the path and not full path with filename to object so that not just any program can be shelled with this object....

    hope this works for you... give it a go.... contact me if u need any more help...

  7. #7

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    Thanks! That works great, now I have a small problem. I can't figure out how to set the default value of a registry key. I can save my own string values, but I need to save into the (Default) value the path to my application. I figured out how to add keys using InnoSetup, but it doesn't let me change the default value. I tried making my own called (Default) like the one in the registry, but it doesn't overwrite it, it just makes a new one. Do you know how to do this with VB code? I'll just have it register itself when the program first starts up, and have the user restart their browser.

    Thanks again
    -Joey
    <removed by admin>

  8. #8
    Fanatic Member Redth's Avatar
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    551
    VB Code:
    1. Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\MenuExt\Add to &Serial Vault"; ValueType: string; ValueData: "{app}\sVaultRun.htm"
    2. Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\MenuExt\Add to &Serial Vault"; ValueType: binary; ValueName: "Contexts"; ValueData: "10"


    that is how i did it in innosetup.... that works fine, it makes it the default value... i remember, i had the same problem as you

    first key makes it point to the program to run when the option is clicked.. in my case, the program was a webpage actually... of course the "{app}" is innosetup code to insert that install path...

    second key tells it what context menu to appear on... 10 i think is selected text... or it could be selected text in a textbox.. not sure...

    hope that helps..

  9. #9

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    Thanks so much. The DWORD value I need, is 22, which is for links. Now, though, I am having a new problem. The code works fine for me, because I am running Win2K, but when I tried to use my launcher program on a Win98 machine, it said it could not create the ActiveX object. Do they have to have something turned on in IE or something similar?
    <removed by admin>

  10. #10
    Fanatic Member Redth's Avatar
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    551
    u make sure that your launcher dll is getting registered on that win98 machine? needs to be otherwise you'll get that error....

    heh lets hope that's all it is... if that isn't it, im not really sure what the problem is...

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