I have been working on a routine that loads custom printer forms into a printer.
This uses the BAP package for creating structures and the Windows API function: AddForm().
AddForm() exists in SPOOLSS.DLL.
My program fails because SPOOLSS.DLL will not load.
I ran ESET anti-virus scan against the SPOOLSS.DLL and set all the proper permissions.
Still no go.
I need to have other eXpress++ users do something for me and tell me the results.
1. Start up XDOT.EXE
2. At the prompt type: n := DllLoad('SPOOLSS.DLL')
3. At the prompt type: ? n
Please tell me what value is returned. If it is a 0 then you also cannot load SPOOLSS.DLL.
If it is a positive number then you don't have the problem.
Also, please tell me the date, time and size of your c:\windows\system32\spoolss.dll.
Thank you.
Need help with SPOOLSS.DLL
Need help with SPOOLSS.DLL
The eXpress train is coming - and it has more cars.
Re: Need help with SPOOLSS.DLL
Roger,
here i can't load spoolss.dll (Date 2009/07/14, Time 03:31, 57856 Bytes, Win 7)
here i can't load spoolss.dll (Date 2009/07/14, Time 03:31, 57856 Bytes, Win 7)
Klaus
-
- Posts: 481
- Joined: Wed Jan 27, 2010 10:25 pm
- Location: Berlin Germany
Re: Need help with SPOOLSS.DLL
Same here - spoolss.dll (Date 2015/07/15, Time 05:18, 92672 Bytes, Win 10)
_______________________
Best Regards
Wolfgang
Best Regards
Wolfgang
Re: Need help with SPOOLSS.DLL
have not try "AddForm" yet but all my other Printer*** API Function point to winspool.drvrdonnay wrote:I have been working on a routine that loads custom printer forms into a printer.
This uses the BAP package for creating structures and the Windows API function: AddForm().
AddForm() exists in SPOOLSS.DLL.
***https://msdn.microsoft.com/de-de/librar ... s.85).aspx
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
also look at this http://www.codeproject.com/Articles/891 ... chitecture
VS DotNet Code http://www.codeproject.com/Articles/122 ... d-printers
found VB Code on MSDN
https://support.microsoft.com/en-us/kb/282474
Code: Select all
Public Declare Function AddForm Lib "winspool.drv" Alias "AddFormA" _
(ByVal hPrinter As Long, ByVal Level As Long, pForm As Byte) As Long
Public Declare Function DeleteForm Lib "winspool.drv" Alias "DeleteFormA" _
(ByVal hPrinter As Long, ByVal pFormName As String) As Long
greetings by OHR
Jimmy
Jimmy
Re: Need help with SPOOLSS.DLL
Code: Select all
Public Declare Function AddForm Lib "winspool.drv" Alias "AddFormA" _
(ByVal hPrinter As Long, ByVal Level As Long, pForm As Byte) As Long
I had already tried AddFormA but not winspool.drv.
I DID use winspool.drv for OpenPrinter().
Ok, after using winspool.drv and AddFormA I finally get the dll to load.
I had IDSC problems until I got all the pointers correct in the 2 structures.
Now it runs without a runtime error but always returns 0, meaning there was a failure.
One of the frustrations of the Window API is that it doesn't give any explanation of the failure.
The eXpress train is coming - and it has more cars.
Re: Need help with SPOOLSS.DLL
I finally have been able to run my routine without an error.
It adds the form with the correct name but not with the correct sizes.
The spec says the width and height should be in thousands of millimeters.
No matter what numbers I use, from 0 to 200000, the width and height in the added form shows as 11099.62in.
Any ideas on what's going on?
I have not found any BAP sample programs that show how to use a BAP structure within another BAP structure.
I may be doing this wrong but I don't know any other method.
Here is my code:
It adds the form with the correct name but not with the correct sizes.
The spec says the width and height should be in thousands of millimeters.
No matter what numbers I use, from 0 to 200000, the width and height in the added form shows as 11099.62in.
Any ideas on what's going on?
I have not found any BAP sample programs that show how to use a BAP structure within another BAP structure.
I may be doing this wrong but I don't know any other method.
Here is my code:
Code: Select all
/*
BOOL AddForm(
_In_ HANDLE hPrinter,
_In_ DWORD Level,
_In_ LPBYTE pForm
);
The FORM_INFO_1 structure contains information about a print form.
The information includes the print form's origin, its name,
its dimensions, and the dimensions of its printable area.
Syntax
C++
typedef struct _FORM_INFO_1 {
DWORD Flags;
LPTSTR pName;
SIZEL Size;
RECTL ImageableArea;
} FORM_INFO_1, *PFORM_INFO_1;
Members
Flags
The form properties. The following values are defined.
Value Meaning
FORM_USER If this bit flag is set, the form has been defined by the user.
Forms with this flag set are defined in the registry.
FORM_BUILTIN If this bit-flag is set, the form is part of the spooler.
Form definitions with this flag set do not appear in the registry.
FORM_PRINTER If this bit flag is set, the form is associated with a certain
printer, and its definition appears in the registry.
pName
Pointer to a null-terminated string that specifies the name of the form.
The form name cannot exceed 31 characters.
Size
The width and height, in thousandths of millimeters, of the form.
ImageableArea
The width and height, in thousandths of millimeters, of the form.
Requirements
Printing
Print Spooler API Structures
AddForm
GetForm
SetForm
*/
#INCLUDE "dcdialog.CH"
#INCLUDE "dll.CH"
#INCLUDE "bap.CH"
#define FORM_USER 0
#define FORM_BUILTIN 1
#define FORM_PRINTER 2
STATIC snHdll
FUNCTION Main()
LOCAL cPrinterName := 'Epson ESC/P-R', ;
cFormName := 'RogerTestForm'
x := PrinterAddForm( cPrinterName, cFormName, 200, 250 )
? x
wait
RETURN nil
* -----------
FUNCTION SizeStructure( nWidth, nHeight )
LOCAL aBin := BaInit(2), cBin
BaStruct( aBin, nWidth ) // Width
BaStruct( aBin, nHeight ) // height
cBin := BaAccess(aBin)
RETURN cBin
* -----------
FUNCTION FormStructure( nFlags, cFormName, sSize, sRect )
LOCAL aBin := BaInit(4), cBin
cFormName := Pad(cFormName+Chr(0),31)
BaStruct( aBin, nFlags ) // Flags
BaStruct( aBin, @cFormName ) // Name
BaStruct( aBin, @sSize ) // SIZEL
BaStruct( aBin, @sRect ) // RECTL
cBin := BaAccess(aBin)
RETURN cBin
* -------------
FUNCTION PrinterAddForm( cPrinterName, cFormName, nWidth, nHeight )
LOCAL sSize, sRect, nFlags, hPrinter := 0, sForm, nLevel := 1
sSize := SizeStructure( nWidth, nHeight )
sRect := SizeStructure( nWidth, nHeight )
nFlags := FORM_USER + FORM_PRINTER
sForm := FormStructure( nFlags, cFormName, @sSize, @sRect )
x := OpenPrinterA( cPrinterName, @hPrinter, nil )
wtf x, hPrinter
IF hPrinter > 0
RETURN AddFormA( hPrinter, nLevel, sForm )
ENDIF
RETURN -1
* -------------
DLLFUNCTION AddFormA( hPrinter, nLevel, @sForm ) USING STDCALL FROM WINSPOOL.DRV
DLLFUNCTION OpenPrinterA( cPrinterName, @hPrinter, sDefaults ) USING STDCALL FROM WINSPOOL.DRV
The eXpress train is coming - and it has more cars.