Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

332 lines
11 KiB

  1. =pod
  2. =head1 NAME
  3. Win32::OLE::NEWS - What's new in Win32::OLE
  4. This file contains a history of user visible changes to the
  5. Win32::OLE::* modules. Only new features and major bug fixes that
  6. might affect backwards compatibility are included.
  7. =head1 Version 0.13
  8. =head2 nothing() method in Win32::OLE::Variant
  9. The nothing() function returns an empty VT_DISPATCH variant. It can be
  10. used to clear an object reference stored in a property
  11. use Win32::OLE::Variant qw(:DEFAULT nothing);
  12. # ...
  13. $object->{Property} = nothing;
  14. This has the same effect as the Visual Basic statement
  15. Set object.Property = Nothing
  16. =head2 new _NewEnum and _Unique options
  17. There are two new options available for the Win32::OLE->Option class
  18. method: C<_NewEnum> provides the elements of a collection object
  19. directly as the value of a C<_NewEnum> property. The C<_Unique>
  20. option guarantees that Win32::OLE will not create multiple proxy
  21. objects for the same underlying COM/OLE object.
  22. Both options are only really useful to tree traversal programs or
  23. during debugging.
  24. =head1 Version 0.12
  25. =head2 Additional error handling functionality
  26. The Warn option can now be set to a CODE reference too. For example,
  27. Win32::OLE->Option(Warn => 3);
  28. could now be written as
  29. Win32::OLE->Option(Warn => \&Carp::croak);
  30. This can even be used to emulate the VisualBasic C<On Error Goto
  31. Label> construct:
  32. Win32::OLE->Option(Warn => sub {goto CheckError});
  33. # ... your normal OLE code here ...
  34. CheckError:
  35. # ... your error handling code here ...
  36. =head2 Builtin event loop
  37. Processing OLE events required a polling loop before, e.g.
  38. my $Quit;
  39. #...
  40. until ($Quit) {
  41. Win32::OLE->SpinMessageLoop;
  42. Win32::Sleep(100);
  43. }
  44. package BrowserEvents;
  45. sub OnQuit { $Quit = 1 }
  46. This is inefficient and a bit odd. This version of Win32::OLE now
  47. supports a standard messageloop:
  48. Win32::OLE->MessageLoop();
  49. package BrowserEvents;
  50. sub OnQuit { Win32::OLE->QuitMessageLoop }
  51. =head2 Free unused OLE libraries
  52. Previous versions of Win32::OLE would call the CoFreeUnusedLibraries()
  53. API whenever an OLE object was destroyed. This made sure that OLE
  54. libraries would be unloaded as soon as they were no longer needed.
  55. Unfortunately, objects implemented in Visual Basic tend to crash
  56. during this call, as they pretend to be ready for unloading, when in
  57. fact, they aren't.
  58. The unloading of object libraries is really only important for long
  59. running processes that might instantiate a huge number of B<different>
  60. objects over time. Therefore this API is no longer called
  61. automatically. The functionality is now available explicitly to those
  62. who want or need it by calling a Win32::OLE class method:
  63. Win32::OLE->FreeUnusedLibraries();
  64. =head2 The "Win32::OLE" article from "The Perl Journal #10"
  65. The article is Copyright 1998 by I<The Perl
  66. Journal>. http://www.tpj.com
  67. It originally appeared in I<The Perl Journal> # 10 and appears here
  68. courtesy of Jon Orwant and I<The Perl Journal>. The sample code from
  69. the article is in the F<eg/tpj.pl> file.
  70. =head2 VARIANT->Put() bug fixes
  71. The Put() method didn't work correctly for arrays of type VT_BSTR,
  72. VT_DISPATH or VT_UNKNOWN. This has been fixed.
  73. =head2 Error message fixes
  74. Previous versions of Win32::OLE gave a wrong argument index for some
  75. OLE error messages (the number was too large by 1). This should be
  76. fixed now.
  77. =head2 VT_DATE and VT_ERROR return values handled differently
  78. Method calls and property accesses returning a VT_DATE or VT_ERROR
  79. value would previously translate the value to string or integer
  80. format. This has been changed to return a Win32::OLE::Variant object.
  81. The return values will behave as before if the Win32::OLE::Variant
  82. module is being used. This module overloads the conversion of
  83. the objects to strings and numbers.
  84. =head1 Version 0.11 (changes since 0.1008)
  85. =head2 new DHTML typelib browser
  86. The Win32::OLE distribution now contains a type library browser. It
  87. is written in PerlScript, generating dynamic HTML. It requires
  88. Internet Explorer 4.0 or later. You'll find it in
  89. F<browser/Browser.html>. It should be available in the ActivePerl
  90. HTML help under Win32::OLE::Browser.
  91. After selecting a library, type or member you can press F1 to call up
  92. the corresponding help file at the appropriate location.
  93. =head2 VT_DECIMAL support
  94. The Win32::OLE::Variant module now supports VT_DECIMAL variants too.
  95. They are not "officially" allowed in OLE Automation calls, but even
  96. Microsoft's "ActiveX Data Objects" sometimes returns VT_DECIMAL
  97. values.
  98. VT_DECIMAL variables are stored as 96-bit integers scaled by a
  99. variable power of 10. The power of 10 scaling factor specifies the
  100. number of digits to the right of the decimal point, and ranges from 0
  101. to 28. With a scale of 0 (no decimal places), the largest possible
  102. value is +/-79,228,162,514,264,337,593,543,950,335. With a 28 decimal
  103. places, the largest value is +/-7.9228162514264337593543950335 and the
  104. smallest, non-zero value is +/-0.0000000000000000000000000001.
  105. =head1 Version 0.1008
  106. =head2 new LetProperty() object method
  107. In Win32::OLE property assignment using the hash syntax is equivalent
  108. to the Visual Basic C<Set> syntax (I<by reference> assignment):
  109. $Object->{Property} = $OtherObject;
  110. corresponds to this Visual Basic statement:
  111. Set Object.Property = OtherObject
  112. To get the I<by value> treatment of the Visual Basic C<Let> statement
  113. Object.Property = OtherObject
  114. you have to use the LetProperty() object method in Perl:
  115. $Object->LetProperty($Property, $OtherObject);
  116. =head2 new HRESULT() function
  117. The HRESULT() function converts an unsigned number into a signed HRESULT
  118. error value as used by OLE internally. This is necessary because Perl
  119. treats all hexadecimal constants as unsigned. To check if the last OLE
  120. function returned "Member not found" (0x80020003) you can write:
  121. if (Win32::OLE->LastError == HRESULT(0x80020003)) {
  122. # your error recovery here
  123. }
  124. =head1 Version 0.1007 (changes since 0.1005)
  125. =head2 OLE Event support
  126. This version of Win32::OLE contains B<ALPHA> level support for OLE events. The
  127. userinterface is still subject to change. There are ActiveX objects / controls
  128. that don't fire events under the current implementation.
  129. Events are enabled for a specific object with the Win32::OLE->WithEvents()
  130. class method:
  131. Win32::OLE->WithEvents(OBJECT, HANDLER, INTERFACE)
  132. Please read further documentation in Win32::OLE.
  133. =head2 GetObject() and GetActiveObject() now support optional DESTRUCTOR argument
  134. It is now possible to specify a DESTRUCTOR argument to the GetObject() and
  135. GetActiveObject() class methods. They work identical to the new() DESTRUCTOR
  136. argument.
  137. =head2 Remote object instantiation via DCOM
  138. This has actually been in Win32::OLE since 0.0608, but somehow never got
  139. documented. You can provide an array reference in place of the usual PROGID
  140. parameter to Win32::OLE->new():
  141. OBJ = Win32::OLE->new([MACHINE, PRODID]);
  142. The array must contain two elements: the name of the MACHINE and the PROGID.
  143. This will try to create the object on the remote MACHINE.
  144. =head2 Enumerate all Win32::OLE objects
  145. This class method returns the number Win32::OLE objects currently in
  146. existance. It will call the optional CALLBACK function for each of
  147. these objects:
  148. $Count = Win32::OLE->EnumAllObjects(sub {
  149. my $Object = shift;
  150. my $Class = Win32::OLE->QueryObjectType($Object);
  151. printf "# Object=%s Class=%s\n", $Object, $Class;
  152. });
  153. The EnumAllObjects() method is primarily a debugging tool. It can be
  154. used e.g. in an END block to check if all external connections have
  155. been properly destroyed.
  156. =head2 The VARIANT->Put() method now returns the VARIANT object itself
  157. This allows chaining of Put() method calls to set multiple values in an
  158. array variant:
  159. $Array->Put(0,0,$First_value)->Put(0,1,$Another_value);
  160. =head2 The VARIANT->Put(ARRAYREF) form allows assignment to a complete SAFEARRAY
  161. This allows automatic conversion from a list of lists to a SAFEARRAY.
  162. You can now write:
  163. my $Array = Variant(VT_ARRAY|VT_R8, [1,2], 2);
  164. $Array->Put([[1,2], [3,4]]);
  165. instead of the tedious:
  166. $Array->Put(1,0,1);
  167. $Array->Put(1,1,2);
  168. $Array->Put(2,0,3);
  169. $Array->Put(2,1,4);
  170. =head2 New Variant formatting methods
  171. There are four new methods for formatting variant values: Currency(), Date(),
  172. Number() and Time(). For example:
  173. my $v = Variant(VT_DATE, "April 1 99");
  174. print $v->Date(DATE_LONGDATE), "\n";
  175. print $v->Date("ddd',' MMM dd yy"), "\n";
  176. will print:
  177. Thursday, April 01, 1999
  178. Thu, Apr 01 99
  179. =head2 new Win32::OLE::NLS methods: SendSettingChange() and SetLocaleInfo()
  180. SendSettingChange() sends a WM_SETTINGCHANGE message to all top level windows.
  181. SetLocaleInfo() allows changing elements in the user override section of the
  182. locale database. Unfortunately these changes are not automatically available
  183. to further Variant formatting; you have to call SendSettingChange() first.
  184. =head2 Win32::OLE::Const now correctly treats version numbers as hex
  185. The minor and major version numbers of type libraries have been treated as
  186. decimal. This was wrong. They are now correctly decoded as hex.
  187. =head2 more robust global destruction of Win32::OLE objects
  188. The final destruction of Win32::OLE objects has always been somewhat fragile.
  189. The reason for this is that Perl doesn't honour reference counts during global
  190. destruction but destroys objects in seemingly random order. This can lead
  191. to leaked database connections or unterminated external objects. The only
  192. solution was to make all objects lexical and hope that no object would be
  193. trapped in a closure. Alternatively all objects could be explicitly set to
  194. C<undef>, which doesn't work very well with exception handling.
  195. With version 0.1007 of Win32::OLE this problem should be gone: The module
  196. keeps a list of active Win32::OLE objects. It uses an END block to destroy
  197. all objects at program termination I<before> the Perl's global destruction
  198. starts. Objects still existing at program termination are now destroyed in
  199. reverse order of creation. The effect is similar to explicitly calling
  200. Win32::OLE->Uninitialize() just prior to termination.
  201. =head1 Version 0.1005 (changes since 0.1003)
  202. Win32::OLE 0.1005 has been release with ActivePerl build 509. It is also
  203. included in the I<Perl Resource Kit for Win32> Update.
  204. =head2 optional DESTRUCTOR for GetActiveObject() GetObject() class methods
  205. The GetActiveObject() and GetObject() class method now also support an
  206. optional DESTRUCTOR parameter just like Win32::OLE->new(). The DESTRUCTOR
  207. is executed when the last reference to this object goes away. It is
  208. generally considered C<impolite> to stop applications that you did not
  209. start yourself.
  210. =head2 new Variant object method: $object->Copy()
  211. See L<Win32::OLE::Variant/Copy([DIM])>.
  212. =head2 new Win32::OLE->Option() class method
  213. The Option() class method can be used to inspect and modify
  214. L<Win32::OLE/Module Options>. The single argument form retrieves
  215. the value of an option:
  216. my $CP = Win32::OLE->Option('CP');
  217. A single call can be used to set multiple options simultaneously:
  218. Win32::OLE->Option(CP => CP_ACP, Warn => 3);
  219. Currently the following options exist: CP, LCID and C<Warn>.
  220. =cut