Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
APIs from QB64PE and parameters defined As Any and unions of types ?
#10
(06-01-2024, 01:18 AM)DSMan195276 Wrote: I don't have tons of time at the moment, but to address a couple of the things you mentioned:

You're correct about the `_OFFSET` type. The member you identified (`hDevice`) is a `HANDLE` type which is the same size as a pointer.

Yes `ASCIIZ * 50` would be a 50 byte string, you'll need to check if the 50 includes the NUL byte at the end or not (if it does, then you can use `STRING * 50` for it, if the NUL byte is extra then it's a `STRING * 51`).

The ` bRawData[1]` thing is hard to explain, but basically it's a C concept where the size of the TYPE/struct is not really defined, instead there's an array of unknown length at the end of it. If you read the specs, it says that the size of the `bRawData` array is `dwSizeHid * dwCount`. I assume you then split the `bRawData` bytes up into `dwSizeHid`-sized chunks and each is a HID report or something.

Also, something to keep in mind is the C padding rules. Each type has a required alignment and the C compiler will insert empty space between the members of the struct to make sure each member hits its required alignment. QB64 does not do this, so you have to manually insert extra members for the padding. The majority of those structures are designed such that they don't need any padding, but maybe not all of them.
Thanks so much for taking the time to explain all that. All I can say is, Good God! Why does it have to be so complicated!? There's a reason I prefer BASIC! But I do appreciate your taking the time to include all those details - it's a big help.
Thanks again!
Reply


Messages In This Thread
RE: APIs from QB64PE and parameters defined As Any and unions of types ? - by madscijr - 06-01-2024, 03:26 AM



Users browsing this thread: 7 Guest(s)