Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to couple Applications with specific Hardware
#1
Hi there i have an Epson usb digital board / beamer and i want that a user can see the software only when his laptop/desktop is connected with the Epson beamer via the usb port. Does anyone know's how to do that?
Reply
#2
Hi Kostas,

This can most likely be solved with Scense, but not without a bit of VB-scripting.

USB devices can be enumerated using WMI queries. You can do these queries from several languages. including VBScript.
This means that:
A: you can write a Scense function-variable in VBScript that uses WMI to enumerate the USB devices and check for the "Epson usb digital board / beamer" device signature.
This function can then return a value that can be used in Scopes and criteria.
B: you can write a custom criterion in VBScript that checks for the device signature and use this criterion in the appropriate scopes (writing custom criteria is a little bit harder than writing a function)

Here's a page describing the device enumeration with VBScript: https://blogs.technet.microsoft.com/heys...-computer/


I hope this helps you in the right direction.


Regards,
Richard
Reply
#3
Sometimes the solution can be even simpler.
This depends on the way the hardware works, and is registered on the system. All hardware that is connected to a computer establishes a registration part. This means the PNP manager detects the hardware change and will try to install it. The hardware will be included in the hardware list (connected/known devices). Actually this list is 'just' registry, as almost all Windows settings are.

With Scense you have the ability to query the system using VB, but it is simpler to just check the registry for the specific hardware ID. This will be something like the following key:
HKLM\System\CurrentControlSet\Enum\USB\<your hardware ID>
Simple case: I connected an external mouse, and the device ID "VID_0458&PID_0007" became available.

Most of the time the keys for the device stay after a device is disconnected, which might be 'not desired' for your use case. On the other hand, you also don't get a notification a device is connected, so it might require a device to be connected during logon or refreshing (update shortcuts from Scense Client) to get the new features.

The advantage of 'just' using this registry approach over the programmatic one:
- No programming (criteria) is required, so simpler
- It is faster: Registry lookup is faster than executing code to query the WMI

Disadvantage:
- You will not know when a device is disconnected

When looing into this a bit further (regedit with a search for the device ID) I found my device in the following registry location as well:
HKLM\SYSTEM\CurrentControlSet\Services\mouclass\Enum
There is an identifier count with the hardware ID as a value present, which gets updated as soon as the device is (dis)connected. You would need to search for the hardware ID however, as multiple devices in the class might be connected, which requires coding again. So getting familiar with the powerful Scense Criteria might be a good thing to do anyway.

Cheers,
ScenseGuru
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)