IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VBScript Discussion :

Mettre Fenetre IE premier plan fixe


Sujet :

VBScript

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre habitué
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    12
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 12
    Par défaut Mettre Fenetre IE premier plan fixe
    Bonjour tout le monde !

    Je vous expose mon projet:

    J'ai crée 2 script, 1 batch et un .VBS:
    - Le Batch sert à lancer une application + mon VBS avec un paramètre
    - Le .vbs lance une fenêtre IE avec, à l'intérieur de celle-ci, une barre de progression.

    (J'espère que tout est clair pour l'instant )

    Maintenant, mon problème est que ma fenêtre IE passe derrière l'application qui est en train d'être lancée

    J'aimerais au final que cette fenêtre IE (avec la barre de progression) passe en premier plan pendant que l'application se lance.. Le top serait que l'utilisateur ne puisse pas la fermer, pas la déplacer, juste attendre que la fenêtre s'en aille..

    Comment faire ??

    J'ai lu plein de chose en vb5-6 (SetWindowPos etc..) mais rien du tout en VBS pour résoudre ce problème..

    Quelqu'un aurait-il une idée ou une piste pour m'aider à me dépatouiller ???

    Merci à tous !

  2. #2
    Expert confirmé
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 844
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 844
    Par défaut
    et Bienvenue au Club
    Pour maximiser vos chances de trouver une solution, je crois qu'il serait mieux de faire un copier coller de vos sources Bat et vbs et pensez au Tag

  3. #3
    Membre habitué
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    12
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 12
    Par défaut
    Je ne vous donne que le code vbs, le bat n'effectue qu'un start du vbs

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    Dim gdocProgressBar 'Required global declaration for status bar document
    Dim goieProgressBar 'Required global declaration for Internet Explorer object
    Set gdocProgressBar = Nothing
    Set goieProgressBar = Nothing
    Dim x
    Dim palier
     
    palier = WScript.Arguments(0)
     
    'Kill Simulation
    if  palier = 1 then
    	For x = 0 To 100
    		ProgressBar x, palier
    		WScript.Sleep 170
    	Next
    	For x = 100 To 0 Step -1
    		ProgressBar x, palier
    		WScript.Sleep 180
    	Next
     
    'Démarrage Simulation	
    ElseIf palier = 2 then
     
    	'Premier Aller/retour progresseBar
    	For x = 0 To 100
    		ProgressBar x, palier
    		WScript.Sleep 260
    	Next
    	For x = 100 To 0 Step -1
    		ProgressBar x, palier
    		WScript.Sleep 260
    	Next	
    	'Second Aller/retour progresseBar
    	For x = 0 To 100
    		ProgressBar x, palier
    		WScript.Sleep 250
    	Next
    	For x = 100 To 0 Step -1
    		ProgressBar x, palier
    		WScript.Sleep 250
    	Next
    	'Troisieme Aller/retour progresseBar
    	For x = 0 To 100
    		ProgressBar x, palier
    		WScript.Sleep 250
    	Next
    	For x = 100 To 0 Step -1
    		ProgressBar x, palier
    		WScript.Sleep 250
    	Next
    	'Quatrieme Aller/retour progresseBar
    	For x = 0 To 100
    		ProgressBar x, palier
    		WScript.Sleep 250
    	Next
    	For x = 100 To 0 Step -1
    		ProgressBar x, palier
    		WScript.Sleep 250
    	Next
     
    'Lancement Transit	
    ElseIf palier = 3 then
    	For x = 0 To 100
    		ProgressBar x, palier
    		WScript.Sleep 100000
    	Next
    	For x = 100 To 0 Step -1
    		ProgressBar x, palier
    		WScript.Sleep 100000
    	Next
     
    End if
     
    WScript.Sleep 10
    ProgressBar -1, 0
     
    Sub ProgressBar(intPercent, palier)
    	'Create the status bar window
    	If gdocProgressBar Is Nothing Then
    		If ((Cint(intPercent) >= 0) And (Cint(intPercent) <= 100)) Then
    			Set goieProgressBar = CreateObject("InternetExplorer.Application")
    			goieProgressBar.Offline = True
    			goieProgressBar.AddressBar = False
    			goieProgressBar.Height = 490
    			goieProgressBar.Width = 650
    			goieProgressBar.MenuBar = False
    			goieProgressBar.StatusBar = False
    			goieProgressBar.Silent = True
    			goieProgressBar.ToolBar = False
    			goieProgressBar.Navigate "\test.html"
    			goieProgressBar.resizable = false
    			Do While goieProgressBar.Busy
    				WScript.Sleep 100
    			Loop
    			'On Error Resume Next
    			Set gdocProgressBar = Nothing
    			Do Until Not gdocProgressBar Is Nothing
    				WScript.Sleep 100
    				Set gdocProgressBar = goieProgressBar.Document
    			Loop
    				call etape(palier)
    		Else
    			Exit Sub
    		End If
    	End If
     
    	'Close the status bar window
    	If Not gdocProgressBar Is Nothing Then
    		If ((Cint(intPercent) < 0) Or (Cint(intPercent) > 100)) Then
    			goieProgressBar.Visible = False
    			Set gdocProgressBar = Nothing
    			goieProgressBar.Quit
    			Set goieProgressBar = Nothing
    			Exit Sub
    		End If
    	End If
     
    	'Update the status bar window
    	If Cint(intPercent) = 0 Then
    		gdocProgressBar.all.status.width = "1%"
    		gdocProgressBar.all.status.bgcolor = "#FFFFFF"
    	Else
    		gdocProgressBar.all.status.width = Cstr(Cint(intPercent)) & "%"
    		gdocProgressBar.all.status.bgcolor = "#4F81BD"
    	End If
    End Sub	
     
    sub etape(IntPalier)
     
    	if  IntPalier = 1 then
    		gdocProgressBar.Open
    		gdocProgressBar.Write "<html><head><title>"
    		gdocProgressBar.Write "Lancement simulation"
    		gdocProgressBar.Write "</title></head><body><h1 style=""color: red""><center>Simulation is starting, please wait the end of this message !</center></h1><center>"
    		gdocProgressBar.Write "</title></head><body><h2><center> Step 1/3 : Killing simulation on host server..</center></h2><center>"
    		gdocProgressBar.Write "<TABLE width=200 border=3 frame=box><tr><td>"
    		gdocProgressBar.Write "<TABLE id=status width=0 border=0 cellpadding=0 cellspacing=0 bgcolor=#FFFFFF>"
    		gdocProgressBar.Write "<tr><td>&nbsp</td></tr></table></td></tr></table></center><img src=""lancement_simu2.bmp""></body></html>"
    		gdocProgressBar.Close
    		goieProgressBar.Visible = True
     
    	ElseIf IntPalier = 2 then
    		gdocProgressBar.Open
    		gdocProgressBar.Write "<html><head><title>"
    		gdocProgressBar.Write "Lancement simulation"
    		gdocProgressBar.Write "</title></head><body><h1 style=""color: red""><center>Simulation is starting, please wait the end of this message !</center></h1><center>"
    		gdocProgressBar.Write "</title></head><body><h2><center> Step 2/3 : Starting simulation..</center></h2><center>"
    		gdocProgressBar.Write "<TABLE width=200 border=3 frame=box><tr><td>"
    		gdocProgressBar.Write "<TABLE id=status width=0 border=0 cellpadding=0 cellspacing=0 bgcolor=#FFFFFF>"
    		gdocProgressBar.Write "<tr><td>&nbsp</td></tr></table></td></tr></table></center><img src=""lancement_simu2.bmp""></body></html>"
    		gdocProgressBar.Close
    		goieProgressBar.Visible = True
     
    	ElseIf IntPalier = 3 then
    		gdocProgressBar.Open
    		gdocProgressBar.Write "<html><head><title>"
    		gdocProgressBar.Write "Lancement simulation"
    		gdocProgressBar.Write "</title></head><body><h1 style=""color: red""><center>Simulation is starting, please wait the end of this message !</center></h1><center>"
    		gdocProgressBar.Write "</title></head><body><h2><center> Step 3/3 : Launching transit on simulation..</center></h2><center>"
    		gdocProgressBar.Write "<TABLE width=200 border=3 frame=box><tr><td>"
    		gdocProgressBar.Write "<TABLE id=status width=0 border=0 cellpadding=0 cellspacing=0 bgcolor=#FFFFFF>"
    		gdocProgressBar.Write "<tr><td>&nbsp</td></tr></table></td></tr></table></center><img src=""lancement_simu2.bmp""></body></html>"
    		gdocProgressBar.Close
    		goieProgressBar.Visible = True
     
    	End if
     
    End Sub
    Voila, j'aimerais donc que la page html crée avec la barre de progression se retrouve au premier plan, et non pas derriere l'application qui est en cours de lancement..


    Le tout est d'avoir un message indiquant a l'utilisateur que l'application est en cours de chargement, sans qu'il ne puisse l'enlever.. Le visuel du decompte n'est pas trés important.

    Peut etre faudrait-il emprunter une autre voie, tel qu'un compte a rebour (timer) sur un msgBox ou popup, mais je n'arrive pas a creer ceux-ci sans bouton

    Je suis ouvert a toutes autres idées

    Merci a tous de votre aide

    (dsle pour les accents, clavier qwerty )

  4. #4
    Expert confirmé
    Avatar de ced600
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Août 2006
    Messages
    3 364
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Août 2006
    Messages : 3 364
    Par défaut
    Regarde ce post, il y a différente solution proposée pour rendre active une fenêtre précise.
    Le but sur ce post est de fermer la fenêtre.
    C'est un point de départ, reste plus qu'à trouver le passage au premier plan.

  5. #5
    Membre habitué
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    12
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 12
    Par défaut
    Merci de ta réponse ced600, j'ai regardé en speed le post et ca pourrait peut etre m'aider

    Je me suis dépanner pour l'instant avec un popup sans bouton et que l'on ne peut pas quitter..

    Pour ceux que ca intéressent:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
     
    Dim Wrap, pAddr
    Dim CaptionWnd
    Dim intButton
    Dim palier
     
    Const WM_CLOSE = &H10
     
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Set Wrap = CreateObject("DynamicWrapperX")
    Set pRef = GetRef("TimerProc")
     
    Wrap.Register "user32.dll", "FindWindowA", "i=ls", "r=l"
    Wrap.Register "user32.dll", "FindWindowExA", "i=llsl", "r=l"
    Wrap.Register "user32.dll", "SetTimer", "i=llll", "r=l"
    Wrap.Register "user32.dll", "KillTimer", "i=ll", "r=l"    
    Wrap.Register "user32.dll", "SendMessageA", "i=llll", "r=l"
     
    pAddr = Wrap.RegisterCallback(pRef, "i=llll", "r=l")
     
    Function PopupEx(strText, nSecondsToWait, strTitle, nType)
      CaptionWnd = strTitle
      'le timeout est au minimum et le timer ne sera désactivé que lorsque le popup aura été créé
      Wrap.SetTimer 0, 0, 10, pAddr 
      PopupEx = WshShell.Popup(strText, nSecondsToWait, strTitle, nType)    
    End Function
     
    Sub TimerProc(hWnd, uMsg, idEvent, dwTime)
    Dim myHwnd
      myHwnd = Wrap.FindWindowExA(Wrap.FindWindowA(0, CaptionWnd), 0, "Button", 0)
      If myHwnd <> 0 Then Wrap.KillTimer 0, idEvent 'le timer est devenu inutile donc destruction
      Wrap.SendMessageA myHwnd, WM_CLOSE, 0, 0
    End Sub
     
     
    intButton = PopupEx("            please wait....           " & vbCrLf & "           ------------------", 10, "Starting Simulation",0 + 48)
    Je vais me repencher sur ma fenetre IE dans quelque jours, je vous ferais part des mes progrés

    Merci à tous

Discussions similaires

  1. Mettre un fenetre en premier plan
    Par Umlist dans le forum C#
    Réponses: 4
    Dernier message: 12/01/2011, 22h48
  2. IE8 mettre une fenetre au premier plan
    Par jjcol dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 14/01/2010, 14h47
  3. mettre une fenetre en premier plan
    Par menel dans le forum Général JavaScript
    Réponses: 14
    Dernier message: 06/08/2008, 17h36
  4. Mettre une fenetre au premier plan
    Par Poulain dans le forum Windows Forms
    Réponses: 3
    Dernier message: 17/12/2007, 17h58
  5. Mettre une fenetre au premier plan
    Par madislak dans le forum Interfaces Graphiques en Java
    Réponses: 3
    Dernier message: 14/02/2006, 00h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo