|
-
Apr 8th, 2002, 06:02 PM
#1
launch vb app as a third party helper app
This should be easy, but I don't know where to start.
Assuming someone has my helper app.... I would like the following operation.
When a link is clicked in a webpage, the linked file has an extension that automatically causes my application to launch and read in/operate on the file.
I've seen this functionality before and assume that the installation mechanism does two things:
1. register the file type as associated with my app
2. capture the 'clicked file' as a parameter or input stream for my app.
The operation would be like clicking an mp3 file and winamp starting. How can I make my VB app behave the same?
-
Apr 8th, 2002, 06:08 PM
#2
PowerPoster
This might help you, or it might not, depending on whether I read your question right: http://www.vbforums.com/showthread.p...hreadid=156194
-
Apr 8th, 2002, 07:39 PM
#3
Sounds close to what I want to do. I guess I still have questions.
1. About the references to Innosetup. Can I use vb to set the reg key, or do I need something like Innosetup?
2. Link parameter. I'd like to send the file in the URL to my program. Is there special javascript needed, or can I simply force the launch of my vb program and it will automatically accept the file as a parameter? (Or both?).
-
Apr 8th, 2002, 08:06 PM
#4
PowerPoster
1. You can use VB to do the registry stuff, you don't need innosetup. I just found it easier that way. Use the attached module to access the registry.
2. You will have to use a combo of either VB script or JavaScript with a helper ActiveX dll to shell your program, and then add the link URL or whatever to the end of the shell, so in your ActiveX dll:
Code:
<!-- this is in the html file !-->
<SCRIPT LANGUAGE = "VBScript">
Dim oWindow, oURL, oDocument, oEvent, oElement, oStorURL
Set oStorURL = CreateObject("AddIt.Adder") 'this is my dll (addit.dll) and my class is called Adder while my sub is called add
Set oWindow = window.external.menuArguments
Set oEvent = window.external.menuArguments.event
Set oDocument = window.external.menuArguments.document
Set oElement = oDocument.elementFromPoint(oEvent.clientX, oEvent.clientY)
if oElement.tagName = "A" then
oStorURL.add("StorURL.exe " & oElement.href)
end if
</SCRIPT>
And this is in your ActiveX Dll
VB Code:
Private Sub Add(theURL As String)
Shell App.Path & "\myapp.exe " & theURL
End Sub
And this goes in your main program:
VB Code:
Private Sub Form_Load()
If Command$ <> "" Then
'Do your code here, Command$ will contain the link
End If
'your other load stuff here
End Sub
Hope that helps a little better.
-
Apr 20th, 2002, 08:12 PM
#5
still stuck...
It looks simple enough, but I can't get it to work.
I've built the class and the a simple app, but I'm not sure where I'm messing up.
It took me several hours and I was finally able to download inno setup.
At least I think I know what I don't know:
1. use inno setup to register my dll
- I tried --> [Run}
Filename: "regsvr32 "; Parameters: "(sys}\addit.Dll"
- where my dll was called addit based on MidgetsBro's example
2. I tried to register the associations according to the innosetup faqs as such (no don't know if it worked):
Root: HKCR; Subkey: ".zzz"; ValueType: string; ValueName: ""; ValueData: "myapp"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "myapp"; ValueType: string; ValueName: ""; ValueData: "myapp"; Flags: uninsdeletekey
3. My guess is the dll and scripting are wrong. Since I don't know vbscript, I simple used MidgetsBro's script exactly, where I added extra html using the format:
<a href=http://url/myfile.zzz>Test link</a>
- where .zzz is the association extension that will launch my app; and only contains text at the moment
. myapp.exe is simple prints the command line parameters to the form. But it doesn't even launch the program, so the problem can't be there.
-
Apr 22nd, 2002, 11:55 PM
#6
narrower needs
It seems that my app now works and the file associations can cause my app to launch when the file is clicked on locally. I still need to make the app launch when a hyperlink is clicked. In a nutshell, here's the desired behavior.
1. Navigate to a page, with several links to files
2. Click on the link
3. My app automatically launches to open the file
More specifically, as an example:
1. Goto www.someurl.com
2. There's a link to a file <a href=http://someurl.com/file.isd>clickme</a>
3. Click the link, and a helper app automatically launches and process the file "file.isd"
I need this to work under IE and NSCP, so I guess if any scripting is needed, it should be javascript.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|