comobj.pp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2002 by Florian Klaempfl
  5. member of the Free Pascal development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$mode objfpc}
  13. {$H+}
  14. unit comobj;
  15. interface
  16. {$ifndef VER1_0}
  17. {$i comobjh.inc}
  18. function CreateComObject(const ClassID: TGUID) : IUnknown;
  19. function CreateRemoteComObject(const MachineName : WideString;const ClassID : TGUID) : IUnknown;
  20. function CreateOleObject(const ClassName : string) : IDispatch;
  21. function GetActiveOleObject(const ClassName: string) : IDispatch;
  22. {$endif VER1_0}
  23. implementation
  24. {$ifndef VER1_0}
  25. uses
  26. windows,activex;
  27. {$define FPC_COMOBJ_HAS_CREATE_CLASS_ID}
  28. function CreateClassID : ansistring;
  29. var
  30. ClassID : TCLSID;
  31. p : PWideChar;
  32. begin
  33. CoCreateGuid(ClassID);
  34. StringFromCLSID(ClassID,p);
  35. result:=p;
  36. CoTaskMemFree(p);
  37. end;
  38. {$i comobj.inc}
  39. function CreateComObject(const ClassID : TGUID) : IUnknown;
  40. begin
  41. {!!!!!!!}
  42. runerror(211);
  43. end;
  44. function CreateRemoteComObject(const MachineName : WideString;const ClassID : TGUID) : IUnknown;
  45. begin
  46. {!!!!!!!}
  47. runerror(211);
  48. end;
  49. function CreateOleObject(const ClassName : string) : IDispatch;
  50. begin
  51. {!!!!!!!}
  52. runerror(211);
  53. end;
  54. function GetActiveOleObject(const ClassName : string) : IDispatch;
  55. begin
  56. {!!!!!!!}
  57. runerror(211);
  58. end;
  59. {$endif VER1_0}
  60. end.
  61. {
  62. $Log$
  63. Revision 1.2 2003-10-05 20:30:09 florian
  64. + necessary declarations for dx8 headers added
  65. Revision 1.1 2002/10/10 16:09:39 florian
  66. + initial revision
  67. }