CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: web link

  1. #1
    Join Date
    May 2001
    Location
    MO, USA
    Posts
    87

    web link

    how do i add a html link to a menu control...for contact info in the help section on a menu...i have seen other apps use this function but i cant seem to find out how to do this....

    thanx in advance

    midnightservice


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: web link

    You can use The ShellExecute API for this

    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 Command1_Click()

    ShellExecute me.hwnd, "open", "http://www.codeguru.com", "", "", 0

    End Sub




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    Feb 2000
    Location
    Indianapolis, IN
    Posts
    123

    Re: web link

    Or you could simply use the Shell function in VB:


    Shell "C:\Program Files\Internet Explorer\iexplore.exe http://www.microsoft.com", vbNormalFocus





  4. #4
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: web link

    Only if that's the path to internet explorer. Using ShellExecute, you will always use the default browser (could be Netscape or Opera as well), and don't have to worry about the path.

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  5. #5
    Join Date
    Sep 2001
    Posts
    1

    Re: web link

    Great, I was just looking for that.

    Regards,

    Jim Jackson

  6. #6
    Join Date
    Apr 2003
    Posts
    322

    Re: web link

    [QUOTE=Cakkie]You can use The ShellExecute API for this

    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 Command1_Click()

    ShellExecute me.hwnd, "open", "http://www.codeguru.com", "", "", 0

    End Sub

    Cakkie-

    Using this code, How do I make a clickable link on a form ?
    I would like the Link to work just like on an HTML page- that is, when the use clicks the link on the form, it launches a web browser to the URL.
    Last edited by cappy2112; September 23rd, 2004 at 07:37 PM. Reason: typoes

  7. #7
    Join Date
    Aug 2003
    Location
    India
    Posts
    81

    Red face Re: web link

    Quote Originally Posted by tobeyu
    Or you could simply use the Shell function in VB:


    Shell "C:\Program Files\Internet Explorer\iexplore.exe http://www.microsoft.com", vbNormalFocus
    Well, officially this will not work because if the end user is using Drive D: as his/her primary drive then it will face problems.


    Shell ("start http://www.helloindia.tk") would rather work


    also u can follow wot cappy suggested.

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