我爱Aspx >> Asp.Net >> Understanding Strings In COMOLECHARs are the standard way to create strings in COM code and by far the most comfortable as long as C and C++ are used in both the client side and the server side. Other languages and tools bring their burden of special constraints that open the way to another kind of string, which constitute the topic of the next paragraph.
continued...| Copyright © 1999 - Visual C++ Developers Journal |
BSTRs
B-strings, more properly called Basic strings, are a special kind of string format. Instead of comprising a classic array of characters followed by a NUL character (code \0) that marks the termination of the array, the structure of the data in memory is a superset of OLECHAR. In short, a BSTR is a null-terminated array of OLECHARs prefixed by its length. The string length is determined by the character count, not by the index of the first null character.
This presence of the length of the object before the actual array data renders these strings suitable for manipulation in high-level tools like Visual Basic (for which this string format was invented in the first place) and Java on a COM-aware virtual machine like Microsoft's JVM. Actually, there is no other way to exchange string-like data with components written in those languages than to employ BSTRs. While in C and C++ the developer has to understand and use the data type in a rather uncomfortable manner, both Visual Basic and Java encapsulate them into their traditional string types, respectively String and java.lang.String. The final developer is therefore shielded from the subtleties of the organization of the raw bytes in memory. Moreover, the tools take care of allocating and freeing the memory required to contain their content without the programmer needing to know how this process works behind the scenes.
Ҷƪл˵?
介绍几本COM的书籍 -- 想要学COM..[05-05]
介绍几本COM的书籍 -- 想要学COM..[05-05]
COM初学者必看,否则你会后悔的,..[05-05]
COM的错误处理[05-05]
DCOM概述(三)[05-05]
DCOM概述(二)[05-05]
DCOM概述(一)[05-05]
www.microsoft.com的解决方案[05-05]
COM的错误处理[05-05]
DCOM概述(三)[05-05]
充分利用Windows API扩展Delphi函..[05-05]
B2B, B2C ->B2Bi[05-05]
评论:软件创业再度面临生死劫[05-05]
如何提高截取屏幕的速度?[05-05]
中关村能成为下一个硅谷吗? -- ..[05-05]
ASP 中Scripting.FileSystemObje..[05-05]
介绍几本COM的书籍 -- 想要学COM..[05-05]
介绍几本COM的书籍 -- 想要学COM..[05-05]
玩的就是“心”跳 - Athlon超频手..[05-05]
鼠标屏幕取词技术的原理和实现[05-05]