Solved

Link to open VB app

Posted on 2006-10-26
11
195 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
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…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

12 Experts available now in Live!

Get 1:1 Help Now