I've found a wonky COM object in Windows that was poorly implemented (and I believe this is the reason the documentation suggests that it is not implemented at all).
Basically it wants two Longs passed as paramters. "Normally" the first one is a ByRef "size" and the second one is a ByRef start of an array.
Now, as in many Declare'd API calls, you can pass a Long array's first element like so:
That's fine if I know I need 1000 Longs worth of data. And it works just great!
But...
One feature of this call is that you can find out how much data it has for you (and how large to make your array) by doing a first call passing a NULL pointer as the second parameter, which would cause it to fill in your Size parameter.
This is common enough for String values and API calls that we have the provided constant vbNullString for this, but in this case the second parameter must be Long or else VB6 complains about a type mismatch.
So the point of this question is: How can I pass a Long NULL (or is that a NULL Long?) as a parameter to this method call?
Basically I need something that causes the compiler to put a 0 on the stack as an address of a Long. Tricks like ByVal 0& won't work since they're only accepted on Declare calls (you get a "type mismatch" trying that trick here).
Trying to pass Null just gets you "Invalid use of Null."
Basically it wants two Longs passed as paramters. "Normally" the first one is a ByRef "size" and the second one is a ByRef start of an array.
Now, as in many Declare'd API calls, you can pass a Long array's first element like so:
Code:
Dim Ary() As Long
Dim Size As Long
Redim Ary(1000 - 1)
Size = UBound(Ary) + 1
Obj.GetData Size, Ary(0)
But...
One feature of this call is that you can find out how much data it has for you (and how large to make your array) by doing a first call passing a NULL pointer as the second parameter, which would cause it to fill in your Size parameter.
This is common enough for String values and API calls that we have the provided constant vbNullString for this, but in this case the second parameter must be Long or else VB6 complains about a type mismatch.
So the point of this question is: How can I pass a Long NULL (or is that a NULL Long?) as a parameter to this method call?
Basically I need something that causes the compiler to put a 0 on the stack as an address of a Long. Tricks like ByVal 0& won't work since they're only accepted on Declare calls (you get a "type mismatch" trying that trick here).
Trying to pass Null just gets you "Invalid use of Null."