I have a C# application that's using the FTD2XX.DLL from FTDI. This application is used for multiple generations of a single product and abstracts the physical hardware. There's an FTDI and a HID implementation.
The application searches for both appropriate FTDI and HID devices, though it's likely that no FTDI drivers exist if the user has the HID generation.
Background aside now. When I instantiate the FTDI class I get a modal, not generated by my code about not finding the FTDI driver and asks the user if the drivers are installed. I tried wrapping this in a TRY/CATCH block but no exception is thrown.
1: Is there a way to determine if the FTDI drivers are installed before trying to instantiate the FTDI class?
2: If not, is there a way to prohibit the FTDI dll from alerting the user when this happens?
There are different versions of the FTDI Driver for Windows 10/11 as shown in Figure 1.1. *Includes the following version of the Windows operating system: Windows 7, Windows 8/8.1, Windows 10, Windows 11, Windows Server 2008 R2 and Windows server 2012 R2. ****Windows 10 and Windows 11 only.
Open the Add/Remove Programs utility located in "Control Panel\Add/Remove Programs". Select "FTDI USB-Serial Converter Drivers" from the list of installed programs. Click the "Add/Remove" button. This will run the FTDI uninstaller program.
D2XX drivers allow direct access to the USB device through a DLL. Application software can access the USB device through a series of DLL function calls. The functions available are listed in the D2XX Programmer's Guide document which is available from the. Documents section of this site.
What is a FTDI driver? Future Technology Devices International is commonly known as FTDI, a company specializing in USB technology. FTDI driver is a essential software that communicates between your computer system and FTDI hardware device.
I have the exact same requirements - in my case I'm enumerating the list of standard serial ports and appending this with the list of any attached FTDI devices. If the driver isn't installed, then I'd like to not have those modal dialog boxes appear. One quick and dirty way I've figured out to do this is to check for the file FTD2XX.DLL being in c:\windows\system32 (or wherever windows is installed). The existence of this file basically means the driver is installed.
// c# example
string path = Environment.GetFolderPath(Environment.SpecialFolder.System);
bool installed = File.Exists(path + Path.DirectorySeparatorChar + "FTD2XX.DLL");
Another way:
[DllImport("kernel32.dll")]
private static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
private static extern bool FreeLibrary(IntPtr hModule);
public bool IsDriverInstalled()
{
//trying to load library
IntPtr handler = LoadLibrary(@"FTD2XX.DLL");
if (handler == IntPtr.Zero)
return false;
else
return true; // Driver is installed
//Don't forget to free .dll
FreeLibrary(handler);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With