Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Link to open VB app

Posted on 2006-10-26
11
214 Views
Last Modified: 2010-08-05
Hello Experts,

I have an application that sends out an email through M$ Outlook. It notifies the recipient that a change has happened and asks them to login and check the change. Is there a way to have the exe open when the link is clicked in the email and also pass some data to the app, lets say a number to appear in a text box?

I have the app sending the email no problem. I just want to open the app and pass it a value from the email once the link is clicked.

Is this doable?

Thank you,
Zac
0
Comment
Question by:sacul
  • 5
  • 5
11 Comments
 
LVL 12

Expert Comment

by:sandip132
ID: 17817413
System.Diagnostics.Process.Start("mailto:astark1@unl.edu?subject=MailTo Comments&cc=ASTARK1@UNL.EDU,id@internet.node")

Happy Programming.
Sandip.
0
 
LVL 1

Author Comment

by:sacul
ID: 17820319
Hello,

I think the code above starts the outlook editor. What I meant was after the email has been sent create a link in the email that starts a VB app.

so the email would look like this

"There was an update to the program. Please click the link.
C:\app.exe"

and by clicking the C:\app.exe link the vb app would start.

Thank you,
Zac
0
 
LVL 14

Expert Comment

by:shahprabal
ID: 17820630
This is doable if the email recepient is on the same Intranet (LAN) as the app. So if the app resides on a server on a shared drive which all of the client computers map as P: then the email can contain the shared drive followed by the app name eg: P:\\WinApp.exe

As far as passing data to it goes... you should be able to pass command parameters to the app and retrive it... eg: P:\\WinApp.exe User:xyz Error:123

Use the following code to get the values :

m_strUser = Mid(GetCommandLineArgs(0), 6)
m_strError = Mid(GetCommandLineArgs(1), 6)

    Public Function GetCommandLineArgs() As String()
        ' Declare variables.
        Dim separators As String = " "
        Dim commands As String = Microsoft.VisualBasic.Command()
        Dim args() As String = commands.Split(separators.ToCharArray)
        Return args
    End Function
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:sacul
ID: 17821243

Hello,

The app is installed on each users local computer. This is the the code I used to get the app running

        Dim objOutlook
        Dim objOutlookMsg
        objOutlook = CreateObject("Outlook.Application")
        objOutlookMsg = objOutlook.CreateItem(0)

        Dim testStr As String = System.Web.HttpUtility.UrlPathEncode("C:\app.exe")

        With objOutlookMsg
            .To = "address@domain.com"
            .Subject = "Test"
            .HTMLBody = "TEST " & "<a href=" & testStr & "> TEST </a>"
         
            Try
                .Send()
                MessageBox.Show("Your request is being processed.")
            Catch default as Exception
                MessageBox.Show(default.Message)
                Exit sub
            End Try
        End With

I am not sure what this part does though,

"Use the following code to get the values :

m_strUser = Mid(GetCommandLineArgs(0), 6)
m_strError = Mid(GetCommandLineArgs(1), 6)

    Public Function GetCommandLineArgs() As String()
        ' Declare variables.
        Dim separators As String = " "
        Dim commands As String = Microsoft.VisualBasic.Command()
        Dim args() As String = commands.Split(separators.ToCharArray)
        Return args
    End Function"

Thank you,

Zac
     
0
 
LVL 1

Author Comment

by:sacul
ID: 17821353
Hello,

This part gives me an error.

C:\app.exe User:xyz Error:123

It says the file cannot be found.

Thank you,
Zac
0
 
LVL 14

Expert Comment

by:shahprabal
ID: 17843912
Zac the code I had included was to read values from the parameters (user and error values). Assuming the path in the email is correct I would guess the issue is security related...  I haven't played with opening apps through outlook so you would need to play a little with it and see if works if :

1) The app is located in a shared folder.
2) The system has access to the folder that app is located in.
3) The user is running as an admin.
4) Try sending a link to a shortcut for the app and not to the app itself.

HTH
good luck
0
 
LVL 1

Author Comment

by:sacul
ID: 17850772
Hello shahprabal ,

I did try to play around with it a little. I am running as an administrator on my PC and the app is running local on this pc. What I don't understand is how to pass the parameters from the click-able link.

"you should be able to pass command parameters to the application and retrieve it... eg: P:\\WinApp.exe User:xyz Error:123"

My click-able link is "C:\app.exe User:xyz" Error:123" but I think it is looking for a path that has the full name "C:\app.exe User:xyz Error:123" in it. I can get it running no problem with "C:\app.exe" but I don't understand how to pass the parameters since "C:\app.exe User:xyz Error:123" alters the path and makes the link point to something doesn't exist.

Do you know of any references on the web where I can read up more on the topic?

Thank you,
Zac
0
 
LVL 14

Expert Comment

by:shahprabal
ID: 17850935
Ok... If the parameters are causing the problem the quick fix I can think of (this works only if the values you want to supply don't vary) is that you create a shortcut for the app and include the parameters in the target. eg:
"C:\app.exe" User:xyz Error:123

So if you only have 5 different values for error then you would need 5 shortcuts (user value would be same in all the shortcuts). I know this is not ideal and will try to find something better.
0
 
LVL 14

Accepted Solution

by:
shahprabal earned 500 total points
ID: 17857797
Another way could be using a batch file... you get the variables in the batch file and pass it to the app... check out...

http://www.windowsitpro.com/Article/ArticleID/13443/13443.html

and

http://www.daniweb.com/techtalkforums/thread56670.html
0
 
LVL 1

Author Comment

by:sacul
ID: 17937720
Hello,

I am sorry I took so long to accept. I have been reading up on the two links that you posted. I am not very good with batch files so I have to get some more info on how to get it set up.

Thanks for all the help.

Zac
0
 
LVL 14

Expert Comment

by:shahprabal
ID: 17939936
No problem. I did search for a better option but didn't come across any... logic says there has to be a way... I don't use batch files much anymore either... but if you have follow-up qts please let me know... also if you get it working do post it. Thanks for the grade.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question