Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I query the registry for active CAN card

I'm trying to find a way to detect if a CAN card is present and active in the system.

My problem is I write the CAN applications to be run on both NI-CAN and Softing hardware.

Right now, the first time an application is run on a PC, a dialog pops up to ask which CAN card they are using, then it is written to the config file and read each time it is run.

I'd like to bypass this dialog and automatically detect which type is in the system and active. Is this possible?

TIA
Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 1 of 3
(4,039 Views)
Hi Ed,
I have never worked with the softing hardware, but I believe you should be able to query the registry. MSDN has a great deal of information regarding the registry. This can be located at msdn.microsoft.com. My search yielded this page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceddk40/htm/cxconregistrykeysusedbydevicemanager.asp
This page talks about the registry keys used by the device manager and would be a good place to start!

Hope this information helps out Ed!

Aaron K.
Application Engineer
National Instruments
0 Kudos
Message 2 of 3
(4,039 Views)
This depends on whether you need to detect if NI-CAN software is installed, or detect if a card exists.

To detect if NI-CAN is installed, you can look in the Registry under HLM\Software\National Instruments\NI-CAN. If this does not exist, NI-CAN is not installed.

Assuming NI-CAN is installed, you can detect if a given interface exists by calling ncConfig with some simple attributes. Be sure to set the Start On Open attribute to False. If ncConfig returns success, the interface exists. If ncConfig returns an error, the interface does not exist.
Message 3 of 3
(4,039 Views)