0

Stupid question. I think this should be 0, but I can't seem to find it.

So, if I want to pass a Null value to a Windows API call (this happens to be in VB6), what value would I use? I think 0, but I guess it could be VBNull.

Clay Nichols
  • 11,848
  • 30
  • 109
  • 170

2 Answers2

1

If the API argument is a LONG (and not, say, an LPVOID), try passing the zero long integer literal 0&.

Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
1

Often this would be a null pointer and not a null value.

Then it depends on the Declare syntax actually used. If the declared argument was a ByRef ... As ... item then you'd say ByVal 0& (or sometimes vbNullString) in your call.

However if you declared pointers as ByVal ... As Long in the declaration (for use with VarPtr(), StrPtr(), etc.) simply using 0& in the call is what you want.

Bob77
  • 13,167
  • 1
  • 29
  • 37