develooper Front page | perl.tcltk | Postings from January 2012

RE: Windows Tkx::tk___chooseDirectory

Thread Previous
From:
dave.roberts
Date:
January 5, 2012 02:21
Subject:
RE: Windows Tkx::tk___chooseDirectory
Message ID:
OF3CA3308E.CBB549DF-ONC125797C.0038BA06-C125797C.0038E26A@notes.cummins.com
Jan,

Thanks for the suggestion. That did the trick and cleared the problem.
I appreciate the accuracy and speed of the response.

Regards

Dave Roberts



From:   Jan Dubois <jand@activestate.com>
To:     dave.roberts@cummins.com, tcltk@perl.org
Date:   05/01/2012 11:04
Subject:        RE: Windows Tkx::tk___chooseDirectory



On Thu, 05 Jan 2012, dave.roberts@cummins.com wrote:
> As a relative newcomer to Tkx on perl I have run into an issue with
> the Tkx::tk___chooseDirectory command. I use this in an application
> with its primary interface built using Tkx, that also spawns Excel
> using Win32::OLE.
>
> The Tkx::tk___chooseDirectory works fine before I have opened Excel.
>
> After I have opened Excel it just freezes. The application logic
> allows Excel to be closed when using Tkx::tk___chooseDirectory, and I
> have tried all methods to close excel and free unused library
> information, including using Win32::OLE Close/Exit/Quit commands,
> Win32::OLE->FreeUnusedLibraries(); , manually closing Excel, killing
> all Excel.Exe processes.

Try adding the following line at the top of your script, directly after
the "use Win32::OLE" line:

  BEGIN { Win32::OLE->Initialize( Win32::OLE::COINIT_OLEINITIALIZE() ) }

I suspect that chooseDirectory() makes uses of the Windows Common
Dialogs, and they only work correctly if the current thread uses the STA
(single threaded apartment) mode of OLE.

Cheers,
-Jan



______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________



Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About