CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    7

    How to add an url to a msgbox

    I wonder if anybody can give som info on how to add an internet url to a message box. I just want
    to display a simple message that contains an internet adress that the user may klick on and automatically he will be directed to that page via his/her browser.

    Probably very simple...


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: How to add an url to a msgbox

    That is how you can do it with a label



    'To Put a hyperlink in your program:

    '1. In Declarations, declare shell32.dll (and remember to distribute this with your app_
    ' 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

    '2. Put a label control on your VB form

    '3. Set the following properties to the label control
    ' Font color = blue
    ' Font Unterlined
    ' Font Bold
    ' Allignment = 2 - Center
    ' Caption = What ever you like, but something that describes the webpage you are taking to user to
    ' Mousepointer = 99 (custom) ( hand)
    ' MouseIcon = "C:\Program Files\Microsoft Visual Studio\Common\graphics\Cursors\H_point.cur"
    ' ** there may be some variation on where this .cur file is on your system, use the Win search to locate it ***

    '4 In the click event of the label, enter...
    ' ShellExecute hWnd, "open", "http://www.YourWebSite.com", vbNullString, vbNullString, conSwNormal
    ' substituting "http://www.YourWebSite.com" with the URL of the webpage you want the user to go


    'example---------------
    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 Sub Label1_Click()
    ShellExecute hWnd, "open", "http://www.planet-source-code.com", vbNullString, vbNullString, conSwNormal
    End Sub


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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

Featured