[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

Get address of an array in VB

I made a win32 api call "GetKeyboardState" and it needs a byte array pointer. How can I get the pointer for that array?
1 Solution
There is an undocumented feature in VB called VarPtr. It's a function that returns the address of a variable. It can give the address of any data type (long, single, double, arrays, etc...). Use it as such:

Dim address as long
Dim myVar as single

myVar = 1.24
address = VarPtr(myVar)

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now