Results 1 to 10 of 10

Thread: [RESOLVED] Vb6 - how to (detect and) lauch default email program ?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2006
    Location
    Paris
    Posts
    301

    Resolved [RESOLVED] Vb6 - how to (detect and) lauch default email program ?

    Dears,

    as the title says but also without using additional controls if possible, that's cos I want to make all my programs free from any kind of dependacies as much as I can

    thanks, regards

  2. #2
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Smile Re: Vb6 - how to (detect and) lauch default email program ?

    Yes ,That is ok .but which type of programme you want to make .can you explain at bit ?.

  3. #3
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Vb6 - how to (detect and) lauch default email program ?

    This example shows how to launch default email client and default browser. It uses a button control but you can remove that and put the code in your Form_Load but then you have no control over it from one time to another so I think you will at least need a button and a textbox if you want to include the recipient,

    Code:
    Private 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
    
    Private Const SW_SHOWNORMAL = 1
    
    Private Sub Command1_Click()
     '
     ' Optional -----------------------------------+
     '                                             |
     ShellExecute 0&, vbNullString, "mailto:someone@somewhere.com", vbNullString, vbNullString, SW_SHOWNORMAL
    
     
     '
     ' For browser
     ' 
     'ShellExecute 0&, vbNullString, "http://www.google.com", vbNullString, vbNullString, SW_SHOWNORMAL
    End Sub
    Last edited by jmsrickland; Jun 18th, 2012 at 02:33 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  4. #4
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: Vb6 - how to (detect and) lauch default email program ?

    A bit more info on what you are trying to,achieve may help ?
    Do you really need to detect the default email program ?
    If you are wishing to open the user's default email program with say your email address as the recipient, you do not need to detect the default email program, you can let Windows handle that for you. You just use ShellExecute and pass it the email address, and it does the rest for you.

    If I am on the wrong track, providing more info would have avoided that.

    I will dig up an example, whilst awaiting your reply

    Rob
    PS I see someone else has taken a punt at guessing what your needs were, and has posted an example of that API call.
    Were we both right (in our guesses) ?

  5. #5
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Vb6 - how to (detect and) lauch default email program ?

    Quote Originally Posted by Bobbles View Post
    PS I see someone else has taken a punt at guessing what your needs were, and has posted an example of that API call.
    Were we both right (in our guesses) ?
    Correction: I didn't guess
    Last edited by jmsrickland; Jun 18th, 2012 at 02:30 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: Vb6 - how to (detect and) lauch default email program ?

    Quote Originally Posted by jmsrickland View Post
    Correction: I didn't guess
    Unless you have contacted horazio outside of this thread, you did guess - because there is absolutely nothing in his post to say (or even imply) that he wants to create a new email. It is a likely possibility, but far from being a certainty... there are lots of other reasons to open an email program.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2006
    Location
    Paris
    Posts
    301

    Wink Re: Vb6 - how to (detect and) lauch default email program ?

    I'm designing a "phone book" program and I want to add a lot of cool stuff.
    My programming skills are kinda basic and I'm sure there are thousands of phone book apps out there for free, but I still want to make my own.

    For example I want to doubleclick on a contact and it automatically launches the email to that contact, for instance.
    So yes, I need to auto-detect the default email software.

    Shellexecute from what I've seen here on yr replies seem to be pretty solid and quick to use.
    Last edited by horazio; Jun 18th, 2012 at 02:55 PM.

  8. #8
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: Vb6 - how to (detect and) lauch default email program ?

    horazio,
    It appears that this thread is resolved ?
    If so then you should mark it RESOLVED, using the Thread Tools menu.

    Sorry to 'nit pick' but it may help for your future threads.
    When you still say "So yes, I need to auto-detect the default email software" the use of the term "auto-detect" implies that your program needs to know (detect) the email program. Whereas all your program needs is the ability to "auto launch a new email", using whatever default method the user has previously set up..

    Si,
    Thanks for chipping in. I was stunned speechless there for a while.

  9. #9
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Vb6 - how to (detect and) lauch default email program ?

    Sorry about the confusing. I thought you meant I guessed at the code I posted but as I read what you posted better I see you said his requirements. Didn't mean to sound aggressive.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2006
    Location
    Paris
    Posts
    301

    Re: [RESOLVED] Vb6 - how to (detect and) lauch default email program ?

    OK I confirm shellexecutes is perfect for what I was lookin for.
    I also added reputation to yr answer .

    Thanks again.

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