devxlogo

The Address of a Variable

The Address of a Variable

THE ADDRESS OF A VARIABLEVB5 includes a built-in VarPtr function (see tip “Use the Object Browser to Discover UndocumentedFeatures”), but this function isn’t available in VB4. The VB4 runtime library does include this function, butyou must declare it first:#If Win16 ThenDeclare Function VarPtr Lib _ “VB40016.DLL” (variable As Any) _ As Long#ElseDeclare Function VarPtr Lib _ “VB40032.DLL” (variable As Any) _ As Long#End IfThis function is useful when passing an external API routine a Type structure, and one of its fields is theaddress of another variable or record.

devx-admin

Share the Post: