Error With HDEVNOTIFY

Hi,
Currently iam Implementing USB Downloader in Win32 Console Application.
For Auto Detcection Iam registering the device notification like
Notification->hDevNotify = ::RegisterDeviceNotification(
hwnd,
&Filter,
DEVICE_NOTIFY_WINDOW_HANDLE
);

while declaring hdevNotify Iam getting Compilation Error.

struct Notification
{
// device interface class
GUID InterfaceClassGuid;
// handle returned by RegisterDeviceNotification
HDEVNOTIFY hDevNotify;
.......
// constructor

};


d\event_handlers.h(118) : error C2146: syntax error : missing ';' before identifier 'hDevNotify'
d:\event_handlers.h(118) : error C2501: 'HDEVNOTIFY' : missing storage-class or type specifiers
d:\event_handlers.h(118) : error C2501: 'hDevNotify' : missing storage-class or type specifiersh

I have also included #include "stdafx.h" & WinUser.h. Still iam facing this issue.

I need your help.

Thanks in Advance

regards



Answer this question

Error With HDEVNOTIFY

  • Evan Mulawski

    please make sure that you define WINVER more than 0x0500 at begining of stdafx.h

    good luck!



  • Rob MacFadyen

    Hi,

    I am also getting the same error I am using a MFC application I have inserted

    #define WINVER 0x0501 above stdafx.h

    thanks in avanced

    Regards

    Prasanna


  • Error With HDEVNOTIFY