danielxu22
驱动中牛
驱动中牛
  • 注册日期2002-11-22
  • 最后登录2014-03-24
  • 粉丝0
  • 关注1
  • 积分2分
  • 威望18点
  • 贡献值0点
  • 好评度7点
  • 原创分0分
  • 专家分0分
阅读:1083回复:2

OpenByInterface调用问题

楼主#
更多 发布于:2002-12-04 16:31
ds help上的帮助:

Using Device Interfaces from Application Level
DriverWorks provides two classes for application level support of device interfaces: CDeviceInterfaceClass and CDeviceInterface. These classes are declared and implemented in file devintf.h, which resides in subdirectory .\\include of the DriverWorks installation.

Class CDeviceInterfaceClass wraps a device information set containing information about all device interfaces of a particular class.

An application can use an instance of CDeviceInterfaceClass to obtain one or more instances of CDeviceInterface. Class CDeviceInterface abstracts a single device interface. Its member function DevicePath() returns a pointer to a pathname, which can be passed to CreateFile to open the device.

Here is a small sample showing the most basic usage of these classes:

extern GUID TestGuid;
HANDLE OpenByInterface(
  GUID* pClassGuid,
  DWORD instance,
  PDWORD pError
)
{
  CDeviceInterfaceClass DevClass(pClassGuid, pError);
  if (*pError != ERROR_SUCCESS)
    return INVALID_HANDLE_VALUE;
  CDeviceInterface DevInterface(&DevClass, instance, pError);
  if (*pError != ERROR_SUCCESS)
    return INVALID_HANDLE_VALUE;
  cout << \"The device path is \"
    << DevInterface.DevicePath()
    << endl;

  HANDLE hDev;
  hDev = CreateFile(
    DevInterface.DevicePath(),
    GENERIC_READ | GENERIC_WRITE,
    FILE_SHARE_READ | FILE_SHARE_WRITE,
    NULL,
    OPEN_EXISTING,
    FILE_ATTRIBUTE_NORMAL,
    NULL
  );
  if (hDev == INVALID_HANDLE_VALUE)
    *pError = GetLastError();
  return hDev;
}
这个东东怎么用啊!
编译后报错:
Command line error D2021 : invalid numeric argument \'/Wp64\'
什么意思啊!
这个东东还不会用了,大虾帮一下了
今天我发现我家的金鱼淹死了,:(
ydyuse
驱动老牛
驱动老牛
  • 注册日期2002-07-25
  • 最后登录2005-03-26
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2002-12-04 16:55
这不是CODE的问题,好象是编译命令的参数问题啊。
生命驱动,活力无限!
danielxu22
驱动中牛
驱动中牛
  • 注册日期2002-11-22
  • 最后登录2014-03-24
  • 粉丝0
  • 关注1
  • 积分2分
  • 威望18点
  • 贡献值0点
  • 好评度7点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2002-12-04 16:59
什么意思啊!不太明白,我现在要调试ds提供的hidmouse这个example,我想让它每隔一段时间发一个消息,也就是虚拟鼠标的移动,我要定义什么样的函数啊?
今天我发现我家的金鱼淹死了,:(
游客

返回顶部