Bạn download thư viện INPOUT32
tại đây
Giải nén và vào thư mục
\inpout32_source_and_bins\inpout32_source_and_bins \binaries\ocx
Trong thư mục đó, tạo một file .bat với nội dung như sau:
Code:
REGSVR32 hwinterface.ocx
Để đăng ký
hwinterface. Các bạn có thể download file đính kèm, giải nén và chạy file
bac.bat để đăng ký.
Khi đó bạn mở Visual C++. Mở menu
Projects-> Add to project-> Components and control và chọn
Registered ActiveX Controls và tìm đến
hwinterface để cho nó vào projects.
Tiếp theo bạn khai báo và sử dụng lớp này bình thường với tên là:
CHwinterface.
Lớp này có 2 hàm dùng để đọc và ghi dữ liệu:
Code:
short InPort(short Address);
void OutPort(short Address, short Data);
Chúc bạn thành công.