Skip Menu |

This queue is for tickets about the Win32-OLE CPAN distribution.

Report information
The Basics
Id: 63882
Status: resolved
Priority: 0/
Queue: Win32-OLE

People
Owner: Nobody in particular
Requestors: conversecorollary [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Problem with tk_getopenfile and Win32::OLE::Const
Date: Mon, 13 Dec 2010 09:58:40 -0800 (PST)
To: bug-Win32-OLE [...] rt.cpan.org
From: gary sachs <conversecorollary [...] yahoo.com>
Dear Sir or Madam, I am encountering an issue with tk_getopenfile when Win32::OLE::Const is present in the file even though it may be in a subroutine. I am using ActiveState PERL 5.12 on a WINDOWS XP SP3 box. When the Win32::OLE::Const is present the Tk_getopenfile does not reload properly when choosing a different file type from the pull down file type box. The code will demonstrate the issue or at least it did on my box. The code below should work properly... use 5.010; use strict; use warnings; use Tkx; use strict ; use Win32::OLE; #use Win32::OLE::Const 'Microsoft Office.* Object Library'; #use Win32::OLE::Const 'Microsoft Word'; use Win32::Process ; # Launch a Windows program my $types = [ ['CSV files', ['.csv']], ['ZIP files', ['.zip']], ['ALL files', ['*']], ]; my $filelist = Tkx::tk___getOpenFile(-multiple => 1, -title => "Open a CSV File", -defaultextension => '.csv', -initialfile => '*.csv', -filetypes => $types, -initialdir => 'c:\temp', ); Tkx::MainLoop(); exit; But if I uncomment one of the lines containing Win32::OLE::Const as in the next example the reloads to not occur properly when choosing a different file type... use 5.010; use strict; use warnings; use Tkx; use strict ; use Win32::OLE; use Win32::OLE::Const 'Microsoft Office.* Object Library'; #use Win32::OLE::Const 'Microsoft Word'; use Win32::Process ; # Launch a Windows program my $types = [ ['CSV files', ['.csv']], ['ZIP files', ['.zip']], ['ALL files', ['*']], ]; my $filelist = Tkx::tk___getOpenFile(-multiple => 1, -title => "Open a CSV File", -defaultextension => '.csv', -initialfile => '*.csv', -filetypes => $types, -initialdir => 'c:\temp', ); Tkx::MainLoop(); exit; I look forward to hearing from you. Thank you, gary
The standard file dialogs in Windows only work in single threaded apartment mode, so you have to include the following line immediately after the "use Win32::OLE" line before doing any OLE operations: BEGIN { Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE) }
Subject: Re: [rt.cpan.org #63882] Problem with tk_getopenfile and Win32::OLE::Const
Date: Tue, 14 Dec 2010 04:21:42 -0800 (PST)
To: bug-Win32-OLE [...] rt.cpan.org
From: gary sachs <conversecorollary [...] yahoo.com>
Thank you, that did the trick. gary --- On Mon, 12/13/10, Jan Dubois via RT <bug-Win32-OLE@rt.cpan.org> wrote: Show quoted text
> From: Jan Dubois via RT <bug-Win32-OLE@rt.cpan.org> > Subject: [rt.cpan.org #63882] Problem with tk_getopenfile and Win32::OLE::Const > To: conversecorollary@yahoo.com > Date: Monday, December 13, 2010, 5:14 PM > <URL: https://rt.cpan.org/Ticket/Display.html?id=63882 > > > The standard file dialogs in Windows only work in single > threaded > apartment mode, so you have to include the following line > immediately > after the "use Win32::OLE" line before doing any OLE > operations: > > BEGIN { > Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE) > } > >