[Migrated content. Thread originally posted on 11 December 2007]
Does anyone have any experience with calling a non "dll" Version 8. I am trying to retrieve the share printer name calling "winspool.drv" the programs executes, nothing seems to be returned, I know the return status is set to "0" saying its failed, but do not know the reason why ?Any suggestions ?
The code is below:
A 78 TheBufferPointer VALUE 2048.
A 01 TheBufferedResults
A PIC X(TheBufferPointer) VALUE SPACE.
A 01 THE-SELECTED-PRINTER PIC X(120).
A *This status variable tests the result of the FindFile
A *functions.
A 01 FIND-STATUS UNSIGNED-LONG.
A 88 IS-FALSE VALUE 0.
A 77 ThePrinterHandle UNSIGNED-LONG VALUE 0.
A 77 ThePrinterDefaults UNSIGNED-LONG VALUE 0.
A 77 TheBufferSize UNSIGNED-LONG VALUE 0.
A 77 TheBufferSizeNeeded UNSIGNED-LONG VALUE 0.
A 77 TheFunctionLevel UNSIGNED-LONG VALUE 0.
A *Level or type of structure to store
A 88 LEVEL2 VALUE 02.
E842 SET ENVIRONMENT "CODE_MAPPING" TO "ON".
E842 SET ENVIRONMENT "DLL_CONVENTION" TO "1".
1829 * CALL "winspool.drv" giving find-status.
1829 * CALL "winspool.exe" giving find-status.
1829 CALL "C:\\WINDOWS\\SYSTEM\\winspool.drv" giving find-status.
E842 MOVE CHOSEN-PRINTER TO THE-SELECTED-PRINTER.
E842 INSPECT THE-SELECTED-PRINTER
E842 REPLACING TRAILING SPACES BY LOW-VALUE.
1829 CALL "OpenPrinterA" USING
E842 By Reference THE-SELECTED-PRINTER,
A bY value ThePrinterHandle,
A by value ThePrinterDefaults,
giving find-status.
A SET LEVEL2 TO TRUE.
1829 CALL "GetPrinterA" USING
A by value ThePrinterHandle,
A by value TheFunctionLevel,
A by reference TheBufferedResults(1:TheBufferPointer),
A by value TheBufferSize,
A by value TheBufferSizeNeeded,
A giving find-status.
1829 CALL "ClosePrinter" USING
A By Reference ThePrinterHandle,
A giving find-status.
E842 CANCEL "winspool.drv".
E842 SET ENVIRONMENT "DLL-CONVENTION" TO 0.



