#1
  1. No Profile Picture
    MCP
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    Canada
    Posts
    66
    Rep Power
    18

    Question Placing a hyperlink onto a form in VB6?


    I'd like to place a hyperlink onto a form in VB6, such that my program will display something like:

    "Created by xyz software",
    where clicking on "xyz software" would launch the system's default browser and open http://www.xyzsoft.com/

    AND/OR

    "Created by some.guy@somewhere.com",
    where clicking on the e-mail address would launch the system's default mail client and address an e-mail to that address (same as a WWW mailto: link).

    I've seen this done in multiple Windows programs but haven't really been able to figure out what controls I should use to get it done.

    If anyone would point me in the right direction, it would be much appreciated...

    Shawn A. Curnew, MCP
  2. #2
  3. No Profile Picture
    MCP
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    Canada
    Posts
    66
    Rep Power
    18
    Time to answer my own question, courtesy of visualbasicforum.com...

    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

    Then:

    ShellExecute Me.hwnd, "open", "http://www.yourname.com/", vbNullString, "", 0

    Or for an e-mail addy:

    ShellExecute Me.hwnd, "open", "mailto:addy@domain.com", vbNullString, "", 0

    And some very thorough documentation on ShellExecute:
    http://www.mentalis.org/apilist/ShellExecute.shtml

    Hope someone finds it useful,
    Shawn A. Curnew, MCP
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Windsor ON, Canada
    Posts
    462
    Rep Power
    18
    looks like you learned to research as well
  6. #4
  7. No Profile Picture
    MCP
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    Canada
    Posts
    66
    Rep Power
    18
    Hey, I DID do a forum search here before asking the question... I just didn't find the other website until after it had been posted.

    Shawn A. Curnew, MCP
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Windsor ON, Canada
    Posts
    462
    Rep Power
    18
    it was just a joke. no need to take me seriously
  10. #6
  11. No Profile Picture
    MCP
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    Canada
    Posts
    66
    Rep Power
    18
    I didn't... thus the tongue.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Windsor ON, Canada
    Posts
    462
    Rep Power
    18
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Fort Worth, Tx(against my will)
    Posts
    4
    Rep Power
    0

    Thank You


    Thank you Shawn for both asking your question and then answering it. I was looking everywhere for that! I was inserting an ole object (internet explorer) and activating it fro a button or whatever by using "ole1.action = 7" with the url in the command line of the ole object. I new there had to be a better way but I had a hard time finding it. I'm just a beginer

    Thanks!

    Ken
  16. #9
  17. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    797
    You can also do this with the Shell() function.
    i.e.
    Shell("c:/path/to/iexplore.exe http://www.devshed.com")
  18. #10
  19. No Profile Picture
    MCP
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    Canada
    Posts
    66
    Rep Power
    18
    Hi Onslaught!

    Thanks for the suggestion. Mind you, that kind of hard coding is what I was trying to avoid...

    If you're running an internal Intranet with uniformly configured computers it's great; but otherwise I'd point out that:
    - not everyone's going to have Windows installed to the same paths/partitions;
    - there's no guarantee where the MSIE exe will be in the "next" version of Windows; and
    - unfortunately not all users have MSIE set as their default browser.

    Although it's a bit more work, I'd rather just pass Windows the call the open the document, and let it figure out what program to run.

    S A Curnew, MCP
  20. #11
  21. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    797
    I agree that it is best to just let windows figure it out, but (unfortunately) Internet Exploder will always be bundled with winblows
  22. #12
  23. No Profile Picture
    MCP
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    Canada
    Posts
    66
    Rep Power
    18
    I hardly consider that unfortunate... At least while the copy of Windows is modern, it saves me a download.

    S A Curnew, MCP
  24. #13
  25. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    797
    I guess I should have stated IHMO
    I prefer Mozilla over IE
  26. #14
  27. No Profile Picture
    MCP
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    Canada
    Posts
    66
    Rep Power
    18
    I don't. Which just makes it sort of ironic that yours was the code which would tie the user to MSIE.

    Have a good one,
    S A Curnew, MCP
  28. #15
  29. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    797
    The is reason behind such madness believe it or not.
    I know that the majority of people use exploder instead of other browsers (I won't go into a rant) so I basically put example code as to what people are use to. Most typical VB programmers use IE since it falls into tools that they have at thier disposal, hence I stick with examples (unless requested otherwise) to what the majority is use to.

IMN logo majestic logo threadwatch logo seochat tools logo