downloaded has asked for the wisdom of the Perl Monks concerning the following question:

Hi! I've been using the following perl script to backup files from a server using FTPRush. I wrote it 2 years ago and i've been using it on Windows 7 sucessfully since then. I just upgraded to Windows 10 and it stop working.
use Win32::GUI; use Win32::API; use constant WM_COPYDATA => 74; use warnings; my $rushhandle = Win32::GUI::FindWindow("tfmrush", ""); die "Could not find Rush\n" if not $rushhandle; my $command = "RushApp.FTP.Login('backup','',0);"; my $copy_data_struct = pack( 'L2P', 1000, length( $command ) + 5, $com +mand ); Win32::GUI::SendMessage($rushhandle, WM_COPYDATA, 0, $copy_data_struct +);
Any ideas?

UPDATE

The problem is that i was using 64bits version of Perl. Everything works fine on 32bits version. :\

Replies are listed 'Best First'.
Re: win32::sendmessage help
by 1nickt (Canon) on Feb 23, 2016 at 13:20 UTC

    Hello downloaded,

    I just upgraded to Windows 10 and it stop working.

    Please post the relevant lines of the error message you get. Without that it's just guesswork.

    But at a guess I would say that since you made a major OS version upgrade, you will probably have to reinstall your Perl modules.

    Hope this helps!

    The way forward always starts with a minimal test.
      I did a clean install, not an upgrade. Sorry for the missunderstood. I installed Perl and the required modules. I don't have any error message, Win32::GUI::SendMessage just returns 0. Win32::GUI::FindWindow does work. I tested it using CloseWindow just in case.
Re: win32::sendmessage help
by NetWallah (Canon) on Feb 23, 2016 at 17:28 UTC
    The MS documentation on the "Sendmessage function says :
    Remarks

    When a message is blocked by UIPI the last error, retrieved with GetLastError, is set to 5 (access denied).

    So - UIPI may be to blame.

    Can you use the Win32::OLE->LastError() to see if this is the case.

    Unfortunately, I have no idea how to fix it for perl code. There are references to building Visual studio projects/manifests with settings to specify priviledge requirements - no idea how this applies to perl code.

            "Think of how stupid the average person is, and realize half of them are stupider than that." - George Carlin

      Yes, that also crossed my mind. I was playing with Win32::GetLastError() (returns 0) and Win32::OLE::LastError() (undef), so i guess its not the case. I'm also thinking it may be an ftp client problem but windows 10 related....
Re: win32::sendmessage help
by VinsWorldcom (Prior) on Feb 23, 2016 at 15:07 UTC

    Maybe a Windows API change from 7 to 10 is causing an issue with the call(s) from Win32::GUI::SendMessage? Just a guess, but are you running as Administrator? If not, may try to "Run as..." and see if that helps - could be a Windows permission thing which I run across sometimes on the locked down $work computer.

      Thank you for your input. I tryed running my script from command line as administrator and also run ftp client as administrador without luck.
Re: win32::sendmessage help
by Anonymous Monk on Feb 21, 2018 at 15:39 UTC
    I have the same issue after upgrading from Strawberry perl 5.12.3 32 bit to perl 5.26.1 64bit. Had to ugprade because of SSL issues and way overdue upgrade of perl. my $rushhandle = Win32::GUI::FindWindow("tfmrush", ""); #this finds a valid handle Win32::GUI::SendMessage($rushhandle, WM_COPYDATA, 0, $copy_data_struct) ; # no activity occurs in FTPRush I am about to try the 32bit and see if that helps. I am on Windows 7, so i dont think the problem is specific to Win10
      installing the 32bit version of Strawberry perl did the trick. Something about the 64bit...