小弟有一关于并口编程的问题:
我想通VB6.0对并口进行数据的收发。我使用的是winIO.dll中函数 setportval和getportval
. 我用一小灯泡来检验并口的数据(如是1则亮)。我用别人编译好的VB程序在xp下能够顺利的运行,但我自己调用setprotval时,却没有现象。
setprotval(&h378,255,1);以下是关于些函数的说明。
This function writes a BYTE/WORD/DWORD value to an I/O port. bool _stdcall SetPortVal(
WORD wPortAddr,
DWORD dwPortVal,
BYTE bSize
);
Parameters
wPortAddr
[in] I/O port address dwPortVal
[in] Value to be written to the port bSize
[in] Number of bytes to write.
Can be 1 (BYTE), 2 (WORD) or 4 (DWORD).
Return Values
If the function succeeds, the return value is true. Otherwise, the function returns false.
Res
The SetPortVal function writes a byte, a word or a double word to the specified I/O port. Note: Under Windows 98/ME, an application must use the SetPortVal function to write values to an I/O port. Under Windows NT/2000/XP, it is possible to use the _outp/_outpw/_outpd functions instead of using SetPortVal, provided that the InitializeWinIo function has been called beforehand.
我想通VB6.0对并口进行数据的收发。我使用的是winIO.dll中函数 setportval和getportval
. 我用一小灯泡来检验并口的数据(如是1则亮)。我用别人编译好的VB程序在xp下能够顺利的运行,但我自己调用setprotval时,却没有现象。
setprotval(&h378,255,1);以下是关于些函数的说明。
This function writes a BYTE/WORD/DWORD value to an I/O port. bool _stdcall SetPortVal(
WORD wPortAddr,
DWORD dwPortVal,
BYTE bSize
);
Parameters
wPortAddr
[in] I/O port address dwPortVal
[in] Value to be written to the port bSize
[in] Number of bytes to write.
Can be 1 (BYTE), 2 (WORD) or 4 (DWORD).
Return Values
If the function succeeds, the return value is true. Otherwise, the function returns false.
Res
The SetPortVal function writes a byte, a word or a double word to the specified I/O port. Note: Under Windows 98/ME, an application must use the SetPortVal function to write values to an I/O port. Under Windows NT/2000/XP, it is possible to use the _outp/_outpw/_outpd functions instead of using SetPortVal, provided that the InitializeWinIo function has been called beforehand.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货