Antivirus Scan When Opened?

Conejo

Well-known member
Joined
Jul 24, 2013
Messages
65
Location
USA
Programming Experience
1-3
Hi so I am making an antivirus in vb.net and I wanted to get the context menu thing to scan with my AV, but now I have that part of the code but I don't know how to make my antivirus scan the file that was right clicked on. I would basically need to start a scanning module to the file that was right clicked. This is what I have till now:

Dim contextinstall As New System.Text.StringBuilder

    contextinstall.AppendLine("Windows Registry Editor Version 5.00  ")
    contextinstall.AppendLine("[HKEY_CLASSES_ROOT\*\shell\Scan With Manticore Antivirus]")
    contextinstall.AppendLine("[HKEY_CLASSES_ROOT\*\shell\Open with Notepad\command]")
    contextinstall.AppendLine("@="" + application.executablepath + "" + "%1"")


    IO.File.WriteAllText("filcontextinstall.reg", contextinstall.ToString())


    Process.Start("contextinstall.reg")


Thank you :watermelon:
 
The "%1" is what passes the path of the file selected to your app as a commandline argument, so you need to code your app to read the file path from the commandline and process it accordingly. If it's a Console app then you can read it straight from the 'args' parameter of the Main method. If it's a Windows app, you can get the commandline arguments from the Startup event handler or by calling Environment.GetCommandlineArgs anywhere in code. You'll want to validate the commandline arguments before using it.
 
Back
Top