RE: Windows Tkx::tk___chooseDirectory
[email protected] Thu, 05 Jan 2012 11:21:19 +0100
| Newsgroups | perl.tcltk |
|---|---|
| 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 <[email protected]> To: [email protected], [email protected] Date: 05/01/2012 11:04 Subject: RE: Windows Tkx::tk___chooseDirectory On Thu, 05 Jan 2012, [email protected] 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 ______________________________________________________________________