Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Code samples for COM server



Permlink Replies: 1 - Last Post: Jun 3, 2014 7:58 PM Last Post By: Remy Lebeau (Te...
Matt McNabb

Posts: 21
Registered: 6/9/11
Code samples for COM server
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 3, 2014 7:09 PM
Is there any sample code for COM servers , in any XE version, preferably which includes methods, properties, and BSTR and other Automation types? I looked through the XE6 C++ Code Samples, while there were over 500 of them, none of the titles mentioned COM, BSTR or ActiveX or appeared to be related.

I would like to check that my object correctly handles the allocation and deallocation of BSTR, SAFEARRAY, and correctly implements [in/out] and [out] parameters, and properties, and VARIANT_BOOLs and so on.

So far I have done it by guessing , finding what doesn't crash and what doesn't, and seeing what clients expected that I created using Microsoft tools. I would like to improve on that, obviously.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Code samples for COM server [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 3, 2014 7:58 PM   in response to: Matt McNabb in response to: Matt McNabb
Hello Matt,

Is there any sample code for COM servers , in any XE version,
preferably which includes methods, properties, and BSTR and other
Automation types?

Probably not, especially since C++Builder switched from ATL to DAX a few
versions back.

Is there something in particular you are looking for?

I would like to check that my object correctly handles the allocation
and deallocation of BSTR, SAFEARRAY, and correctly implements [in/out]
and [out] parameters, and properties, and VARIANT_BOOLs and so on.

You can show the code you are concerned about and someone will tell you if
it is OK or not.

So far I have done it by guessing , finding what doesn't crash and
what doesn't

Sounds like you have not really learned the fundamental language-independant
rules of COM programming yet. For example:

Managing Memory Allocation
http://msdn.microsoft.com/en-us/library/windows/desktop/ms688453.aspx

Every COM-capable programming language has to conform to the same rules,
regardless of what coding syntax they use to achieve that.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02