Herry Markowitz
Well-known member
- Joined
- Oct 22, 2015
- Messages
- 46
- Programming Experience
- 1-3
Hi beautiful people,
Following Console Application code checks if any antivirus program installed or not in your computer.
How to convert above code to Windows Form Application Code?
Thanks in advance...
Following Console Application code checks if any antivirus program installed or not in your computer.
VB.NET:
Imports System.Management
Namespace ConsoleApplication1
Class Program
Public Shared Function AntivirusInstalled() As Boolean
Dim wmipathstr As String = "\\" + Environment.MachineName + "\root\SecurityCenter2"
Try
Dim searcher As New ManagementObjectSearcher(wmipathstr, "SELECT * FROM AntivirusProduct")
Dim instances As ManagementObjectCollection = searcher.[Get]()
Return instances.Count > 0
Catch e As Exception
Console.WriteLine(e.Message)
End Try
Return False
End Function
Public Shared Sub Main(args As String())
Dim returnCode As Boolean = AntivirusInstalled()
Console.WriteLine("Antivirus Installed " + returnCode.ToString())
Console.WriteLine()
Console.Read()
End Sub
End Class
End Namespace
How to convert above code to Windows Form Application Code?
Thanks in advance...
Last edited: