I have hit a road block using the Win32-API module. I've gotten a
working tool which allows me to modify the contents of the Crystal
Reports RPT file in memory using the API interface. Unfortunately,
everytime I attempt to access a particular method, my application fails
with a very non-specific message of...
"Perl Command Line interpreter has encountered a problem and needs to
close. We are sorry for the inconvenience".
The particular section of code in which the error occurs is:
___CODE___
my $PEGetSelectedPrinter = new Win32::API 'crpe32',
'PEGetSelectedPrinter', 'IlPlPlPP', 'I';
if (not defined $PEGetSelectedPrinter) {
die "Can't import API PEGetSelectedPrinter$!\n";
}
print DEBUG "Call Get Selected Printer API\n" if $debug;
my $PEGetSelectedPrinterErr =
$PEGetSelectedPrinter->Call($job,$PEdriverHandle,$PEdriverHandleLength,$
PEprinterHandle,$PEprinterHandleLength,$PEportHandle,$PEportHandleLength
,$DEVMODE); # Errors here
___END___
I have tried many variations of the Parameters for the Win32::API object
creation. WINGDI.h says a HANDLE should be a long variable type this is
not working. I am current under the belief that this abort is caused by
accessing memory outside my applications work space. But I am not
certain.
Anyone out there had any success with Crystal Reports to do this trivial
function? Anyone see my mistakes? I have included a definition of the
method with call list below.
C Syntax
BOOL CRPE_API PEGetSelectedPrinter (
short printJob,
HANDLE FAR *driverHandle,
short FAR *driverLength,
HANDLE FAR *printerHandle,
short FAR *printerLength,
HANDLE FAR *portHandle,
short FAR *portLength,
#if defined (WIN32)
DEVMODEA FAR * FAR *mode
#else
DEVMODE FAR * FAR *mode
#endif );
printJob Specifies the print job that you want to query to get
information on the nondefault
printer that has been selected with the report.
driverHandle Specifies a pointer to the handle of the printer driver for
the printer that is
selected with the print job.
driverLength Specifies a pointer to the length of the printer driver
name.
printerHandle Specifies a pointer to the handle of the printer that is
selected with the print job.
printerLength Specifies a pointer to the length of the printer name.
portHandle Specifies a pointer to the handle of the port to which the
selected printer is
connected.
portLength Specifies a pointer to the length of the port name.
mode Specifies a pointer to the "DEVMODE" on page 533, or DEVMODE
Windows
API structure.
TIA,
Adam
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs