Tools Links Login

Api Any Calls/Declarations

This is not really a code contribution, but a small tip on API parameter lists.
Ever seen an Api Function which expects parameters of type 'Any' ? . For example
domain/user maintenance calls in the Nt Networking Api or similar (Add Users/Groups etc..).
These parameters usually (in the C/C++ base code) are probably expecting string pointers ,
an other example is in the case of the AddGroup Api call in the NetApi.Dll, where it
expects the name of the server in one of the parameters in the list.
How you actually pass the pointer is by:-
eg.
'###
' Api Function for example:-
' ApiFunction(sArgument as Any) As Long
'
Dim strAnyString As String
Dim strPass() As Byte
Dim lRet As Long

strAnyString = "String as argument"

strPass = strAnyString

lRet = ApiFunction(strPass(0))
'###
What we're basically doing is getting the string to pass, assigning it to another
variable array of type 'byte', then passing the first array segment to the Api function.
Easy enough?
Hope you understood all that !
Robert Dick

Original Author: Robert Dick

Code

#

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 83 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.