主题 : 大家帮我看看怎么就一直错呢 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 74128
精华: 0
发帖: 17
金钱: 85 两
威望: 17 点
贡献值: 0 点
综合积分: 34 分
注册时间: 2012-07-19
最后登录: 2012-09-12
楼主  发表于: 2012-07-27 15:14

 大家帮我看看怎么就一直错呢

#include "gpio.h"
HANDLE hFile=INVALID_HANDLE_VALUE;
void CGPIOBeepDlg::OnOpenPio1()
    {
        BOOL ret;
        BYTE pinnum=10;

        hFile=CreateFile(TEXT("PIO1:"),GRNERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,0);
        if(hFile==INVALID_HANDLE_VALUE)
        {
            MessageBox(_T("打开GPIO驱动失败!"));
            return;
        }
        else
            MessageBox(_T("打开GPIO驱动成功!"));

        ret=::DeviceIoControl(hFile,IOCTL_GPH_SET_PIN_OUT,&pinnum,1,NULL,0,NULL,NULL);
        if(ret!=TRUE)
        {
            OnClosePio1();
            MessageBox(_T("设置GPH10引脚输出失败!"));
            return;
        }
        CButton*pOpenButten=(CButton*)GetDlgItem(IDC_OPEN_PIO1);
        CButton*pCloseButten=(CButton*)GetDlgItem(IDC_CLOSE_PIO1);
        pOpenButton->EnableWindow(FALSE);
        pCloseButton->EnableWindow(TRUE);
}
一直错误,照着书上敲的,就一直错误
F:\text\GPIOBeep\GPIOBeepDlg.cpp(72) : error C2065: 'GRNERIC_READ' : undeclared identifier
F:\text\GPIOBeep\GPIOBeepDlg.cpp(90) : error C2065: 'pOpenButton' : undeclared identifier
F:\text\GPIOBeep\GPIOBeepDlg.cpp(90) : error C2227: left of '->EnableWindow' must point to class/struct/union
F:\text\GPIOBeep\GPIOBeepDlg.cpp(91) : error C2065: 'pCloseButton' : undeclared identifier
F:\text\GPIOBeep\GPIOBeepDlg.cpp(91) : error C2227: left of '->EnableWindow' must point to class/struct/union
Error executing clarm.exe.

GPIOBeep.exe - 5 error(s), 0 warning(s)
级别: 新手上路
UID: 74128
精华: 0
发帖: 17
金钱: 85 两
威望: 17 点
贡献值: 0 点
综合积分: 34 分
注册时间: 2012-07-19
最后登录: 2012-09-12
1楼  发表于: 2012-07-27 15:49
hFile=CreateFile(TEXT("PIO1:"),GRNERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,0);我看就是这么用的啊