Windows StartDocPrinter() function in Clarion

Hello,

How do I implement StartDocPrinter() function in Clarion?

With WinApi application I can get prototypes and structure for all necessary Windows print API functions.

For DOCINFO there is a:

DOCINFO    GROUP,TYPE
cbSize       SHORT
lpszDocName  LONG!*LPCSTR
lpszOutput   LONG!*LPCSTR
lpszDataType LONG!*LPCSTR
fwType       DWORD
            END

I changed that to:

DOCINFO    GROUP,TYPE
lpszDocName  LONG!*LPCSTR
lpszOutput   LONG!*LPCSTR
lpszDataType LONG!*LPCSTR
            END

So it is structure described for DOC_INFO_1.

WinApi application says definition for StartDocPrinter() is StartDocPrinterA(HANDLE,DWORD,*BYTE),DWORD,PASCAL. If I add NAME('StartDocPrinter') I get error ā€œUnresolved external StartDocPrinterā€¦ā€.

Last parameter is acctualy a DOCINFO as LPBYTE in C++.

For DOCINFO fields i use ADDRESS(), how do I send parameter *BYTE which is acctualy LPBYTE in C++ and I can use (LPSTR)&DocInfo to send it to the StartDocPrint().

Do I need to change type of the parameters in StartDocPrinter()?

I get controled error when I use StartDocPrinterA(HANDLE,DWORD,*LONG),DWORD,PASCAL, where last parameter is local LONG variable and value is ADDRESS(myDOCINFO). Everthing else is crash and GPF window.

I tried StartDocPrinterA(HANDLE,DWORD,*DOCINFO),DWORD,PASCAL, it did not helped.

check this article Print directly to printer (Bjarne Havnen ) - Icetips Article

1 Like

Thank you. My mistake was when sending as ...,*DOCINFO), I changed DOCINFO fields from LONG to CSTRING.

1 Like