English 中文(简体)
• 重新启用窗户窗户的VB式窗户;
原标题:Refreshing Windows TaskBar with VBScript for windows?

有一个VB 月刊(vbs) 的人在我公司这里写的文字。 该申请开放并关闭了某些申请,它有一台快艇Icon,每当它关闭时(通过独角设计)该笔拖车的遗骸。 因此,在一两天后,申请书的数百万英磅仍留在特别关上。

是否在VB中教授过窗子,以修补工作酒吧,并清除这些漫画?

这里是pit:

*****************************************************************************************
  Progam Name: CheckConnection.vbs
  Program Purpose: This script check for an internec connection, the program pings to some domains,
        wait some seconds (5 seconds) before the next try, if a domain is found, reset all counters,
        and wait secondsBeforeNextCheck seconds before next check
        If the programs raise nMaxRetriesBeforeStartProgram then kill the program that
        manage the connection and start it again.
  Usage: This Script must be placed in ONE OF THE FOLLOWING PATHS
    1) Start --> All Programs --> Start Up
    2) HKLMSoftwareMicrosoftWindowsCurrentVersionRun
    3)HKCUSoftwareMicrosoftWindowsCurrentVersionRun
    4) Or you can create a task through:
        Start --> All Programs --> Accessories-->System Tools --> Scheduled Tasks--> Add Scheduled Task
        --> Follow the Wizard 
    5) The program VZAccess Manager.exe must be configured to autoconnect through
        Tools --> Preferences --> WWan --> Connect Options --> Automatically Connect (this must be checked)
    6) Also to autorefresh the ip the vzaccess manager.exe must be configured with an script when c onnect.
  Author: Benito Lopez
  Date:  06152009
  Revision 1.1 : (11272009) -f was added to force the program VZAccess manager.exe to terminate.
  *****************************************************************************************
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim objfso, objfile
Set objfso = CreateObject("Scripting.FileSystemObject")
Dim secondsBeforeNextCheck
Dim strDomains(6)
Dim nMaxRetriesBeforeStartProgram
Dim nCounterRetries

Const ForReading=1, ForWriting=2, ForAppending=8

strDomains (0) = "www.google.com"
strDomains (1) = "www.yahoo.com"
strDomains (2) = "www.chilpak.com"
strDomains (3) = "www.microsoft.com"
strDomains (4) = "www.flutec.com"
strDomains (5) = "www.flutec.com.mx"

strLogFilename = "c:checkconnectionlog.log"
filepinger = "c:pingresult.log"
nMaxRetriesBeforeStartProgram =5
secondsBeforeNextCheck = 60000
secondsBeforeNextTry = 15000
secondsBeforeAppStart = 2000
secondsAfterAppStart = 60000

Call Main()

Sub Main()
    set objfile = objfso.OpenTextFile(strLogFilename, 8,True)

    WHILE 1
        nCounterRetries = 0
        FOR i = 0 TO 5 STEP 1
             Check the connection status if zero, means
             There is no internet connection or the domain is down
            If not IsThereInternetConnection(strDomains(i)) THEN
                 Let suppose the domain is down, so we must try with the next domain
                nCounterRetries = nCounterRetries + 1
                IF nCounterRetries >= nMaxRetriesBeforeStartProgram THEN
                     Close the program
                    targetprogram = "taskkill /im " & chr(34)  & "VZAccess Manager.exe" & chr(34) & " /f"
                    WshShell.Exec(targetprogram)
                     Wait Applications Events 2 seconds
                    Wscript.Sleep(secondsBeforeAppStart)
                     Start the program
                    targetprogram = chr(34) & "C:Program FilesVerizon WirelessVZAccess ManagerVZAccess Manager.exe" & chr(34) & " -m"
                    WshShell.Exec(targetprogram)
                     Wait for the applications loads completely 1 seconds
                    WScript.Sleep(secondsAfterAppStart)
                     Reset the counters
                    nCounterRetries = 0
                    Wscript.Sleep secondsBeforeNextCheck
                END IF
                 But we must wait some seconds before the next try
                Wscript.Sleep secondsBeforeNextTry

            ELSE
                 If we get a reply from the current domain,
                 Everything is OK,  The only we need to do is Wait until the next time to check
                 Reset Counter
                nCounterRetries = 0
                WScript.Sleep secondsBeforeNextCheck
            END IF
        NEXT
    Wend
End Sub

FUNCTION IsThereInternetConnection(strDomain)
on error resume next
     Create some cons values
     Make the ping
    Dim strRun
    strRun = "%comspec% /c ping -n 1 " & strDomain & " > " & filepinger
    Dim objwss
    Set objwss = CreateObject("WScript.Shell")
     Hide the windows and wait the app to terminate
    WriteLog "Pinging " & strDomain & " ..."
    objwss.Run strRun,0,True
    Set objwss = Nothing

      Read the ping
    Dim strotf
    Dim fso
    Dim otf
    strotf=""
    set fso = CreateObject("Scripting.FileSystemObject")
    set otf = fso.OpenTextFile(filepinger,ForReading)
    strotf = otf.ReadAll
    fso.DeleteFile filepinger
    set fso = nothing
    set otf = nothing

     Test the ping
    IF InStr(strotf,"Reply from")>0 THEN
        IsThereInternetConnection = TRUE
    ELSE
        IsThereInternetConnection = FALSE
    END IF
    WriteLog "Pinging Result " & IsThereInternetConnection & " Done."
End FUNCTION

Sub WriteLog(strLog)

    on error resume next

    Set objfile = objfso.GetFolder(strLogFilename)
    if objfile.size  > 50000 then
        objfso.Close
        objfso.DeleteFile strLogFilename
        set objfile = objfso.OpenTextFile(strLogFilename, 8,True)
    end if
     Add some useful information
    strData = Now() & " - "
    objfile.WriteLine strData & strLog
End Sub
最佳回答

该系统的Orphan icons在你把 mo点推向 over子之后消失。 我猜测,可以通过发送<代码>,从方案上做到这一点。 WM_MOUSEMOVE 致送系统快车窗的电文,但VB式照相机不能进入Windows AP。

我建议,你使用一些外部用途来更新该系统,并用你的文字管理该系统。 例如,。 TrayIconBusterutil on Code Project, which can Clean up the tray per 5 seconds. (需要网络框架) 或者你可以撰写类似的工具。

欲从VB式文本中提出申请,可使用http://msdn.microsoft.com/en-us/library/d5fk67ky.aspx” rel=“nofollow noreferer”>。 Exec方法是。 你可以在你的书中找到例子。

问题回答

用于在档案中向重新启动的探索者指挥部报到批号

Windows Registry Editor Version 5.00 [-HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerTrayNotify] [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerTrayNotify]

节目让探索者投放或取走icon。 如果你与icon探索者互动,就试图告诉方案去做任何事情,并通知它没有去做,去除icon。

<代码>Taskhow可做两件事。 它可以要求结束方案(该方案可以建立一个方言“ave吗? - 是/否/Cancel”,该方案按照设计或使用<代码>/f而关闭,在不通知方案的情况下终止了该方案,因此,该方案可以要求勘探者去除icon。

不含<代码>/f的试剂。 您总是可以两次使用,然后使用<代码>/f。





相关问题
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 ...

热门标签