Guest User

Untitled

a guest
Dec 10th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. // This file will be processed by the MIDL tool to
  2. // produce the type library (File.tlb) and marshalling code.
  3.  
  4. import "oaidl.idl";
  5. import "ocidl.idl";
  6.  
  7. [
  8. object,
  9. uuid(43EA61FC-C17E-429B-8AAD-B71CC2F53098),
  10. dual,
  11. nonextensible,
  12. helpstring("IFile_RemoteInterface Interface"),
  13. pointer_default(unique)
  14. ]
  15. interface IFile_RemoteInterface : IDispatch{
  16. [id(5), helpstring("method GetState")] HRESULT GetState(BSTR sequencename, [out] LONG* sequencestate);
  17. };
  18. [
  19. uuid(1F19FE19-8626-4ADC-9787-077CD9D06563),
  20. version(2.0),
  21. helpstring("File Remote Interface 2.0")
  22. ]
  23. library FileLib
  24. {
  25. importlib("stdole2.tlb");
  26. [
  27. uuid(E0FDA055-B882-4026-A3D9-2EC863FCDFB9),
  28. helpstring("File_RemoteInterface Class")
  29. ]
  30. coclass File_RemoteInterface
  31. {
  32. [default] interface IFile_RemoteInterface;
  33. };
  34. };
  35.  
  36. import comtypes
  37. import comtypes.server.localserver
  38.  
  39. from comtypes.client import GetModule
  40. # generate wrapper code for the type library, this needs
  41. # to be done only once (but also each time the IDL file changes)
  42. GetModule("File.tlb")
  43.  
  44. from comtypes.gen.FileLib import File_RemoteInterface
  45.  
  46. class FileImpl(File_RemoteInterface):
  47. # registry entries
  48. _reg_threading_ = "Both"
  49. _reg_progid_ = "File.Object.1"
  50. _reg_novers_progid_ = "File.Object"
  51. _reg_desc_ = "Python engine for File"
  52. _reg_clsctx_ = comtypes.CLSCTX_INPROC_SERVER | comtypes.CLSCTX_LOCAL_SERVER
  53. _regcls_ = comtypes.server.localserver.REGCLS_MULTIPLEUSE
  54.  
  55.  
  56. def GetState(self,a,b):
  57. return a // i don't know what exactly should i write here
  58.  
  59.  
  60. if __name__ == "__main__":
  61. from comtypes.server.register import UseCommandLine
  62. UseCommandLine(FileImpl)
  63.  
  64. from comtypes.client import CreateObject
  65. from ctypes import *
  66.  
  67.  
  68. cale = "some_path"
  69.  
  70. x = CreateObject("File.Object")
  71.  
  72. x.GetState(cale,b)
Add Comment
Please, Sign In to add comment