Solved

Link to open VB app

Posted on 2006-10-26
11
183 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
 
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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 …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now