From: jQuartly on 18 Nov 2008 19:18 Hi all, I was advised here (http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/af92144a-2c7d-4d0c-b420-11385527e7b5) that this would be the place to ask, so if i've got it wrong again sorry. I'm tasked with writing an application to communicate with a USB card reader (HID device) and a Barcode scanner, we use Visual Studio 6, so i could do this in VB6 if it might be easier but the rest of the application is in VC++ (and it's what i know best allegedy). The application needs to be able to detect when the device is present and plugged in as well as being able to send and receive USB reports (so i'd say i'm writing a driver for the readers as well) to query the device's status. From what i gather the functions i want to be able to use are in the hid.dll library. But i'm confused about the whole DDK thing, various places have said that you shouldn't and can't use the VC++ environment with these functions, but I find it hard to believe that with the header and libraries that i cannot use these functions (HidD_GetHidGuid() to name one) from the dll in a VC++ app. I've been trawling around the net for ages without much luck getting increasingly frustrated and confused. I have followed instructions from the book USB complete to the letter and still i am unable to get the app to compile. Anyway enough moaning about it here is what i have done: 1) Create a new MFC application within VC++ 2) gone to Project > Settings > Link > Category: Input and In the Object/library modules box entered hid.lib and setupapi. lib. 3) added the correct directory to the Additional library path field 4) included the correct header files: extern "C" { #include "hidsdi.h" #include <setupapi.h> } 5) Finally added a call to the function into my application in the InitInstance() function like so: GUID HidGuid; HidD_GetHidGuid(&HidGuid); 6) hit compile and got a whole load of errors: c:\winddk\6001.18002\inc\api\hidpi.h(514) : error C2065: '__in' : undeclared identifier c:\winddk\6001.18002\inc\api\hidpi.h(514) : error C2146: syntax error : missing ')' before identifier 'HIDP_REPORT_TYPE' c:\winddk\6001.18002\inc\api\hidpi.h(514) : warning C4229: anachronism used : modifiers on data are ignored c:\winddk\6001.18002\inc\api\hidpi.h(519) : error C2059: syntax error : ')' c:\winddk\6001.18002\inc\api\hidpi.h(552) : error C2146: syntax error : missing ')' before identifier 'HIDP_REPORT_TYPE' c:\winddk\6001.18002\inc\api\hidpi.h(552) : warning C4229: anachronism used : modifiers on data are ignored c:\winddk\6001.18002\inc\api\hidpi.h(558) : error C2059: syntax error : ')' c:\winddk\6001.18002\inc\api\hidpi.h(624) : error C2146: syntax error : missing ')' before identifier 'HIDP_REPORT_TYPE' c:\winddk\6001.18002\inc\api\hidpi.h(624) : warning C4229: anachronism used : modifiers on data are ignored c:\winddk\6001.18002\inc\api\hidpi.h(630) : error C2059: syntax error : ')' (thats not all of them, but enough to illustrate the point i hope). So the question is how do i import HidD_GetHidGuid() (or any function from hid.dll) into my application successfully? I know it can be done as i downloaded some demonstration HID source and pointed it at the headers and libraries and it worked for a bit until i tinkered too far and ended up with the same result and i cannot remember how i got this demo to work. Please ask for more information if you need it to help me. Kind Regards, JQ
From: David Craig on 18 Nov 2008 19:47 VC6 is too old. Many of the headers in the current WDK will not compile with VC6. There are also instrinsics being used for some functions that not available in a compiler that old. Use VC6 only as an editor - if you must, but never to compile code based upon any current WDK. "jQuartly" <jQuartly(a)discussions.microsoft.com> wrote in message news:55217EF2-D61B-4CCA-A746-C568F2E443F6(a)microsoft.com... > Hi all, > I was advised here > (http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/af92144a-2c7d-4d0c-b420-11385527e7b5) > that this would be the place to ask, so if i've got it wrong again sorry. > > I'm tasked with writing an application to communicate with a USB card > reader > (HID device) and a Barcode scanner, we use Visual Studio 6, so i could do > this in VB6 if it might be easier but the rest of the application is in > VC++ > (and it's what i know best allegedy). The application needs to be able to > detect when the device is present and plugged in as well as being able to > send and receive USB reports (so i'd say i'm writing a driver for the > readers > as well) to query the device's status. From what i gather the functions i > want to be able to use are in the hid.dll library. But i'm confused about > the > whole DDK thing, various places have said that you shouldn't and can't use > the VC++ environment with these functions, but I find it hard to believe > that > with the header and libraries that i cannot use these functions > (HidD_GetHidGuid() to name one) from the dll in a VC++ app. I've been > trawling around the net for ages without much luck getting increasingly > frustrated and confused. > > I have followed instructions from the book USB complete to the letter and > still i am unable to get the app to compile. > > Anyway enough moaning about it here is what i have done: > 1) Create a new MFC application within VC++ > 2) gone to Project > Settings > Link > Category: Input and In the > Object/library modules box entered hid.lib and setupapi. lib. > 3) added the correct directory to the Additional library path field > 4) included the correct header files: > extern "C" { > #include "hidsdi.h" > #include <setupapi.h> > } > 5) Finally added a call to the function into my application in the > InitInstance() function like so: > GUID HidGuid; > HidD_GetHidGuid(&HidGuid); > 6) hit compile and got a whole load of errors: > c:\winddk\6001.18002\inc\api\hidpi.h(514) : error C2065: '__in' : > undeclared > identifier > c:\winddk\6001.18002\inc\api\hidpi.h(514) : error C2146: syntax error : > missing ')' before identifier 'HIDP_REPORT_TYPE' > c:\winddk\6001.18002\inc\api\hidpi.h(514) : warning C4229: anachronism > used > : modifiers on data are ignored > c:\winddk\6001.18002\inc\api\hidpi.h(519) : error C2059: syntax error : > ')' > c:\winddk\6001.18002\inc\api\hidpi.h(552) : error C2146: syntax error : > missing ')' before identifier 'HIDP_REPORT_TYPE' > c:\winddk\6001.18002\inc\api\hidpi.h(552) : warning C4229: anachronism > used > : modifiers on data are ignored > c:\winddk\6001.18002\inc\api\hidpi.h(558) : error C2059: syntax error : > ')' > c:\winddk\6001.18002\inc\api\hidpi.h(624) : error C2146: syntax error : > missing ')' before identifier 'HIDP_REPORT_TYPE' > c:\winddk\6001.18002\inc\api\hidpi.h(624) : warning C4229: anachronism > used > : modifiers on data are ignored > c:\winddk\6001.18002\inc\api\hidpi.h(630) : error C2059: syntax error : > ')' > > (thats not all of them, but enough to illustrate the point i hope). > > So the question is how do i import HidD_GetHidGuid() (or any function from > hid.dll) into my application successfully? > > I know it can be done as i downloaded some demonstration HID source and > pointed it at the headers and libraries and it worked for a bit until i > tinkered too far and ended up with the same result and i cannot remember > how > i got this demo to work. > > Please ask for more information if you need it to help me. > > Kind Regards, > > JQ
From: jQuartly on 18 Nov 2008 20:03 Thanks for the quick reply, unfortunately you gave the answer i expected and feared. Is there anywhere i can get an older VC++ 6 compatible version of WDK or is there any other way of doing low level communications with a HID USB device or is upgrading the only way now? "David Craig" wrote: > VC6 is too old. Many of the headers in the current WDK will not compile > with VC6. There are also instrinsics being used for some functions that not > available in a compiler that old. Use VC6 only as an editor - if you must, > but never to compile code based upon any current WDK. > > > "jQuartly" <jQuartly(a)discussions.microsoft.com> wrote in message > news:55217EF2-D61B-4CCA-A746-C568F2E443F6(a)microsoft.com... > > Hi all, > > I was advised here > > (http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/af92144a-2c7d-4d0c-b420-11385527e7b5) > > that this would be the place to ask, so if i've got it wrong again sorry. > > > > I'm tasked with writing an application to communicate with a USB card > > reader > > (HID device) and a Barcode scanner, we use Visual Studio 6, so i could do > > this in VB6 if it might be easier but the rest of the application is in > > VC++ > > (and it's what i know best allegedy). The application needs to be able to > > detect when the device is present and plugged in as well as being able to > > send and receive USB reports (so i'd say i'm writing a driver for the > > readers > > as well) to query the device's status. From what i gather the functions i > > want to be able to use are in the hid.dll library. But i'm confused about > > the > > whole DDK thing, various places have said that you shouldn't and can't use > > the VC++ environment with these functions, but I find it hard to believe > > that > > with the header and libraries that i cannot use these functions > > (HidD_GetHidGuid() to name one) from the dll in a VC++ app. I've been > > trawling around the net for ages without much luck getting increasingly > > frustrated and confused. > > > > I have followed instructions from the book USB complete to the letter and > > still i am unable to get the app to compile. > > > > Anyway enough moaning about it here is what i have done: > > 1) Create a new MFC application within VC++ > > 2) gone to Project > Settings > Link > Category: Input and In the > > Object/library modules box entered hid.lib and setupapi. lib. > > 3) added the correct directory to the Additional library path field > > 4) included the correct header files: > > extern "C" { > > #include "hidsdi.h" > > #include <setupapi.h> > > } > > 5) Finally added a call to the function into my application in the > > InitInstance() function like so: > > GUID HidGuid; > > HidD_GetHidGuid(&HidGuid); > > 6) hit compile and got a whole load of errors: > > c:\winddk\6001.18002\inc\api\hidpi.h(514) : error C2065: '__in' : > > undeclared > > identifier > > c:\winddk\6001.18002\inc\api\hidpi.h(514) : error C2146: syntax error : > > missing ')' before identifier 'HIDP_REPORT_TYPE' > > c:\winddk\6001.18002\inc\api\hidpi.h(514) : warning C4229: anachronism > > used > > : modifiers on data are ignored > > c:\winddk\6001.18002\inc\api\hidpi.h(519) : error C2059: syntax error : > > ')' > > c:\winddk\6001.18002\inc\api\hidpi.h(552) : error C2146: syntax error : > > missing ')' before identifier 'HIDP_REPORT_TYPE' > > c:\winddk\6001.18002\inc\api\hidpi.h(552) : warning C4229: anachronism > > used > > : modifiers on data are ignored > > c:\winddk\6001.18002\inc\api\hidpi.h(558) : error C2059: syntax error : > > ')' > > c:\winddk\6001.18002\inc\api\hidpi.h(624) : error C2146: syntax error : > > missing ')' before identifier 'HIDP_REPORT_TYPE' > > c:\winddk\6001.18002\inc\api\hidpi.h(624) : warning C4229: anachronism > > used > > : modifiers on data are ignored > > c:\winddk\6001.18002\inc\api\hidpi.h(630) : error C2059: syntax error : > > ')' > > > > (thats not all of them, but enough to illustrate the point i hope). > > > > So the question is how do i import HidD_GetHidGuid() (or any function from > > hid.dll) into my application successfully? > > > > I know it can be done as i downloaded some demonstration HID source and > > pointed it at the headers and libraries and it worked for a bit until i > > tinkered too far and ended up with the same result and i cannot remember > > how > > i got this demo to work. > > > > Please ask for more information if you need it to help me. > > > > Kind Regards, > > > > JQ > > >
From: David Craig on 18 Nov 2008 21:33 I have them all, but I don't believe most of them are available. If you have a MSDN subscription, you can find some in the downloads area. HID is not my area, but maybe Doron knows. I think it may be very difficult to find what you are looking for. Why not use the free Visual Studio 2008? That may work better for you. Some things may be missing from that version, so I am not sure it can be made to work. With the latest SDK/WDK and the free one you may have a chance. "jQuartly" <jQuartly(a)discussions.microsoft.com> wrote in message news:20EB7601-A17D-49B0-84C5-60D58A5DEB16(a)microsoft.com... > Thanks for the quick reply, unfortunately you gave the answer i expected > and > feared. > Is there anywhere i can get an older VC++ 6 compatible version of WDK or > is > there any other way of doing low level communications with a HID USB > device > or is upgrading the only way now? > > "David Craig" wrote: > >> VC6 is too old. Many of the headers in the current WDK will not compile >> with VC6. There are also instrinsics being used for some functions that >> not >> available in a compiler that old. Use VC6 only as an editor - if you >> must, >> but never to compile code based upon any current WDK. >> >> >> "jQuartly" <jQuartly(a)discussions.microsoft.com> wrote in message >> news:55217EF2-D61B-4CCA-A746-C568F2E443F6(a)microsoft.com... >> > Hi all, >> > I was advised here >> > (http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/af92144a-2c7d-4d0c-b420-11385527e7b5) >> > that this would be the place to ask, so if i've got it wrong again >> > sorry. >> > >> > I'm tasked with writing an application to communicate with a USB card >> > reader >> > (HID device) and a Barcode scanner, we use Visual Studio 6, so i could >> > do >> > this in VB6 if it might be easier but the rest of the application is in >> > VC++ >> > (and it's what i know best allegedy). The application needs to be able >> > to >> > detect when the device is present and plugged in as well as being able >> > to >> > send and receive USB reports (so i'd say i'm writing a driver for the >> > readers >> > as well) to query the device's status. From what i gather the functions >> > i >> > want to be able to use are in the hid.dll library. But i'm confused >> > about >> > the >> > whole DDK thing, various places have said that you shouldn't and can't >> > use >> > the VC++ environment with these functions, but I find it hard to >> > believe >> > that >> > with the header and libraries that i cannot use these functions >> > (HidD_GetHidGuid() to name one) from the dll in a VC++ app. I've been >> > trawling around the net for ages without much luck getting increasingly >> > frustrated and confused. >> > >> > I have followed instructions from the book USB complete to the letter >> > and >> > still i am unable to get the app to compile. >> > >> > Anyway enough moaning about it here is what i have done: >> > 1) Create a new MFC application within VC++ >> > 2) gone to Project > Settings > Link > Category: Input and In the >> > Object/library modules box entered hid.lib and setupapi. lib. >> > 3) added the correct directory to the Additional library path field >> > 4) included the correct header files: >> > extern "C" { >> > #include "hidsdi.h" >> > #include <setupapi.h> >> > } >> > 5) Finally added a call to the function into my application in the >> > InitInstance() function like so: >> > GUID HidGuid; >> > HidD_GetHidGuid(&HidGuid); >> > 6) hit compile and got a whole load of errors: >> > c:\winddk\6001.18002\inc\api\hidpi.h(514) : error C2065: '__in' : >> > undeclared >> > identifier >> > c:\winddk\6001.18002\inc\api\hidpi.h(514) : error C2146: syntax error : >> > missing ')' before identifier 'HIDP_REPORT_TYPE' >> > c:\winddk\6001.18002\inc\api\hidpi.h(514) : warning C4229: anachronism >> > used >> > : modifiers on data are ignored >> > c:\winddk\6001.18002\inc\api\hidpi.h(519) : error C2059: syntax error : >> > ')' >> > c:\winddk\6001.18002\inc\api\hidpi.h(552) : error C2146: syntax error : >> > missing ')' before identifier 'HIDP_REPORT_TYPE' >> > c:\winddk\6001.18002\inc\api\hidpi.h(552) : warning C4229: anachronism >> > used >> > : modifiers on data are ignored >> > c:\winddk\6001.18002\inc\api\hidpi.h(558) : error C2059: syntax error : >> > ')' >> > c:\winddk\6001.18002\inc\api\hidpi.h(624) : error C2146: syntax error : >> > missing ')' before identifier 'HIDP_REPORT_TYPE' >> > c:\winddk\6001.18002\inc\api\hidpi.h(624) : warning C4229: anachronism >> > used >> > : modifiers on data are ignored >> > c:\winddk\6001.18002\inc\api\hidpi.h(630) : error C2059: syntax error : >> > ')' >> > >> > (thats not all of them, but enough to illustrate the point i hope). >> > >> > So the question is how do i import HidD_GetHidGuid() (or any function >> > from >> > hid.dll) into my application successfully? >> > >> > I know it can be done as i downloaded some demonstration HID source and >> > pointed it at the headers and libraries and it worked for a bit until i >> > tinkered too far and ended up with the same result and i cannot >> > remember >> > how >> > i got this demo to work. >> > >> > Please ask for more information if you need it to help me. >> > >> > Kind Regards, >> > >> > JQ >> >> >>
From: Pavel A. on 19 Nov 2008 07:08 jQuartly wrote: > Thanks for the quick reply, unfortunately you gave the answer i expected and > feared. The c compiler of WDK 6000+ is very close to one from VS 2008, so usually you can write usermode apps in VS 2005/2008 and include .h files from the WDK. The WDK itself can be used to write (not too bizarre) usermode code, such as interface DLLs or tests. VC6 is just too old to compile WDK .h files. Unfortunately, .NET bloat, runtime & manifest hell, bad performance of newer VC++ prevents many developers from upgrading. > Is there anywhere i can get an older VC++ 6 compatible version of WDK or is > there any other way of doing low level communications with a HID USB device > or is upgrading the only way now? Maybe you can write a simple and thin interface DLL to talk with your driver, using the current WDK toolkit, in pure C (static RTL, no MFC and other dependencies). Then, your VC6 or VB apps should be able to use that. By the way, if you write the driver, you _have_ to get clue about the WDK anyway. Good luck, --PA
|
Pages: 1 Prev: DEP and /NXCOMPAT troubles... Next: sector and cylinder Information |