|
-
November 14th, 1999, 09:49 AM
#1
pointer to a string
A function needs a pointer to a buffer. I have a string and how can I make a pointer to this string
-
November 16th, 1999, 06:21 PM
#2
Re: pointer to a string
Strings in Visual Basic are stored as BSTR's. If you use the VarPtr on a variable of type String, you will get the address of the BSTR, which is a pointer to a pointer of the string. To get the address of the string buffer itself, you need to use the StrPtr function. This function returns the address of the first character of the string. Take into account that Strings are stored as UNICODE in Visual Basic.
To get the address of the first character of a String, pass the String variable to the StrPtr function.
Example:
Dim lngCharAddress as Long
Dim strMyVariable as String
strMyVariable = "Some String"
lngCharAddress = StrPtr(strMyVariable)
You can use this function when you need to pass a pointer to a UNIOCODE string to an API call.
-
November 17th, 1999, 09:51 AM
#3
Re: pointer to a string
Can't you just create a buffer with the string function and then pass it ByVal?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|