What should be the signature of
StatusInterface and CommandInterface
in ATL COM?
By default, ATL methods will return an HRESULT value. In order to achieve what you want you can create a method without parameters using the ATL wizard. Then you can modify your IDL file manually, and the corresponding implementation, so that your method returns an CommandInterface instead. Using this approach your IDL file will look like this:
[id(1)] CommandInterface* GetCommandInterface();
And the method declaration on your ATL class will be:
CommandInterface* GetCommandInterface();
Another option could be to use one output parammeter of type CommandInterface**. A quick test using the ATL wizard shows that your IDL file will look like this:
[id(1)] HRESULT StatusInterface([out] CommandInterface** outStatusInterface);
Should I call AddRef() on the
StatusInterface and CommandInterface
before returning the object to the
automation client(VBScript)?
I would say yes, since VBScript/ASP is supposed to call Release()
when your local variable goes out of scope.
Should I create the object each time
StatusInterface is called or when
'PolyCold.Main' object is created?
This one is up to you. Only you know the details and needs of your design.
Is this the standard way of giving
names for StatusInterface and
CommandInterface?
If these "elements" are supposed to be interface types, then I would say no. In general interfaces are named with a capital I as first letter. I would use IStatus and ICommand for example. Probably with some more info saying what kind of command and status, but this is argumentative.