English 中文(简体)
使用WSH或WMI或类似的窗户进入一个窗户?
原标题:Is there a way to get access to a window handle in windows using WSH, or WMI or similar?

使用WSH或WMI或类似的窗户进入一个窗户? 我只想把窗户贴上永远不变的旗帜。 理想的情况是,我使用窗户。

请注意,我不想在有关系统中安装PowerShell。 我们对于任何额外的软件都很疲.,并且已经掌握了某些涉及的VBS文档。

关于

问题回答
Private Const Firefox  = "C:App32Mozilla Firefoxfirefox.exe"
Private Const IE8      = "C:App32Internet Exploreriexplore.exe"
Private Const Opera    = "C:App32Operaopera.exe"
Private Const Chrome   = "C:App32GoogleChromeApplication
ew_chrome.exe"
Private Const Safari   = "C:App32SafariSafari.exe"

Private Const ShowTime  =20000
Private Const TechWait  =200
Private Const CloseWait =1000

If WScript.Arguments.Count <1 then 
           Wscript.Echo "URL not found!"         & vbCrLf &_ 
                                                   vbCrLf &_
           "ex 1: "                              & vbCrLf &_ 
       Wscript.ScriptName & " ""<URI>"       & vbCrLf &_ 
       "ex 2: "                              & vbCrLf &_ 
       Wscript.ScriptName & " ""http://www.google.com"

       Wscript.Quit(10)
End If

Set oShell=CreateObject("Wscript.Shell")

Set oCommand=oShell.exec(Firefox   & " " & WScript.Arguments(0))
FirefoxPid=oCommand.ProcessID

Set oCommand=oShell.exec(IE8       & " " & WScript.Arguments(0))
IE8Pid=oCommand.ProcessID

Set oCommand=oShell.exec(Opera     & " " & WScript.Arguments(0))
OperaPid=oCommand.ProcessID

Set oCommand=oShell.exec(Chrome    & " " & WScript.Arguments(0))
ChromePid=oCommand.ProcessID

Set oCommand=oShell.exec(Safari    & " " & WScript.Arguments(0))
SafariPid=oCommand.ProcessID


WScript.Sleep ShowTime

oShell.AppActivate(FirefoxPid)
WScript.Sleep TechWait
oShell.SendKeys "%{F4}"

WScript.Sleep CloseWait

oShell.AppActivate(IE8Pid)
WScript.Sleep TechWait
oShell.SendKeys "%{F4}"

WScript.Sleep CloseWait

oShell.AppActivate(OperaPid)
WScript.Sleep TechWait
oShell.SendKeys "%{F4}"

WScript.Sleep CloseWait

oShell.AppActivate(ChromePid)
WScript.Sleep TechWait
oShell.SendKeys "%{F4}"

WScript.Sleep CloseWait

oShell.AppActivate(SafariPid)
WScript.Sleep TechWait
oShell.SendKeys "%{F4}"

Set oCommand = Nothing
Set oShell   = Nothing
Private Const wbemFlagReturnImmediately = 16
Private Const wbemFlagForwardOnly       = 32

Dim strComputer, objWMIService, strUserName, strPassword

UserName = ""
Password = ""
strComputer   = "."

Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = SWBemlocator.ConnectServer(strComputer,"rootCIMV2",strUserName,strPassword)

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Process", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem in colItems
    WScript.Echo objItem.Caption, objItem.ProcessId, objItem.Commandline
Next

see ... wmic CLASS win32_process > C:4.html

Wmic process where (Name= eclipse.exe ) have/61/7Line, Process Id

如果需要,可制作假肢和编辑新的轮椅功能。





相关问题
Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Programmatically detect Windows cluster configuration?

Does anyone know how to programatically detect that a Windows server is part of a cluster? Further, is it possible to detect that the server is the active or passive node? [Edit] And detect it from ...

get file icon for Outlook appointment (.msg)

I ve read Get File Icon used by Shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great. However, Outlook uses ".msg" ...

Identifying idle state on a windows machine

I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn t mean the ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签