How to Add a Custom Application to the Device Monitor Dialog

Publish Date: Dec 08, 2009 | 2 Ratings | 1.00 out of 5 | Print | Submit your review

Overview

When a new USB device is plugged in after device drivers are installed a dialog box pops up asking how you would like to use the device. Right now, this dialog has several applications hard-coded in that it is capable of launching like: MAX, LabVIEW, SignalExpress, Test Panels, and sometimes more. Here is what you need to do to add more applications to this list: 1. Install your exe. 2. Make some registry entries. 3. Plug-in your USB device. In this tutorial we will be covering the second step of adding the registry entries.

Note: This functionality is provided As Is. This functionality is not actively supported by NI and this tutorial is only intended to serve as an example of how this might be achieved.

First, to get the registry editor open select Start»Run, type "regedit", and press the OK button.


Figure 1. The run dialog that is seen by pressing Start»Run or Windows Key+R

Device Monitor (henceforth referred to as devmon) will automatically search for folders under "HKEY_LOCAL_MACHINE\SOFTWARE\National Instruments\NI-DAQmx\nidevmon\customApps\" to add to its dialog.


Figure 2. The registry editor keys used to add an entry to the devmon dialog


You can create a Registry Key (looks like a folder) under customApps by Right Clicking and selecting New»Key then call it whatever you like.  Inside that registry key, you place the following string registry values (Right Click and select New»String Value), some are optional:

Path (required) - This is the full path to the executable that you want launched. We automatically pull the icon from your executable to display in devmon's dialog.

ID (required) - This is a GUID used to identify your application. Use GUIDGEN. If the user selects "Always take this action", the GUID is stored. In this case devMon uses this GUID to uniquely identify the specific application it should start.

CommandLine (optional) -
This is any command line parameters that you want passed to your application. Your application should at least take in the device identifier because your application probably needs to know which device was inserted! You can use the following placeholders in your command line that devmon will fill in at runtime: <deviceID> <deviceGUID> <language>. When your application is called the command line would be something like: "reidsapp.exe /devID:Dev1 /locale:JPN". Notice here that we did not pass the deviceGUID. If your application does not require the deviceGUID, don't create the deviceGUID registry entry. You should only create registry entries for the arguments your application will need. Keep in mind that devmon will call your application with the requested command line arguments in the order they are listed above. If you did not specify a particular command line argument, that information will be skipped and omitted when invoking your application. See the example below for more information. The <deviceGUID> placeholder is passed without the GUID's surrounding {}.

BigText (optional) - This is optional but you should provide it. There are two lines of text that can be displayed next to your application's icon. BigText is the first line of text, which is larger. Both BigText and LittleText can be localized. To tell devMon which strings are associated with each language, you append a language suffix to BigText such as:
BigText_ENG
BigText_FRA
BigText_DEU
BigText_JPN
BigText_KOR

Devmon will always look for the localized text first, and if is not present, we will look for a non-suffixed name. i.e. we will look for BigText_JPN then BigText. If no BigText registry information was provided, devMon will simply show nothing but your application's icon.

LittleText (optional) - This is the second line of text that appears next to your icon. Same localization rules as BigText.


Figure 3. BigText is shown by the red box and LittleText is shown by the blue box

FilterType<uniqueName> (required) - If your application should only be launched for certain devices, you should use the FilterType and FilterData parameters. FilterType tells devMon how to filter the devices it processes on insertion. You can choose to filter by including or excluding devices based on device name. Values for the FilterType option can be FilterInByName and FilterOutByName. The "FilterIn" type is used if you want to include specific devices. FilterOut is used if you want to exclude specific devices. The <uniqueName> can be anything but will usually describe the product family that you are including/excluding. i.e. FilterTypeScope. Devmon will scan through all FilterType* parameters because you can use multiple filters. The unique name creates a unique filter which is associated with the FilterData that has the same name.

FilterData<uniqueName> (required) - Provides the data required by the FilterType outlined above. First, the <uniqueName> must match the same suffix you used in FilterType (i.e. FilterTypeScope would have a corresponding FilterDataScope). FilterData is a comma-delimited list of device names.



For example:

So lets say I wanted to add an application called reidsapp.exe and it was
installed at:

c:\program files\national instruments\cool apps\reidsapp.exe

Also, my application needs to be passed on the command line, the device
identifier of the USB device that was inserted (like Dev1) and language to
use in the following manner:

reidsapp.exe /devID:Dev1 /locale:JPN

When devmon's dialog appears, I want it to say "Start taking pictures" and
under that, in smaller text, I want it to say "Using Reid's super cool app".
In addition, I only want my application listed in devmon's dialog, if the device
inserted is a "USB-6008" or "USB-6211". Here's what I would need to do:

Create the following key in the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\National Instruments\NI-DAQmx\nidevmon\customApps\reidsapp

Add the following values to the key:
Path: c:\program files\national instruments\cool apps\reidsapp.exe
ID: {21954C5A-561B-4a06-B1C2-CBFA2CC27C46}
CommandLine: /devID:<deviceID> /locale:<language>
BigText: Start taking pictures
LittleText: Using Reid's super cool app
FilterTypeReid: FilterInByName
FilterDataReid: USB-6008,USB-6211

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit