in reply to Re: Re: Win32::FileOp window positioning?
in thread Win32::FileOp window positioning?

BrowseForFolder() doesn't (yet) support this style of calling. And there aparently was a bug in the code. Could you try to replace the BrowseForFolder in FileOp.pm with the following code:

sub BrowseForFolder { undef $Win32::FileOp::Error; my $lpszTitle = shift() || "\0"; my $nFolder = shift() || 0; my $ulFlags= (shift() || 0) | 0x0000; my $hwndOwner = (defined $_[0] ? shift() : GetWindowHandle()); my ($pidlRoot, $pszDisplayName, $lpfn, $lParam, $iImage, $pszPath) = ("\0"x260, "\0"x260, 0, 0, 0, "\0"x260 ); $nFolder = CSIDL_DRIVES() unless defined $nFolder; $Win32::FileOp::SHGetSpecialFolderLocation->Call($hwndOwner, $nFold +er, $pidlRoot) and return undef; $pidlRoot = hex unpack 'H*',(join'', reverse split//, $pidlRoot); my $browseinfo = pack 'LLppILLI', ($hwndOwner, $pidlRoot, $pszDisplayName, $lpszTitle, $ulFlags, $lpfn, $lParam, $iImage); my $bool = $Win32::FileOp::SHGetPathFromIDList->Call( $Win32::FileOp::SHBrowseForFolder->Call($browseinfo), $pszPath ); $pszPath =~ s/\0.*$//s; $bool ? $pszPath : undef; }
and then use
my $dir1 = BrowseForFolder("with handle", undef, undef, $windowid);

I have a few more changes pending to be released, hopefully I'll have some spare time to do that sometime soon.

HTH, Jenda
We'd like to help you learn to help yourself
Look around you, all you see are sympathetic eyes
Stroll around the grounds until you feel at home
   -- P. Simon in Mrs. Robinson

Replies are listed 'Best First'.
Re^4: Win32::FileOp window positioning?
by spikey_wan (Scribe) on Nov 09, 2004 at 18:11 UTC
    Hi Jenda,

    Thanks for the work you're doing on this, it's greatly appreciated. Let me know if I can do anything to help.

    I have tried the above, and it did work.

    There is one slight anomaly: The Browse window appears slightly lower and more to the right than the Open and Save windows do.

    Thanks again,
    Spike.