OVH Cloud OVH Cloud

Ouvrir une page web sur un événement click ?

3 réponses
Avatar
Vince
Je voudrais ouvrir une page web dans internet explorer=20
sur l'=E9v=E9nement click d'un bouton ...=20

Comment dois-je m'y prendre ?

3 réponses

Avatar
Laurent Jordi \(www.ezlogic.mc\)
Salut,

Il y a plusieurs méthodes...

La plus simple est d'utiliser une commande shell

Dim X
X = Shell("explorer.exe http://www.ezlogic.mc", 4)

@+

LJ


"Vince" a écrit dans le message de
news:6a4101c483a6$0bbad560$
Je voudrais ouvrir une page web dans internet explorer
sur l'événement click d'un bouton ...

Comment dois-je m'y prendre ?
Avatar
Géo
Vince a écrit:
Je voudrais ouvrir une page web dans internet explorer
sur l'événement click d'un bouton ...

Comment dois-je m'y prendre ?




Déclare dans ton application l'API et la constante suivantes :

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
Const SW_NORMAL = 1

Puis, quand l'utilisateur clique sur un bouton ou un label, ajoute le
code suivant :

Private Sub Label1_Click()
Dim lngRep As Long
lngRep = ShellExecute(hwnd, "open", "http://www.go-soft.ch",
vbNullString, vbNullString, SW_NORMAL)
End Sub

Automatiquement, la connexion Internet sera lancée vers le site
pour un mail :

lngRep = ShellExecute(hwnd, "open",
"mailto:?Subject=Salut la compagnie !", vbNullString,
vbNullString, SW_NORMAL)

Amicalement


Géo
Avatar
ng
Salut,

Si c'est obligatoirement dans IE, tu peux aussi tester ceci :

Dim oIE As Object
Set oIE = CreateObject("InternetExplorer.Application")
Call oIE.Navigate("http://www.monsite.com")
oIE.Visible = True

--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
http://apisvb.europe.webmatrixhosting.net/



Vince a écrit :

Je voudrais ouvrir une page web dans internet explorer
sur l'événement click d'un bouton ...

Comment dois-je m'y prendre ?