cs_Jack
Messages postés14006Date d'inscriptionsamedi 29 décembre 2001StatutModérateurDernière intervention28 août 201579 7 févr. 2006 à 17:53
Salut
Personnellement, cette requète fonctionne :
Do While IsWindowEnabled(hWnd) = 0
DoEvents
Loop
J'attends l'ouverture de NotePad.
Est-ce différent avec IE, je ne pense pas ...
Vala
Jack, MVP VB
NB : Je ne répondrai pas aux messages privés
Le savoir est la seule matière qui s'accroit quand on la partage. (Socrate)
cs_JMO
Messages postés1854Date d'inscriptionjeudi 23 mai 2002StatutMembreDernière intervention24 juin 201827 7 févr. 2006 à 18:31
Bonsoir,
Exemple testé avec fenetre IE.
Par contre, moi, je ne sais pas imposer une fenetre (handle ou ID).
Dim objExplorer
Set objExplorer = CreateObject("InternetExplorer.Application")
' ################## AFFICHER UNE FENETRE D'INFORMATION
strComputer = "."
Set objWMIService = GetObject("Winmgmts:\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Left = (intHorizontal - 800) / 2
objExplorer.Top = (intVertical - 100) / 2
objExplorer.Width = 750
objExplorer.Height = 220
objExplorer.Visible = 1
objExplorer.Document.Body.Style.Cursor = "wait"
objExplorer.Document.Title = fic & " - " & Now
objExplorer.Document.Body.InnerHTML = "
Création du fichier
""" &_
fic & """
en cours , merci de patienter.
"
Dim MyValue, Response, cpt
cpt = 0
Randomize ' Initialise le générateur de nombres aléatoires.
Do Until objExplorer.Document.Body.Style.Cursor <> "wait"
MyValue = Int((6 * Rnd) + 1) ' Génère une valeur aléatoire entre 1 et 6.
MsgBox MyValue
cpt = cpt + 1
If cpt = 10 Then
'Fermeture fenetre IE
objExplorer.Document.Body.Style.Cursor = "default"
objExplorer.Quit
Exit Do
End If
Loop
MsgBox "fenetre IE fermée"
Set WshShell = Nothing
Set Fso = Nothing
Set objExplorer = Nothing
Set objWMIService = Nothing
WScript.Quit
cs_JMO
Messages postés1854Date d'inscriptionjeudi 23 mai 2002StatutMembreDernière intervention24 juin 201827 7 févr. 2006 à 19:34
Bonsoir "pcpt", "jack" et les autres
Dans mon exemple, au lieu d'utiliser objExplorer via shell,
on peut (xxxx-être) utiliser Fso et GetObject + la boucle.
Etant néophyte, je ne vous embete pas plus et suis avec interet la
réponse finale de ce post.