home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 1997 / CT_SW_97.ISO / pc / software / entwickl / win95 / pw32i306.exe / lib / ole.pm < prev    next >
Text File  |  1997-03-21  |  2KB  |  119 lines

  1. package OLE::Variant;
  2.  
  3. sub new {
  4.     my( $self );
  5.     shift;
  6.     $self->{'Type'} = shift;
  7.     $self->{'Value'} = shift;
  8.     bless $self;
  9.     return $self;
  10. }
  11.  
  12.  
  13. package OLE;
  14.  
  15. # helper routines. see ntole.cpp for all the gory stuff.
  16.  
  17. sub AUTOLOAD {
  18.     my( $self ) = shift;
  19.     $AUTOLOAD =~ s/.*:://o;
  20.     if ( main::Win32::OLEDispatch( $self, $AUTOLOAD, $fReturn, @_ ) ) {
  21.         return $fReturn;
  22.     } else {
  23.         return undef;
  24.     }
  25. }
  26.  
  27.  
  28. # Automation data types.
  29.  
  30. eval "sub VT_EMPTY {0;}";
  31. eval "sub VT_NULL {1;}";
  32. eval "sub VT_I2 {2;}";
  33. eval "sub VT_I4 {3;}";
  34. eval "sub VT_R4 {4;}";
  35. eval "sub VT_R8 {5;}";
  36. eval "sub VT_CY {6;}";
  37. eval "sub VT_DATE {7;}";
  38. eval "sub VT_BSTR {8;}";
  39. eval "sub VT_DISPATCH {9;}";
  40. eval "sub VT_ERROR {10;}";
  41. eval "sub VT_BOOL {11;}";
  42. eval "sub VT_VARIANT {12;}";
  43. eval "sub VT_UNKNOWN {13;}";
  44. eval "sub VT_I1 {16;}";
  45. eval "sub VT_UI1 {17;}";
  46. eval "sub VT_UI2 {18;}";
  47. eval "sub VT_UI4 {19;}";
  48. eval "sub VT_I8 {20;}";
  49. eval "sub VT_UI8 {21;}";
  50. eval "sub VT_INT {22;}";
  51. eval "sub VT_UINT {23;}";
  52. eval "sub VT_VOID {24;}";
  53. eval "sub VT_HRESULT {25;}";
  54. eval "sub VT_PTR {26;}";
  55. eval "sub VT_SAFEARRAY {27;}";
  56. eval "sub VT_CARRAY {28;}";
  57. eval "sub VT_USERDEFINED {29;}";
  58. eval "sub VT_LPSTR {30;}";
  59. eval "sub VT_LPWSTR {31;}";
  60. eval "sub VT_FILETIME {64;}";
  61. eval "sub VT_BLOB {65;}";
  62. eval "sub VT_STREAM {66;}";
  63. eval "sub VT_STORAGE {67;}";
  64. eval "sub VT_STREAMED_OBJECT {68;}";
  65. eval "sub VT_STORED_OBJECT {69;}";
  66. eval "sub VT_BLOB_OBJECT {70;}";
  67. eval "sub VT_CF {71;}";
  68. eval "sub VT_CLSID {72;}";
  69.  
  70.  
  71. # Current support types are
  72. #   VT_UI1,
  73. #   VT_I2,
  74. #   VT_I4,
  75. #   VT_R4,
  76. #   VT_R8,
  77. #   VT_DATE,
  78. #   VT_BSTR,
  79. #   VT_CY,
  80. #   VT_BOOL,
  81.  
  82.  
  83.  
  84. # Typelib
  85.  
  86. eval "sub TKIND_ENUM {0;}";
  87. eval "sub TKIND_RECORD {1;}";
  88. eval "sub TKIND_MODULE {2;}";
  89. eval "sub TKIND_INTERFACE {3;}";
  90. eval "sub TKIND_DISPATCH {4;}";
  91. eval "sub TKIND_COCLASS {5;}";
  92. eval "sub TKIND_ALIAS {6;}";
  93. eval "sub TKIND_UNION {7;}";
  94. eval "sub TKIND_MAX {8;}";
  95.  
  96. sub new {
  97.     my( $object );
  98.     my( $class ) = shift;
  99.     if($class eq 'OLE')
  100.     {
  101.         $class = shift;
  102.     }
  103.     if ( main::Win32::OLECreateObject( $class, $object ) ) {
  104.         return $object;
  105.     } else {
  106.         return undef;
  107.     }
  108. }
  109.  
  110. sub DESTROY {
  111.     my( $self ) = shift;
  112.     main::Win32::OLEDestroyObject( $self );
  113.     return undef;
  114. }
  115.  
  116. *CreateObject = \&new;
  117.  
  118. 1;
  119.