Thanks Jan for your speedy reply.
I read your post and had some success with the linked information...although not totally.
I changed the code to include the following suggestions:
....#define WINVER 0x0500
....extern "C"{#include <hidsdi.h>}
So now the code looks like this:
//******************************************************************
//Listen.cc
#define WINVER 0x0500 // minimum required: 0x0500
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
extern "C"{
#include <hidsdi.h>
}
LPGUID test;
int _tmain(int argc, _TCHAR* argv[])
{
HidD_GetHidGuid(test);
while(1) {
printf("hello world");
}
return 0;
}
//****************************************************************
Then I tried to add a path for hid.lib to the library search directorties.
Right off the bat I found that the suggested method of menu options: Tools | Options | Projects and Solutions | VC++ Directories...didn't work. Instead, it resulted in a VC++ Directories message in the dialog box that said it was depricated.
Now the Visual Studio Express ver. 2012 Desktop options are: Project | Properties | Configuration Properties | VC++ Directories | Library Directories.
On my system, the full path of the 32bit and 64bit library directories where hid.lib resides are:
C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64....and
C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x86.
This "Windows Kit" series of files came as part of the Visual Studio Express install.
I added one path...tested...then tried the other.
No luck on the 64bit path...in fact, besides the first error, I had 30 additional Link errors.
SUCCESS ON THE 32Bit PATH...it compiled and linked fine.
I also had a new copy of the Windows DDK that had a set of paths of its own.
So I tried both the 64bit and 32bit DDK library paths:
Again 31 Link errors on the 64bit library path...C:\WinDDK\7600.16385.1\lib\win7\ia64.
Again SUCCESS on the 32bit library path..........C:\WinDDK\7600.16385.1\lib\win7\i386.
Also, I did some testing and found that the...#define WINVER 0x0500...was not necessary for the compile to work.
But the...extern "C"{#include <hidsdi.h>}...WAS INDEED REQUIRED for the builds to work.
So I had 4 versions of the program that I tested...two different 32bit pid.lib files "with and without" a #define WINVER 0x0500.
Now the bad news...
In all four cases...the listen.exe program would crash immediately after starting.
I hadn't expected this type of outcome. In my mind the GUID should act like a file handle. What we are doing is grabbing the GUID and not doing anything with it...while "hello world" grinds away in an infinite loop.
If I'm not mistaken isn't this GUID really just a handle into the linked-list of the HID devices? Does Windows have some kind of timer on the use of this handle?
This has me scratching my head...but that's why I'm here...