标题:VC6.0环境下WinIO的SetPortVal调用失败
只看楼主
可爱的大海
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2019-3-8
 问题点数:0 回复次数:0 
VC6.0环境下WinIO的SetPortVal调用失败
求助:WinIo的SetPortVal函数调用失败问题
在VC6.0中,使用WinIO向并口发送数据,SetPortVal函数调用失败。并口是PCI转并口卡,地址为3FF8.
#include <windows.h>
#include <stdio.h>
#include "WinIo.h"

void main()
{
   
  DWORD dwPortVal=0x0;
  bool bResult = InitializeWinIo();
  WORD m_port=(WORD)0x3FF8;
  // Call InitializeWinIo to initialize the WinIo library.
  while(true)
  {

      
      if (bResult)
      {
        // Under Windows NT/2000/XP, after calling InitializeWinIo,
        // you can call _inp/_outp instead of using GetPortVal/SetPortVal
        bool bSet =    SetPortVal(m_port,1,1);
        if(!bSet)
            printf("失败!\n");
        break;
        GetPortVal(m_port, &dwPortVal, 1);
        printf("端口值:%d\n",dwPortVal);
        Sleep(500);

        bResult=false;
    //    printf("success run WinIo.\n");

        // When you're done using WinIo, call ShutdownWinIo
      }
      if(!bResult)
      {
        // Under Windows NT/2000/XP, after calling InitializeWinIo,
        // you can call _inp/_outp instead of using GetPortVal/SetPortVal
        bool bSet =    SetPortVal(m_port,0,1);
        GetPortVal(m_port, &dwPortVal, 1);
        printf("端口值:%d\n",dwPortVal);
        Sleep(500);

        bResult=true;
    //    printf("success run WinIo.\n");

        // When you're done using WinIo, call ShutdownWinIo
      }
        
  }
  
ShutdownWinIo();

}
运行结果是显示失败,说明SetPortVal函数调用失败。请问原因出在哪?
搜索更多相关主题的帖子: 调用 失败 Call using printf 
2019-03-08 16:53



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-493472-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.063367 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved