I am not sure how to ask this one, but If I have code that can enumerate USB devices, I thought I would then do a "CreateFile" to check if the file was already in use or not.
Pierre Bellisle has the closest and best (YET AGAIN) example in the forums with Hardware enumeration using SetupApi.dll
Although his and many others use HID.dll at some point (not sure if it just because it works, or just because "You have to to in order to get the answer")
Sure I could use WMI, or some other way, but 1st I want to learn 1 concept at a time. (Although if I have to, SetupAPI and HID together is not out of the question if thats what I have to do)
It seems all the examples tend to follow the same pattern of
Do you have to HID to find the name of the file that you want to open if you do a "CreateFile"? or is there another way I missed on "SetupApi.INC"?
Sorry if I sound convoluted, but maybe Pierre, or Kev are watching (since most the code is blatantly "stolen" from them
(and a few MSDN docs
) or a few others that may know about USB
All in all, my example I am working on would do the following:
in this case, it may be a concept that I have to try one then the other to determine, but hoping if all SetupApi.Inc then I can thin down my avenues a bit
Pierre Bellisle has the closest and best (YET AGAIN) example in the forums with Hardware enumeration using SetupApi.dll
Although his and many others use HID.dll at some point (not sure if it just because it works, or just because "You have to to in order to get the answer")
Sure I could use WMI, or some other way, but 1st I want to learn 1 concept at a time. (Although if I have to, SetupAPI and HID together is not out of the question if thats what I have to do)
It seems all the examples tend to follow the same pattern of
Code:
[color=blue]HidD_GetHidGuid tHidGuid[/color] ' Init some items tIfcData.cbSize = SIZEOF(tIfcData) tIfcDetail.cbSize = 5 '<---If correct, sould be sizeof(tIfcDetail.cbSize) and not a hardcoded value
Sorry if I sound convoluted, but maybe Pierre, or Kev are watching (since most the code is blatantly "stolen" from them


All in all, my example I am working on would do the following:
- List Devices known to Windows (whether currently attached or not), or list devices that at some point were attached
- Use CreateFile (unless there is a better way) to see if it is available, or already in use
- Excluding the mix of "USB adapters to --->Serial or Parallel, or some other format, I think as long as I know what I am trying to open, then I either get a succeed or fail"
in this case, it may be a concept that I have to try one then the other to determine, but hoping if all SetupApi.Inc then I can thin down my avenues a bit

Comment