请问有谁用过WinIO的 ( 积分: 50 )

N

norlon

Unregistered / Unconfirmed
GUEST, unregistred user!
我想做一个并口通信的程序,在网上找不到相关控件,对api又不熟,
后来找到一个WinIO,说是可以在2000/xp下直接操作端口的。但是我不知道如何将他添加到delphi里面进行使用。请教大家一下,谢谢!
补充:看了一下,主要有dll,vxd和sys三个文件。
 
unit uWinIo;
interface
uses
Windows;
type
bool = boolean;
{ Init PortIO Service }
function __InitializeWinIo(): bool;
WinAPI;
{ Fint PortIO Service }
function __ShutdownWinIo(): bool;
WinAPI;
{ Remove PortIO Service }
function __RemoveWinIo(): boolean;
WinAPI;
{ Read or write PortIO, Size = 1, 2, 3, 4(Bytes) }
function __In(wPortAddr: WORD;
PortVal: PDWORD;
Size: BYTE): bool;
WinAPI;
function __Out(wPortAddr: WORD;
PortVal: DWORD;
Size: BYTE): bool;
WinAPI;
function __GetPhys(dwPhysAddr: DWORD;
PortVal: PDWORD): bool;
WinAPI;
function __SetPhys(dwPhysAddr: DWORD;
dwPortVal: DWORD): bool;
WinAPI;
{ Read or write Memory, }
function __MapPhysToLin(dwPhysAddr: DWORD;
dwPhysSize: DWORD;
hPhysHandle: PHandle): PByte;
WinAPI;
function __UnmapPhysMemory(hPhysHandle: THandle;
pbLinAddr: DWORD): bool;
WinAPI;
var
IOSuc: Boolean;
implementation
const
WINIODLL = 'WinIo.dll';
function __InitializeWinIo;
external WINIODLL name 'InitializeWinIo';
function __ShutdownWinIo;
external WINIODLL name 'ShutdownWinIo';
function __RemoveWinIo;
external WINIODLL name 'RemoveWinIoDriver';
function __In;
external WINIODLL name 'GetPortVal';
function __Out;
external WINIODLL name 'SetPortVal';
function __GetPhys;
external WINIODLL name 'GetPhysLong';
function __SetPhys;
external WINIODLL name 'SetPhysLong';
function __MapPhysToLin;
external WINIODLL name 'MapPhysToLin';
function __UnmapPhysMemory;
external WINIODLL name 'UnmapPhysicalMemory';

initialization
IOSuc := __InitializeWinIo;
finalization
__ShutdownWinIo();
end.

用这个单元,引用dll,把那几个文件copy到程序目录下即可
 
to tayu0214
WinApi是关键字吗,为什么这边会报错‘unknow directive WinAPI’?
 
winApi 是一种调用格式
你用stdcall 代替试试
 
做过!!!做了一个各按键精灵一样的程序!!!!
 

Similar threads

顶部