I'm trying to get the Global Interface Table by using the following code (Delphi):
uses Comobj, ActiveX;
var
cGIT : IGlobalInterfaceTable = NIL;
const
CLSID_StdGlobalInterfaceTable: TGUID = '{00000146-0000-0000-C000-000000000046}';
function GIT : IGlobalInterfaceTable;
begin
if (cGIT = NIL) then
OleCheck (CoCreateInstance (CLSID_StdGlobalInterfaceTable, NIL,
CLSCTX_ALL, IGlobalInterfaceTable, cGIT ));
Result := cGIT;
end;
However, CoCreateInstance throws a "Class Not Registered" exception. And indeed: in HKCR/CLSID there is no entry for {00000146- etc. }.
Which dll or ocx should be registered, to get this definition in the registry? Or am I doing it totally wrong?
Have you used OleView32 to verify the GUID of the class? That utility is available in the Windows SDK and allows you to walk the registry of interfaces much easier than regedit. I would classify the utility as a must have for any COM development.
You have defined CLSID_StdGlobalInterfaceTable incorrectly: you have supplied the GUID of the interface rather than a concrete class.
I don't have the Windows header files around, so I can't check against them, but a search suggests it should be:
Here's my unit that does it. I put this together when I was compiling in D2006, but I don't see why it would be any different in D7. I use it for storing an interface to a DCOM server and sharing it between multiple threads.