Win32::OLE->Initialize question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I asked a little while ago about using 0x0040 (== BIF_NEWDIALOGSTYLE)
in Win32::FileOp::BrowseForFolder because microsoft said it's one of those that:
"  To use this flag, you must call OleInitialize or CoInitialize
        before calling SHBrowseForFolder "

Well, I guess this is how it has to be done ----
  use strict;
  use Win32::OLE;

  use Win32::FileOp qw(BrowseForFolder);

  my $Folder = BrowseForFolder(" testing ", 0, 0x0040 );
  if( defined $Folder ){  print "$Folder\n" } else { print "Canceled\n" }


My question now is:  --  is that Uninitialize really necessary or desireable?
Might it be necessary under some circumstance?

(also, the doc says:
"If the Win32::OLE::Const module is used
 then the call to the Initialize() method must be made from a BEGIN block
 before the first use statement for the Win32::OLE::Const module.

so, my question: might it be a good idea to just always put it in a BEGIN block,
(and maybe the Uninitialize() in an END block) ? )

Also-   in a larger program that may instantiate other OLE objects)
is it necessary or desireable to be calling    Win32::OLE->SpinMessageLoop()
from time to time? (and if so, when, and where)

The point of all this is that a BrowseForFolder()
without the ability to create a folder, seems to me to be a pretty useless thing,
whereas a BrowseForFolder() that can create a folder seems to me to be
about the most useful Win32::GUI thing imaginable.


Site Timeline