With the help of FindExecutable Windows API we can trace whether a particular exe is present in the system. It will return a result depending on the handle of the executable associated with the file provided as parameter. It returns a value greater than 32 when successfull.
Lets say for example , we pass a PDF file as parameter , we can check whether Adobe Reader is installed on the system or not.
|
Following is the sample code in [VB.NET]
‘–Declaration
|
Public Declare Auto Function FindExecutable Lib "shell32.dll" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Int32 '-- Dim intRetval As Integer = FindExecutable(PDF FILE FULL PATH NAME, "", "") If intRetval < = 32 MessageBox.Show("The Adobe Reader, which is required to view this file, may not be correctly installed.", "Adobe Reader Not found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End if