VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Api Any Calls/Declarations

by Robert Dick (1 Submission)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

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

Rate Api Any Calls/Declarations

#

Download this snippet    Add to My Saved Code

Api Any Calls/Declarations Comments

No comments have been posted about Api Any Calls/Declarations. Why not be the first to post a comment about Api Any Calls/Declarations.

Post your comment

Subject:
Message:
0/1000 characters