OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: ATL refresher question

From: Joseph Dempsey (joseph_r_dempseyYAHOO.COM)
Date: Fri Apr 11 2003 - 16:36:52 CDT


BSTRs suck because they are have a length limit. If you use regular wchar's
you don't have to worry about. If defining a custom interface it is best to
avoid automation data types all together.

-----Original Message-----
From: Distributed COM-Based Code [mailto:DCOMDISCUSS.MICROSOFT.COM] On
Behalf Of Lewis Jones
Sent: Friday, April 11, 2003 5:24 PM
To: DCOMDISCUSS.MICROSOFT.COM

And if you are going to mess with w_char's, then you might as well go all
the way and define them as BSTR's:

HRESULT DoBar([in] BSTR bstrSomeStr);

Call like:
CString strMyString = "Foo";
BSTR bstrMyString = strMyString.AllocSysString(); hRes =
pMyObj->DoBar(bstrMyString); ::SysFreeString(bstrMyString); if
(SUCCEEDED(hRes)) {
        // Do whatever.
}

Just make sure you call SysFreeString to free up any created BSTRs as soon
as possible.(Either from CString's AllocSysString call, or ::SysAllocString,
or the like).
 
CONFIDENTIALITY NOTICE: This message and any attached documents may contain
confidential information from Hyland Software, Inc. The information is
intended only for the use of the individual or entity named above. If the
reader of this message is not the intended recipient, or an employee or
agent responsible for the delivery of this message to the intended
recipient, the reader is hereby notified that any dissemination,
distribution or copying of this message or of any attached documents, or the
taking of any action or omission to take any action in reliance on the
contents of this message or of any attached documents, is strictly
prohibited. If you have received this communication in error, please notify
the sender immediately by e-mail or telephone, at (440) 788-5000, and delete
the original message immediately. Thank you.
 

----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM

----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM