bordermax
Goto Top

HTA in Vordergrund schalten

Hi,

folgendes Problem ....

ich hab mir ein skript in hta gebastelt das verschiedene kopieraktionen durchführt, was auch wunderbar funktioniert.
zusätzlich lasse ich dann noch während so ein kopiervorgang läuft ein 'wartefenster" auch in hta einblenden.
mein problem ist, daß ich dieses 'wartefenster' einfach nicht in den vordergrund bekomme. "shell.appactivate" zeigt
keine reaktion. das schließen funktioniert problemlos....

hier mal meine beiden funktionen zum starten und schließen des wartefensters:
Waitwnd = "waiting.hta"  

' *** starten des wartefensters  
 Function Waiting (pidnr)
   path = Shell.CurrentDirectory 
   wtexe = "C:\Windows\System32\mshta.exe " & path & "\" & Waitwnd  
   rc = proc.create(wtexe, , , pid) '*** Starten des Waiting-Fenster  
   pidnr = pid
   Sleep 5
   rc = Shell.AppActivate(pidnr)
   MsgBox rc
End Function

Function WaitClose (pidnr)
	wql = "select * from Win32_Process where processID=" & pidnr  
	Set result = wmi.ExecQuery(wql)  
    For Each instance In result  
       instance.Terminate 0  '*** Schließen des Waiting-Fenster  
    Next 
End Function

Sub Sleep(strSeconds) '** Wartezeit in Sekunden  
     strCmd = "%COMSPEC% /c ping -n " & strSeconds & " 127.0.0.1>nul"   
     Shell.Run strCmd,0,1 
End Sub 
hat jemand ne idee ????

gruß

markus

Content-Key: 157802

Url: https://administrator.de/contentid/157802

Ausgedruckt am: 29.03.2024 um 10:03 Uhr

Mitglied: 76109
76109 31.12.2010 um 12:44:32 Uhr
Goto Top
Hallo bordermax!

Versuchs mal so:
   'Dim objShell  
    
   'Set objShell = CreateObject("WScript.Shell")  

    rc = objShell.AppActivate("HTA-Fenster-Titel")  

Gruß Dieter
Mitglied: bordermax
bordermax 31.12.2010 um 14:01:14 Uhr
Goto Top
hi,

hab ich auch schon probiert, geht aber auch nicht ....
Mitglied: 76109
76109 31.12.2010 um 14:11:01 Uhr
Goto Top
Hallo bordermax!

Und so:
objShell.Run path & "\" & Waitwnd, 1, False  
 
'WScript.Sleep 100  

rc = objShell.AppActivate("HTA-Fenster-Titel")  
Oder so:
Dim objShell, objHTA
    
Set objShell = CreateObject("WScript.Shell")  

Set objHTA = objShell.Exec("C:\Windows\System32\mshta.exe " & path & "\" & Waitwnd)  

'WScript.Sleep 100  
    
rc = objShell.AppActivate(objHTA.ProcessID)

Gruß Dieter