NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

AddressOf Operator

A unary operator that creates a procedure delegate instance that references the specific procedure.

 AddressOf procedurename

The required procedurename specifies the procedure that will be referenced by the newly created procedure delegate.

Remarks

When a procedure name appears in an argument list, usually the procedure is evaluated, and the address of the procedure’s return value is passed. The AddressOf operator appears only in the call to the API procedure. The AddressOf operator can also be used within a Delegate Statement, which also produces a reference to the procedure, but allows the user more flexibility in where they can place the AddressOf operator within their code.

Warning   Using AddressOf may cause unpredictable results if you don't completely understand the concept of function callbacks. You must understand how the Basic portion of the callback works, and also the code of the DLL into which you are passing your function address. Debugging such interactions is difficult since the program runs in the same process as the development environment. In some cases, systematic debugging may not be possible.
Note   You can create your own call-back function prototypes in DLLs compiled with Microsoft Visual C++ (or similar tools). To work with AddressOf, your prototype must use the __stdcall calling convention. The default calling convention (__cdecl) will not work with AddressOf.

See Also

Example

Declare Statement | Function Statement | Sub Statement