0

Im writing small app which is about check the process's and I need check interval less then 1s - about 0,5s. With WQL Query Im not able to set up less then 1s. Can you please advise? I was trying diff. types of imput but without luck. :( Thanks.

Const PollingInterval As Double = 1 'Seconds.
Const PollingInterval As String = "0.1" 'Seconds.
Const PollingInterval As String = "0,1" 'Seconds


Dim WithEvents ProcessStartWatcher As New ManagementEventWatcher(New WqlEventQuery("SELECT * FROM __InstanceCreationEvent WITHIN " & PollingInterval & " WHERE TargetInstance ISA 'Win32_Process'"))
Dim WithEvents ProcessStopWatcher As New ManagementEventWatcher(New WqlEventQuery("SELECT * FROM __InstanceDeletionEvent WITHIN " & PollingInterval & " WHERE TargetInstance ISA 'Win32_Process'"))
Aurega
  • 1
  • 2
  • What's wrong with a 1 second latency? Anyway, declare the WqlEventQuery [like this](https://stackoverflow.com/a/54298316/7444103). Using a TimeSpan. – Jimi Dec 18 '20 at 16:51
  • A WqlEventQuery can be culture-sensible. See also [Win32_ProcessTrace](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/krnlprov/win32-processtrace) (and related Process Trace events) and [Monitoring Events](https://learn.microsoft.com/en-us/windows/win32/wmisdk/monitoring-events) – Jimi Dec 18 '20 at 17:15
  • BTW, if you want to test the `Win32_ProcessTrace` events (Processes start and stop notifications in *real time*), let me know (in that case, you need to specify the Platform: e.g., Console, WinForms etc.). – Jimi Dec 18 '20 at 19:28
  • @Jimi Thank you for the comments. Im using it in WinForm, the reason for less then 1s that user can double click the SW in the task bar and in 0,1s the app which we are checking is started twice but trace will handle only one instance. I have tried to use the TimeSpan but its reporting an error same as integer value – Aurega Jan 05 '21 at 13:56

0 Answers0