URGENT ::::: Comment savoir si iexplorer est deja ouvert ???
theenjoy
Messages postés11Date d'inscriptionvendredi 27 octobre 2000StatutMembreDernière intervention26 août 2002
-
20 août 2002 à 00:24
TheSpyMan
Messages postés13Date d'inscriptionmercredi 23 janvier 2002StatutMembreDernière intervention 2 mars 2003
-
20 août 2002 à 21:56
Comment faire pour savoir si iexplorer.exe est ouvert ou non ????
cs_raff
Messages postés182Date d'inscriptiondimanche 18 août 2002StatutMembreDernière intervention 5 janvier 20043 20 août 2002 à 01:56
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
tu dois connaître la className de iexplorer et le nom de la fenêtre mais bon, si tu te débrouilles avec ça, tu peux avoir un return value qui te permette de savoir si explorer run ou non.
cs_raff
Messages postés182Date d'inscriptiondimanche 18 août 2002StatutMembreDernière intervention 5 janvier 20043 20 août 2002 à 03:04
j'ai trouvé c'est "IEFrame". Le problème ici c'est que tu dois savoir le caption de la fenêtre. si fais
v = findWindow("IEFrame", "Caption") alors ça retourne le handle de la fenêtre (je crois). Tu ne peux pas mettre "*" ça ne marche pas. Il existe un moyen cependant de le faire seulement avec le class name, faudrait que tu regardes sur msdn...
raff
TheSpyMan
Messages postés13Date d'inscriptionmercredi 23 janvier 2002StatutMembreDernière intervention 2 mars 2003 20 août 2002 à 17:32
Voila une methode pour savoir si une fenetre IE est ouverte
' Dans la form
Private Sub Timer1_Timer()
Dim IeOrnotIe
IeOrnotIe = GetText(findIEname)
If IeOrnotIe <> "" Then
' Code si fenetre ouverte
Else
' Code si fenetre non ouverte
End If
End Sub
Module :
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function findwindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function sendmessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Public Const wm_gettext = &HD
Public Const WM_GETTEXTLENGTH = &HE
Public Const WM_CLOSE = &H10
Public Function GetText(WindowHandle As Long) As String
Dim Buffer As String, TextLength As Long
TextLength& = sendmessage(WindowHandle&, WM_GETTEXTLENGTH, 0&, 0&)
Buffer$ = String(TextLength&, 0&)
Call SendMessageByString(WindowHandle&, wm_gettext, TextLength& + 1, Buffer$)
GetText$ = Buffer$
End Function
Public Function findIEname() As Long
' Renvoie le nom de la fenetre IE
ie& = findwindow(IEframe, vbNullString)
findIEname& = ie&
End Function
Voila, Bonne prog.
8-)
Vous n’avez pas trouvé la réponse que vous recherchez ?