我加了头文件#include "Dbt.h",但是执行的时候老说
error C2065: 'DEV_BROADCAST_DEVICEINTERFACE' : undeclared identifier
17 个解决方案
#1
问题说得不明白,就是没有定义变量或者是结构'DEV_BROADCAST_DEVICEINTERFACE'
#2
可以看看两个工程的设置是不是一样
#3
设置是一样的
'DEV_BROADCAST_DEVICEINTERFACE'
这个是微软的基础类库里的啊,不用自己定义的, 只要加了#include "Dbt.h"就可以的
我就是不知道为什么会出这样的错误
'DEV_BROADCAST_DEVICEINTERFACE'
这个是微软的基础类库里的啊,不用自己定义的, 只要加了#include "Dbt.h"就可以的
我就是不知道为什么会出这样的错误
#4
怎么没人来救救我啊
#5
谁会啊,加分
#6
宏定义的问题.
#7
你的两个工程是不是在一起编译的???
可能是这个问题:
在以前的工程中定义了.h文件
然后又定义了一遍
因为.h文件中大多会有怎么一句
#ifndefine ...._H_
#define ..._H_
可能是这样
可能是这个问题:
在以前的工程中定义了.h文件
然后又定义了一遍
因为.h文件中大多会有怎么一句
#ifndefine ...._H_
#define ..._H_
可能是这样
#8
那这个怎么解决啊?
我是要把A的功能在B里实现,我就把A的主要代码都拷到B里了啊
我是要把A的功能在B里实现,我就把A的主要代码都拷到B里了啊
#9
我的是一个工程
#10
查找一下那个宏的定义
然后复制过来即可
然后复制过来即可
#11
typedef struct _DEV_BROADCAST_DEVICEINTERFACE {
DWORD dbcc_size;
DWORD dbcc_devicetype;
DWORD dbcc_reserved;
GUID dbcc_classguid;
TCHAR dbcc_name[1];
} DEV_BROADCAST_DEVICEINTERFACE *PDEV_BROADCAST_DEVICEINTERFACE;
就是把这复制过去是吧?
好象没用
DWORD dbcc_size;
DWORD dbcc_devicetype;
DWORD dbcc_reserved;
GUID dbcc_classguid;
TCHAR dbcc_name[1];
} DEV_BROADCAST_DEVICEINTERFACE *PDEV_BROADCAST_DEVICEINTERFACE;
就是把这复制过去是吧?
好象没用
#12
typedef struct _DEV_BROADCAST_DEVICEINTERFACE {
DWORD dbcc_size;
DWORD dbcc_devicetype;
DWORD dbcc_reserved;
GUID dbcc_classguid;
TCHAR dbcc_name[1];
} DEV_BROADCAST_DEVICEINTERFACE, *PDEV_BROADCAST_DEVICEINTERFACE;
中间有个逗号
DWORD dbcc_size;
DWORD dbcc_devicetype;
DWORD dbcc_reserved;
GUID dbcc_classguid;
TCHAR dbcc_name[1];
} DEV_BROADCAST_DEVICEINTERFACE, *PDEV_BROADCAST_DEVICEINTERFACE;
中间有个逗号
#13
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(187) : error C2065: 'DEV_BROADCAST_DEVICEINTERFACE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(187) : error C2146: syntax error : missing ';' before identifier 'dbi'
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(187) : error C2065: 'dbi' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(189) : error C2228: left of '.dbcc_size' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(190) : error C2228: left of '.dbcc_devicetype' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(190) : error C2065: 'DBT_DEVTYP_DEVICEINTERFACE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(191) : error C2228: left of '.dbcc_reserved' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(192) : error C2228: left of '.dbcc_classguid' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'HDEVNOTIFY' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2146: syntax error : missing ';' before identifier 'hDevNotify'
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'hDevNotify' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(196) : error C2065: 'RegisterDeviceNotification' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(199) : error C2065: 'DEVICE_NOTIFY_WINDOW_HANDLE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(547) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(552) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(571) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(627) : warning C4018: '<' : signed/unsigned mismatch
Generating Code...
Error executing cl.exe.
Creating browse info file...
TimeClock.exe - 13 error(s), 4 warning(s)
没加之前是上面的错误,加了之后
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(190) : error C2065: 'DBT_DEVTYP_DEVICEINTERFACE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'HDEVNOTIFY' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2146: syntax error : missing ';' before identifier 'hDevNotify'
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'hDevNotify' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(196) : error C2065: 'RegisterDeviceNotification' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(199) : error C2065: 'DEVICE_NOTIFY_WINDOW_HANDLE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(547) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(552) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(571) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(627) : warning C4018: '<' : signed/unsigned mismatch
Generating Code...
Error executing cl.exe.
Creating browse info file...
TimeClock.exe - 6 error(s), 4 warning(s)
出错的地方代码为
InitEditBox();
GUID hid_guid={0x4D1E55B2,0xF16F,0x11CF,0x88,0xCB,0x00,0x11,0x11,0x00,0x00,0x30};
DEV_BROADCAST_DEVICEINTERFACE dbi;
ZeroMemory(&dbi,sizeof(dbi));
dbi.dbcc_size=sizeof(dbi);
dbi.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
dbi.dbcc_reserved = 0;
dbi.dbcc_classguid = hid_guid;
HDEVNOTIFY hDevNotify;
hDevNotify = RegisterDeviceNotification(m_hWnd,
&dbi,
DEVICE_NOTIFY_WINDOW_HANDLE
);
if(!hDevNotify)
{
int Err = GetLastError();
printf( "RegisterDeviceNotification failed: %lx.\n", Err);
return FALSE;
}
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(187) : error C2146: syntax error : missing ';' before identifier 'dbi'
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(187) : error C2065: 'dbi' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(189) : error C2228: left of '.dbcc_size' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(190) : error C2228: left of '.dbcc_devicetype' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(190) : error C2065: 'DBT_DEVTYP_DEVICEINTERFACE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(191) : error C2228: left of '.dbcc_reserved' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(192) : error C2228: left of '.dbcc_classguid' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'HDEVNOTIFY' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2146: syntax error : missing ';' before identifier 'hDevNotify'
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'hDevNotify' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(196) : error C2065: 'RegisterDeviceNotification' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(199) : error C2065: 'DEVICE_NOTIFY_WINDOW_HANDLE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(547) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(552) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(571) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(627) : warning C4018: '<' : signed/unsigned mismatch
Generating Code...
Error executing cl.exe.
Creating browse info file...
TimeClock.exe - 13 error(s), 4 warning(s)
没加之前是上面的错误,加了之后
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(190) : error C2065: 'DBT_DEVTYP_DEVICEINTERFACE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'HDEVNOTIFY' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2146: syntax error : missing ';' before identifier 'hDevNotify'
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'hDevNotify' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(196) : error C2065: 'RegisterDeviceNotification' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(199) : error C2065: 'DEVICE_NOTIFY_WINDOW_HANDLE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(547) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(552) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(571) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(627) : warning C4018: '<' : signed/unsigned mismatch
Generating Code...
Error executing cl.exe.
Creating browse info file...
TimeClock.exe - 6 error(s), 4 warning(s)
出错的地方代码为
InitEditBox();
GUID hid_guid={0x4D1E55B2,0xF16F,0x11CF,0x88,0xCB,0x00,0x11,0x11,0x00,0x00,0x30};
DEV_BROADCAST_DEVICEINTERFACE dbi;
ZeroMemory(&dbi,sizeof(dbi));
dbi.dbcc_size=sizeof(dbi);
dbi.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
dbi.dbcc_reserved = 0;
dbi.dbcc_classguid = hid_guid;
HDEVNOTIFY hDevNotify;
hDevNotify = RegisterDeviceNotification(m_hWnd,
&dbi,
DEVICE_NOTIFY_WINDOW_HANDLE
);
if(!hDevNotify)
{
int Err = GetLastError();
printf( "RegisterDeviceNotification failed: %lx.\n", Err);
return FALSE;
}
#14
自己已经找到错误的原因了
在StdAfx.h添加
#define WINVER 0x0500
具体参考http://blog.5d.cn/user18/sphinxzh/200612/336888.html
在StdAfx.h添加
#define WINVER 0x0500
具体参考http://blog.5d.cn/user18/sphinxzh/200612/336888.html
#15
加我我帮你做吧
#16
确实好用,非常感谢!!!
#17
确实管用 谢谢LZ
#1
问题说得不明白,就是没有定义变量或者是结构'DEV_BROADCAST_DEVICEINTERFACE'
#2
可以看看两个工程的设置是不是一样
#3
设置是一样的
'DEV_BROADCAST_DEVICEINTERFACE'
这个是微软的基础类库里的啊,不用自己定义的, 只要加了#include "Dbt.h"就可以的
我就是不知道为什么会出这样的错误
'DEV_BROADCAST_DEVICEINTERFACE'
这个是微软的基础类库里的啊,不用自己定义的, 只要加了#include "Dbt.h"就可以的
我就是不知道为什么会出这样的错误
#4
怎么没人来救救我啊
#5
谁会啊,加分
#6
宏定义的问题.
#7
你的两个工程是不是在一起编译的???
可能是这个问题:
在以前的工程中定义了.h文件
然后又定义了一遍
因为.h文件中大多会有怎么一句
#ifndefine ...._H_
#define ..._H_
可能是这样
可能是这个问题:
在以前的工程中定义了.h文件
然后又定义了一遍
因为.h文件中大多会有怎么一句
#ifndefine ...._H_
#define ..._H_
可能是这样
#8
那这个怎么解决啊?
我是要把A的功能在B里实现,我就把A的主要代码都拷到B里了啊
我是要把A的功能在B里实现,我就把A的主要代码都拷到B里了啊
#9
我的是一个工程
#10
查找一下那个宏的定义
然后复制过来即可
然后复制过来即可
#11
typedef struct _DEV_BROADCAST_DEVICEINTERFACE {
DWORD dbcc_size;
DWORD dbcc_devicetype;
DWORD dbcc_reserved;
GUID dbcc_classguid;
TCHAR dbcc_name[1];
} DEV_BROADCAST_DEVICEINTERFACE *PDEV_BROADCAST_DEVICEINTERFACE;
就是把这复制过去是吧?
好象没用
DWORD dbcc_size;
DWORD dbcc_devicetype;
DWORD dbcc_reserved;
GUID dbcc_classguid;
TCHAR dbcc_name[1];
} DEV_BROADCAST_DEVICEINTERFACE *PDEV_BROADCAST_DEVICEINTERFACE;
就是把这复制过去是吧?
好象没用
#12
typedef struct _DEV_BROADCAST_DEVICEINTERFACE {
DWORD dbcc_size;
DWORD dbcc_devicetype;
DWORD dbcc_reserved;
GUID dbcc_classguid;
TCHAR dbcc_name[1];
} DEV_BROADCAST_DEVICEINTERFACE, *PDEV_BROADCAST_DEVICEINTERFACE;
中间有个逗号
DWORD dbcc_size;
DWORD dbcc_devicetype;
DWORD dbcc_reserved;
GUID dbcc_classguid;
TCHAR dbcc_name[1];
} DEV_BROADCAST_DEVICEINTERFACE, *PDEV_BROADCAST_DEVICEINTERFACE;
中间有个逗号
#13
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(187) : error C2065: 'DEV_BROADCAST_DEVICEINTERFACE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(187) : error C2146: syntax error : missing ';' before identifier 'dbi'
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(187) : error C2065: 'dbi' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(189) : error C2228: left of '.dbcc_size' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(190) : error C2228: left of '.dbcc_devicetype' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(190) : error C2065: 'DBT_DEVTYP_DEVICEINTERFACE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(191) : error C2228: left of '.dbcc_reserved' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(192) : error C2228: left of '.dbcc_classguid' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'HDEVNOTIFY' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2146: syntax error : missing ';' before identifier 'hDevNotify'
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'hDevNotify' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(196) : error C2065: 'RegisterDeviceNotification' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(199) : error C2065: 'DEVICE_NOTIFY_WINDOW_HANDLE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(547) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(552) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(571) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(627) : warning C4018: '<' : signed/unsigned mismatch
Generating Code...
Error executing cl.exe.
Creating browse info file...
TimeClock.exe - 13 error(s), 4 warning(s)
没加之前是上面的错误,加了之后
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(190) : error C2065: 'DBT_DEVTYP_DEVICEINTERFACE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'HDEVNOTIFY' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2146: syntax error : missing ';' before identifier 'hDevNotify'
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'hDevNotify' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(196) : error C2065: 'RegisterDeviceNotification' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(199) : error C2065: 'DEVICE_NOTIFY_WINDOW_HANDLE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(547) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(552) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(571) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(627) : warning C4018: '<' : signed/unsigned mismatch
Generating Code...
Error executing cl.exe.
Creating browse info file...
TimeClock.exe - 6 error(s), 4 warning(s)
出错的地方代码为
InitEditBox();
GUID hid_guid={0x4D1E55B2,0xF16F,0x11CF,0x88,0xCB,0x00,0x11,0x11,0x00,0x00,0x30};
DEV_BROADCAST_DEVICEINTERFACE dbi;
ZeroMemory(&dbi,sizeof(dbi));
dbi.dbcc_size=sizeof(dbi);
dbi.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
dbi.dbcc_reserved = 0;
dbi.dbcc_classguid = hid_guid;
HDEVNOTIFY hDevNotify;
hDevNotify = RegisterDeviceNotification(m_hWnd,
&dbi,
DEVICE_NOTIFY_WINDOW_HANDLE
);
if(!hDevNotify)
{
int Err = GetLastError();
printf( "RegisterDeviceNotification failed: %lx.\n", Err);
return FALSE;
}
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(187) : error C2146: syntax error : missing ';' before identifier 'dbi'
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(187) : error C2065: 'dbi' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(189) : error C2228: left of '.dbcc_size' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(190) : error C2228: left of '.dbcc_devicetype' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(190) : error C2065: 'DBT_DEVTYP_DEVICEINTERFACE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(191) : error C2228: left of '.dbcc_reserved' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(192) : error C2228: left of '.dbcc_classguid' must have class/struct/union type
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'HDEVNOTIFY' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2146: syntax error : missing ';' before identifier 'hDevNotify'
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'hDevNotify' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(196) : error C2065: 'RegisterDeviceNotification' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(199) : error C2065: 'DEVICE_NOTIFY_WINDOW_HANDLE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(547) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(552) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(571) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(627) : warning C4018: '<' : signed/unsigned mismatch
Generating Code...
Error executing cl.exe.
Creating browse info file...
TimeClock.exe - 13 error(s), 4 warning(s)
没加之前是上面的错误,加了之后
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(190) : error C2065: 'DBT_DEVTYP_DEVICEINTERFACE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'HDEVNOTIFY' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2146: syntax error : missing ';' before identifier 'hDevNotify'
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(194) : error C2065: 'hDevNotify' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(196) : error C2065: 'RegisterDeviceNotification' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(199) : error C2065: 'DEVICE_NOTIFY_WINDOW_HANDLE' : undeclared identifier
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(547) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(552) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(571) : warning C4018: '<' : signed/unsigned mismatch
C:\Documents and Settings\goodo\桌面\GoodoEastRiver3\TimeClockDlg.cpp(627) : warning C4018: '<' : signed/unsigned mismatch
Generating Code...
Error executing cl.exe.
Creating browse info file...
TimeClock.exe - 6 error(s), 4 warning(s)
出错的地方代码为
InitEditBox();
GUID hid_guid={0x4D1E55B2,0xF16F,0x11CF,0x88,0xCB,0x00,0x11,0x11,0x00,0x00,0x30};
DEV_BROADCAST_DEVICEINTERFACE dbi;
ZeroMemory(&dbi,sizeof(dbi));
dbi.dbcc_size=sizeof(dbi);
dbi.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
dbi.dbcc_reserved = 0;
dbi.dbcc_classguid = hid_guid;
HDEVNOTIFY hDevNotify;
hDevNotify = RegisterDeviceNotification(m_hWnd,
&dbi,
DEVICE_NOTIFY_WINDOW_HANDLE
);
if(!hDevNotify)
{
int Err = GetLastError();
printf( "RegisterDeviceNotification failed: %lx.\n", Err);
return FALSE;
}
#14
自己已经找到错误的原因了
在StdAfx.h添加
#define WINVER 0x0500
具体参考http://blog.5d.cn/user18/sphinxzh/200612/336888.html
在StdAfx.h添加
#define WINVER 0x0500
具体参考http://blog.5d.cn/user18/sphinxzh/200612/336888.html
#15
加我我帮你做吧
#16
确实好用,非常感谢!!!
#17
确实管用 谢谢LZ