Frequently Asked Questions
Testing IDispatch Descendants
Question:
Is there a minimal test I can perform to test the validity
of the GUID, and that the interface descends from IDispatch
(and therefore supports automation methods)?
Answer:
Call CreateRemoteComObject and use the name of the computer
and the GUID you are trying to connect to. If it returns
an error, this indicates a server problem, otherwise a
client problem.
const
MyGUID = '{444...111}'; //Whatever the guid is...
var
Unk: IUnknown;
Disp: IDispatch;
begin
{ Make sure this line works correctly }
Unk := CreateRemoteComObject('server1',
StringToGUID(MyGUID));
{ If it does, then cast it to a IDispatch }
Disp := Unk as IDispatch;
end;
If this works and problems remain, then you'll need to
step through your client code and see where it is failing.
If not, then run the server in the debugger and connect
with the client, then you should be able to debug near
to where it fails.