EQuestionAnswers.com Computer/Electronics Questions and Answers
C, C++, VC++, COM/DCOM, DLL and more
#Login #Sign up  Facebook Twitter TGoogle+
 

#Previous question #Index of COM/DCOM Questions #Next question

BSTR allocation and free

There are many allocation functions available for allocating BSTRs. BSTRs are allocated with one of SysAllocStringXXX or SysReAllocStringXXX function which is suitable by the developer. SysFreeString is one single function to free the allocated string allocated by any allocation functions.

BSTR APIs

These are the BSTR manipulation APIs.

SysAddRefString

Increases the pinning reference count for the specified string by one.

SysAllocString

Allocates a new string and copies the passed string into it.

SysAllocStringByteLen

Takes an ANSI string as input, and returns a BSTR that contains an ANSI string. Does not perform any ANSI-to-Unicode translation.

SysAllocStringLen

Allocates a new string, copies the specified number of characters from the passed string, and appends a null-terminating character.

SysFreeString

Deallocates a string allocated previously by SysAllocString, SysAllocStringByteLen, SysReAllocString, SysAllocStringLen, or SysReAllocStringLen.

SysReAllocString

Reallocates a previously allocated string to be the size of a second string and copies the second string into the reallocated memory.

SysReAllocStringLen

Creates a new BSTR containing a specified number of characters from an old BSTR, and frees the old BSTR.

SysReleaseString

Decreases the pinning reference count for the specified string by one. When that count reaches 0, the memory for that string is no longer prevented from being freed.

SysStringByteLen

Returns the length (in bytes) of a BSTR.

SysStringLen

Returns the length of a BSTR.

BSTR alloc and free code

BSTR strSample = SysAllocString(L”This is a sample BSTR”);
SysFreeString(strSample);

You have viewed 1 page out of 66. Your COM/DCOM learning is 0.00% complete. Login to check your learning progress.

 Vote 0

Similar topics related to this section

# COM DCOM Interview Questions and Answers :: ALL Interview .com
# COM DCOM - COM DCOM Interview Questions
# COM interview questions | TechInterviews
# COM Interview Questions - CodeProject
# Com Dcom Interview Questions - Com and Dcom in Asp Net
# ATL Interview Questions and Answers :: ALL Interview .com
# ActiveX Interview Questions and Answers :: ALL Interview .com

* #1 webmaster Mon 28 Apr/2014 21:33:33(GMT)  Like 0 Unlike 0

Dear Users,

We are pleased to inform you that a forum/blog has been incorporated with www.mybestnotes.co.in. You are welcomed to add your comments, requests, codes, solutions and feedback to it. Please login(if already a member) or signup(for free) to avail to this facility.

Regards,
Webmaster

Your message goes here:

Name:Guest
Email:anonymous@unknown.com
My Post:*
Secutiry Code: ******  *
Preview this compose before posting this in discussion forum.
 
Note:
  1. Use [Sxx] code to show smiles. Example [S02]
  2. Use [URL ], example [URL http://www.google.com/]
  3. To display code or un formatted text use [CODE] [/CODE]. Example: [CODE] printf("Hello world"); [/CODE]
 [S01]   [S02]   [S03]   [S04]   [S05]   [S06]   [S07]   [S08] 
 [S09]   [S10]   [S11]   [S12]   [S13]   [S14]   [S15]   [S16] 
 [S17]   [S18]   [S19]   [S20]   [S21]   [S22]   [S23]   [S24] 

Note: Only members are allowed, * fields are mandatory.