Results 1 to 3 of 3

Thread: Email

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    I would like to put my E-mail address in About form of my program, and I don't know how to do it so when user clicks label with E-mail address on it it will automatically launch for example Microsoft Outlook (or any other "mailing" program)
    Thanks

    ------------------
    Visual Basic Programmer
    -----------------
    PolComSoft
    You will hear a lot about it.


  2. #2
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    In .bas module:
    Code:
    Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    Dim success As Integer
    
    Function ShellToBrowser%(Frm As Form, ByVal URL$, ByVal WindowStyle%)
             Dim api%
                 api% = ShellExecute(Frm.hwnd, "open", URL$, "", App.Path, WindowStyle%)
          
             'Check return value
             If api% < 31 Then
                 'error code - see api help for more info
                 MsgBox App.Title & " had a problem running your web browser." & _
                   "You should check that your browser is correctly installed." & _
                   "(Error" & Format$(api%) & ")", 48, "Browser Unavailable"
                 ShellToBrowser% = False
             ElseIf api% = 32 Then
                 'no file association
                 MsgBox App.Title & " could not find a file association for " & _
                   URL$ & " on your system. You should check that your browser" & _
                   "is correctly installed and associated with this type of file.", 48, "Browser Unavailable"
                 ShellToBrowser% = False
             Else
                 'It worked!
                 ShellToBrowser% = True
          
             End If
             
    End Function
    Public Sub LaunchEmail(EMail As String, frm As Form)
    	success% = ShellToBrowser(frm, "mailto:" & EMail, 0)
    End Sub
    And then in the form code:

    Code:
    Private Sub Label1_Click()
    LaunchEmail "[email protected]", Me
    End Sub
    Try that.

    ------------------
    Tom Young, 14 Year Old
    [email protected]
    ICQ: 15743470
    AIM: TomY10
    PERL, JavaScript and VB Programmer

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    Thanks

    ------------------
    Visual Basic Programmer
    -----------------
    PolComSoft
    You will hear a lot about it.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width