Jump to content

Duvidas em Vb6


vaurdan
 Share

Recommended Posts

Tiago Salgado

Aqui tens uma forma, não sei se é a mais simples...mas é a única que tenho usado até agora.

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

Public Function OpenBrowser(ByVal URL As String) As Boolean
    Dim res As Long
    
    If InStr(1, URL, "http", vbTextCompare) <> 1 Then
        URL = "http://" & URL
    End If
    
    res = ShellExecute(0&, "open", URL, vbNullString, vbNullString, _
        vbNormalFocus)
    OpenBrowser = (res > 32)
End Function

Private Sub Command1_Click()
Call OpenBrowser("www.portugal-a-programar.org")
End Sub
Link to comment
Share on other sites

Tiago Salgado

e ponho isso no Sub Private Command1_Click ?

Poes apenas a chamada da função no command1_click ou entao onde quiseres...o resto é a declaraçao da API e da funçao openbrowser()

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.