想做一個電源控制程式(制作環境:64位WIN10+VFP9),隨從網上選購了一個USB控制開關,

這開關由于太過簡陋,說明只有
一,How to use 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
二、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
和一個C++做的小示例程式
開始制作,按照說明,這個開關確實簡單,但在VFP中使用也相當方便,初始化,查找設備,打開設備,發送開關信號,關閉設備,很快就做好了程式,開關功能順利實作。
但在反復測驗中發現一個問題:發送開的命令時,隨機的會有一次失效,開不了,頻率不高,關沒有問題。
如果一次沒開了,再來一次又好了,一直弄不明白是啥原因,也解決不了這個問題。
盼各位能幫幫忙,謝謝了!
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/265158.html
標籤:VFP
