Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

Link to open VB app

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
sacul
Asked:
sacul
  • 5
  • 5
1 Solution
 
sandip132Commented:
System.Diagnostics.Process.Start("mailto:astark1@unl.edu?subject=MailTo Comments&cc=ASTARK1@UNL.EDU,id@internet.node")

Happy Programming.
Sandip.
0
 
saculAuthor Commented:
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
 
shahprabalCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
saculAuthor Commented:

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
 
saculAuthor Commented:
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
 
shahprabalCommented:
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
 
saculAuthor Commented:
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
 
shahprabalCommented:
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
 
shahprabalCommented:
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
 
saculAuthor Commented:
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
 
shahprabalCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now