VB.NET/VB6 Process.GetProcessesByName ("process"). Length | Alternative for VB6?

I tried to find it for a while, but could not find it.

Is there an easy way to check the number of processes in VB6?

In vb.net it is simple, for example If Process.GetProcessesByName ("testprocess"). Length <2 Then ... etc.

Looking for something short and simple.

Hope someone knows a simple and short way :)

+4
source share
1 answer

WMI can help;

Dim objWMIService As Object, items As Object, item As Object, count As Long Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2") Set items = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'chrome.exe'", , 32) For Each item In items '// cant count so loop count = count + 1 Next MsgBox count & " instances" 
+3
source

Source: https://habr.com/ru/post/1496130/


All Articles