use strict; use Win32::API; print "Getting API function\n"; my $hllapi = new Win32::API('D:/PC3270W/EHLAPI32.dll', 'hllapi', ['P','P','P','P'], 'N'); die("oups not created") unless(defined($hllapi)); print "Connecting to session A"; my $fct=pack('L', 1); my $connBuffer="A"."\0" x 3; my $connBufferLen = pack('L', 4); my $returnCode=pack('L',13); $hllapi->Call($fct,$connBuffer,$connBufferLen,$returnCode); my $ret=unpack('L',$returnCode); print "return code -$ret-\n"; die("oups") if($ret != 0); print "Trying sendkeys - JD\n"; $fct=pack('L', 3); my $keys='JD@E'; my $keysLengh=pack('L', 4); $hllapi->Call($fct,$keys,$keysLengh,$returnCode); print "Waiting for command to be finished\n"; $fct=pack('L',4); my $a="\0"; my $b=pack('L',0); my $rc=pack('L',0); $hllapi->Call($fct,$a,$b,$rc); print "Reading screen\n"; $fct=pack('L',8); my $readBuf= "\0" x 3000; my $lenToRead=pack('L',1920); my $offset=pack('L',1); $hllapi->Call($fct,$readBuf,$lenToRead,$offset); for(my $k=0;$k<24;$k++){ my $offset=$k*80; print substr($readBuf,$offset,80)."\n"; } print "\n"; exit(0);