Home > database >  About the use of USB control switch problem
About the use of USB control switch problem

Time:03-03

What do you want to be a power control program (production environment: 64 WIN10 + VFP9), choose a USB control switch,

This switch due to too crude, explain only
A, How to use the in Vistual Studio.
1. Creat a new c + + Porject
2. In stdfax. H file, add this code:
# include "usb_relay_device. H"
# pragma comment (lib, "usb_relay_device. Lib")
3. Copy the usb_relay_device. DLL file into the dir that generate your applicaiton. Like the Release or Debug dir
Second, The way to use funcation:
1. Call usb_relay_init () to init the lib.
2. Call usb_relay_device_enumerate () to get all the device pluged into PC
3. Call usb_relay_device_open () open the device you need
4. Other operation funcation:
Call sb_relay_device_open_one_relay_channel () to open one way relay
Call usb_relay_device_open_all_relay_channel () to open all relays
Call usb_relay_device_close_one_relay_channel () to close one way relay
Call usb_relay_device_close_all_relay_channel () to close all relays
And a small sample program c + + do

Started making, according to the instructions, this switch is really simple, but very convenient use in VFP, initialization, find the device, open the device, sending switch signal, shut down equipment, soon ready program, switch function smooth realization,
But in repeated tests found a problem: send the open command, random there will be a failure, can't open the , the frequency is not high, there is no problem,
If a not opened, again good again, always can't figure out is what reason, can solve this problem,

Hope you can help, thank you!
  •  Tags:  
  • VFP
  • Related