[perl-win32-gui-users] GetOpenFileName() filters fail with Win32::OLE::Const 'Microsoft Excel'

2005-03-01 Thread Ed VanderPloeg
The following code will pop up a "file open" dialog, but when you select
between different filters in the drop-down list, the list of available
files to choose from doesn't get updated.  To get the list of files
updated, you need to go to a different directory and come back to the
one of interest.  When you don't use the Excel constants, there is no
problem.  This is as far as I can narrow down the problem.

  #!perl
  use Win32::OLE::Const 'Microsoft Excel';
  use Win32::GUI;

  # Create Main Window
  my $Window = new Win32::GUI::Window (
  -name => "Window",
  -title=> "Title",
  -pos  => [100, 100],
  -size => [400, 400],
) or die "new Window";

  # Open a file
  my $file = Win32::GUI::GetOpenFileName(
  -owner  => $Window,
  -title  => "Open a Perl file",
  -filter => [ 'Perl script (*.pl)' => '*.pl',
   'All files' => '*.*',
 ],
);

  #...parse the file, make an Excel worksheet, etc...

I'm trying this on both XP Home & XP-Pro systems with Win32::GUI version
1.0 for Perl 5.8, and with ActiveState Perl version 5.8.6.811.  Same
behaviour with 5.8.4.810.  Help!

-Ed V.





RE: [perl-win32-gui-users] GetOpenFileName() filters fail with Win32::OLE::Const 'Microsoft Excel'

2005-03-04 Thread Ed VanderPloeg
Glenn L. reported that the problem (i.e. the file list goes & stays
blank when changing from the initial filter) doesn't occur on Win2kSP4.
And here's some more details from my fiddling around:

- Changing the order of the "use" statements
  has no effect on the problem.
- It fails when bringing in the constants of
  any MS Office app, be it Excel, Word,
  Access, Outlook, or PowerPoint.
- The statement "use Win32::OLE:Const;" does
  not cause the failure.
- Explicitly setting every single argument
  for GetOpenFileName does not help any.  (I
  thought perhaps some arg was getting
  clobbered).
- Only occurs on the Explorer-style dialog,
  not the older non-Explorer view (argument
  "-explorer => 0").

So it smells like a Microsoft DLL issue, but what do I know.  My
workaround is to provide only one filter, namely "All Files".

-Ed V