home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue60 / COMThrd / GITIntf.pas next >
Encoding:
Pascal/Delphi Source File  |  2000-05-12  |  899 b   |  40 lines

  1. unit GITIntf;
  2.  
  3. interface
  4.  
  5. uses
  6.   ActiveX, Windows;
  7.  
  8. const
  9.   CLSID_StdGlobalInterfaceTable : TGUID =
  10.   '{00000323-0000-0000-C000-000000000046}';
  11.  
  12. type
  13.   IGlobalInterfaceTable = interface(IUnknown)
  14.     ['{00000146-0000-0000-C000-000000000046}']
  15.     function RegisterInterfaceInGlobal(pUnk: IUnknown;
  16.       const riid: TIID; out dwCookie: DWord): HResult; stdcall;
  17.     procedure RevokeInterfaceFromGlobal(
  18.       dwCookie: DWord); safecall;
  19.     function GetInterfaceFromGlobal(dwCookie: DWord;
  20.       const riid: TIID; out ppv): HResult; stdcall;
  21.   end;
  22.  
  23. function GIT: IGlobalInterfaceTable;
  24.  
  25. implementation
  26.  
  27. uses
  28.   ComObj;
  29.  
  30. function GIT: IGlobalInterfaceTable;
  31. const
  32.   GITIntf: IGlobalInterfaceTable = nil;
  33. begin
  34.   if not Assigned(GITIntf) then
  35.     GITIntf := CreateComObject(CLSID_StdGlobalInterfaceTable) as IGlobalInterfaceTable;
  36.   Result := GITIntf
  37. end;
  38.  
  39. end.
  40.