6 |
kaklik |
1 |
Documentation for inpout32.zip
|
|
|
2 |
|
|
|
3 |
Inpout32.zip contains a DLL that enables direct reading and writing to I/O ports in 32-bit Visual-Basic programs running under Windows 95.
|
|
|
4 |
|
|
|
5 |
by Jan Axelson
|
|
|
6 |
Lakeview Research
|
|
|
7 |
Email: jaxelson@lvr.com
|
|
|
8 |
WWW: http://www.lvr.com
|
|
|
9 |
|
|
|
10 |
Important information and cautions:
|
|
|
11 |
|
|
|
12 |
1. Use this DLL at your own risk. Writing directly to hardware ports can result in system crashes, loss of data, and even permanent damage. Inpout32 was developed to allow access to parallel ports and other ports on custom hardware, but you can use it to attempt to access any hardware that is mapped as an I/O port. You've been warned!
|
|
|
13 |
|
|
|
14 |
2. Use this DLL only with 32-bit programs. 16-bit programs require a 16-bit DLL (inpout16.dll).
|
|
|
15 |
|
|
|
16 |
3. Windows 95 allows direct port reads and writes unless a VxD has control of the port and blocks access. Under Windows NT, direct port access is not allowed, and you must use a kernel-mode device driver.
|
|
|
17 |
|
|
|
18 |
4. For the latest parallel-port programming and interfacing information and tools, visit Parallel Port Central at:
|
|
|
19 |
|
|
|
20 |
http://www.lvr.com
|
|
|
21 |
|
|
|
22 |
***
|
|
|
23 |
|
|
|
24 |
Inpout32.zip contains the following files:
|
|
|
25 |
|
|
|
26 |
inpout32.txt
|
|
|
27 |
This file
|
|
|
28 |
|
|
|
29 |
inpout32.dll
|
|
|
30 |
A DLL that enables the use of Inp and Out routines in 32-bit Visual Basic 4 and Visual Basic 5 programs.
|
|
|
31 |
|
|
|
32 |
inpout32.bas
|
|
|
33 |
Visual-Basic declarations for Inp and Out
|
|
|
34 |
|
|
|
35 |
inpout32.vbp
|
|
|
36 |
Visual Basic 4 test project for inpout32. The project will also load into and run under Visual Basic 5.
|
|
|
37 |
|
|
|
38 |
inpout32.frm
|
|
|
39 |
Startup form for the test project
|
|
|
40 |
|
|
|
41 |
inpout32.dpr
|
|
|
42 |
Source code for inpout32.dll. The DLL was compiled with Borland's Delphi 2.0 Object Pascal compiler.
|
|
|
43 |
|
|
|
44 |
***
|
|
|
45 |
|
|
|
46 |
How to run the test program (inpout32.vbp):
|
|
|
47 |
1. Copy inpout32.dll to one of these locations: your default Windows directory (usually \Windows), your Windows system directory (usually \Windows\system), or your application's working directory. In the VB programming environment, the working directory is the default VB directory.
|
|
|
48 |
2. Open the project inpout32.vbp.
|
|
|
49 |
3. In the Form_Load subroutine, set PortAddress equal to the port address you want to test.
|
|
|
50 |
3. Clicking the command button causes the program to do the following: write a value to the port, read the port, and display the result. The value increments with each click, resetting to 0 at 255.
|
|
|
51 |
|
|
|
52 |
***
|
|
|
53 |
|
|
|
54 |
How to use inpout32 in your programs:
|
|
|
55 |
|
|
|
56 |
1. Copy inpout32.dll to your default Windows directory (or other directory as described above).
|
|
|
57 |
|
|
|
58 |
2. Add inpout32.bas to your Visual-Basic project (File menu, Add File).
|
|
|
59 |
|
|
|
60 |
3. Use this syntax to write to a port:
|
|
|
61 |
Out PortAddress, ValueToWrite
|
|
|
62 |
|
|
|
63 |
Example:
|
|
|
64 |
Out &h378, &h55
|
|
|
65 |
|
|
|
66 |
Use this syntax to read a port:
|
|
|
67 |
ValueRead = Inp(PortAddress)
|
|
|
68 |
|
|
|
69 |
Example:
|
|
|
70 |
ValueRead = Inp(&h378)
|
|
|
71 |
|
|
|
72 |
(The syntax is identical to QuickBasic's Inp and Out).
|