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

Printed on: April 16, 2024 at 21:04 o'clock

Mitglied: 76109
76109 Dec 31, 2010 at 11:44:32 (UTC)
Goto Top
Hallo bordermax!

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

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

Gruß Dieter
Member: bordermax
bordermax Dec 31, 2010 at 13:01:14 (UTC)
Goto Top
hi,

hab ich auch schon probiert, geht aber auch nicht ....
Mitglied: 76109
76109 Dec 31, 2010 at 13:11:01 (UTC)
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