Technical Document #24

Technical Document #24        [Product Version: 11.1.0 and below]
If a variable requires a pointer to be assigned to it, as in pBuffer = &dwVal, how do I do it in Visual basic (which does not support pointers)?

  • This document refers to development in Visual Basic 6.0.
    For information regarding WinDriver's support for Visual Basic .NET, refer to Technical Document #128.
  • Beginning with version 11.2.0 of WinDriver, Visual Basic 6.0 is no longer supported.

WinDriver provides you with the function WD_VB_GetAddress() for getting a pointer to a variable — i.e., its address. To obtain the pointer to a variable the function must be called as

   pBuffer = WD_VB_GetAddress (test, 1, 1)
   ' where "test" is the variable whose pointer is required.
   ' The other two parameters must always be one.

You can also use Visual Basic's VarPtr() function to get the pointer to a variable (i.e., it's address).

You can refer to the WinDriver Visual Basic samples and generated DriverWizard code for examples of using both WD_VB_GetAddress() and VarPtr() to acquire a pointer to a variable in Visual Basic.