Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
Programming with the LEADTOOLS Virtual Printer Driver
Take the following steps to create and run a program that uses the LEADTOOLS Virtual Printer Driver.
1. |
Start Visual Studio 2005 |
2. |
From the main menu, choose File->New->Project... |
3. |
In the New Project dialog box, choose Visual C++ in the Projects Types, and choose Win32 Project in the Templates. |
4. |
Type the project name as LEADTOOLS Printer in the Project Name field. |
5. |
In the Location field, use the Browse button to navigate to the Examples subdirectory (such as C:\LEAD Technologies\LEADTOOLS 16\Examples\CDLL). Uncheck both Create directory for solution and Add to Source Control options. Click OK. |
6. |
Click Next> in the Win32 Application Wizard. |
7. |
Select Windows application and Empty project and do not add common header files for ATL. Then click Finish. Three empty folders will be created, entitled: "Header Files", "Resource Files", and "Source Files". |
|
Folders Content: Inside Visual Studio 2005 in the Solution Explorer review the folders. They must be empty. If there are any objects or files in them, delete this project and restart from the first step. |
|
Project Structure: Once the project is acceptable, in Windows Explorer go to the newly created project LEADTOOLSPrinter folder in the Examples directory. Make sure the project folder named LEADTOOLSPrinter exists in the correct directory. Inside the LEADTOOLSPrinter folder, there should not be any additional folders. If there are, remove the entire project folder and redo all previous steps. |
8. |
From the main menu, choose Project->Properties. |
9. |
In the Properties dialog box, choose Configuration Properties then select General. |
10. |
In right side set Use of MFC property to use MFC in a shared dll then click OK. |
11. |
In Solution Explorer, right-click on the Header Files folder, then Add->New Item. In Categories, choose Code. In the Templates, select Header File (.h). In the Name field type LEADTOOLSPrinter. Click Add. Inspect the newly created header file and make sure it is empty. |
12. |
Add to the Ltprinter.h in the Header Files the following code: |
#if !defined(LTPRINTER_H)
#define LTPRINTER_H
#if !defined(L_LTPRINTER_API)
#define L_LTPRINTER_API
#endif // #if !defined(L_LTPRINTER_API)
#include "Lttyp.h"
#include "Lterr.h"
#define L_HEADER_ENTRY
#include "Ltpck.h"
/****************************************************************
Callback typedefs
****************************************************************/
typedef L_INT (pEXT_CALLBACK PRNEMFRGSPROC)(L_TCHAR * pszPrinterName,
HGLOBAL hMem, // Should be freed using the Windows GlobalFree function
L_UINT uSize,
L_VOID * pData);
typedef L_INT (pEXT_CALLBACK PRNJOBINFOPROC)(L_TCHAR * pszPrinterName,
DWORD dwJobID,
DWORD dwFlags,
L_VOID * pData);
/****************************************************************
Enums/defines/macros
****************************************************************/
#ifndef L_MAX_PATH
#define L_MAX_PATH 260
#endif
#define MAX_STRING 255
#define MAX_PRINTER_NAME 256
// Support Types for ePrint
#define PRN_SUPPORT_DOCUMENT 1 // DOCUMENT ....
#define PRN_SUPPORT_EVAL 2 // Evaluation Copy.
#define PRN_JOB_START 0x00000001L
#define PRN_JOB_END 0x00000002L
typedef struct _tagPrnPrinterInfoA
{
L_UINT uStructSize; /* Size of the structure */
L_CHAR *pszPrinterName; /* Printer Name */
L_CHAR *pszDriverName; /* Driver Name */
L_CHAR *pszMonitorName; /* Monitor Name */
L_CHAR *pszPortName; /* Port Name */
L_CHAR *pszProductName; /* Product Name */
L_CHAR *pszRegistryKey; /* Reg Subkey on HKCU\Software to store Printer Information*/
L_CHAR *pszRootDir; /* Root Directory*/
L_CHAR *pszHelpFile; /* Help File Name*/
L_CHAR *pszPassword; /* password */
L_CHAR *pszUrl; /* URL to redirect user when printer is locked */
L_CHAR *pszPrinterExe; /* Printer Exe Path*/
} PRNPRINTERINFOA, * pPRNPRINTERINFOA;
#if defined(FOR_UNICODE)
typedef struct _tagPrnPrinterInfo
{
L_UINT uStructSize; /* Size of the structure */
L_TCHAR *pszPrinterName; /* Printer Name */
L_TCHAR *pszDriverName; /* Driver Name */
L_TCHAR *pszMonitorName; /* Monitor Name */
L_TCHAR *pszPortName; /* Port Name */
L_TCHAR *pszProductName; /* Product Name */
L_TCHAR *pszRegistryKey; /* Reg Subkey on HKCU\Software to store Printer Information*/
L_TCHAR *pszRootDir; /* Root Directory*/
L_TCHAR *pszHelpFile; /* Help File Name*/
L_TCHAR *pszPassword; /* password */
L_TCHAR *pszUrl; /* URL to redirect user when printer is locked */
L_TCHAR *pszPrinterExe; /* Printer Exe Path*/
L_TCHAR *pszAboutString; /* About String*/
L_TCHAR *pszAboutIcon; /* About Icon Path*/
} PRNPRINTERINFO, * pPRNPRINTERINFO;
#else
typedef PRNPRINTERINFOA PRNPRINTERINFO;
typedef pPRNPRINTERINFOA pPRNPRINTERINFO;
#endif // #if defined(FOR_UNICODE)
typedef struct _tagPrnPrinterSpecifications
{
L_UINT uStructSize;
L_UINT uPaperID; // If the paper is a predefined paper; then the IDs
// range will be: 1 - 41.
// If the paper is a custom paper; then the ID will
// be: >= DMPAPER_USER + 200
L_CHAR szPaperSizeName[ MAX_STRING ];
L_DOUBLE dPaperWidth;
L_DOUBLE dPaperHeight;
L_BOOL bDimensionsInInches;
L_BOOL bPortraitOrient;
L_CHAR szMarginsPrinter[ MAX_PRINTER_NAME ];
L_INT nPrintQuality;
L_INT nYResolution;
} PRNPRINTERSPECIFICATIONS, * pPRNPRINTERSPECIFICATIONS;
/****************************************************************
Function prototypes
****************************************************************/
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnLockPrinterA( L_CHAR * pszPrinterName, L_CHAR * pszPassword );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnUnlockPrinterA( L_CHAR * pszPrinterName, L_CHAR * pszPassword );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnIsPrinterLockedA( L_CHAR * pszPrinterName, L_BOOL * pbLocked );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnInstallPrinterA( PRNPRINTERINFOA * pPrnInfo, L_UINT32 uFlags);
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnUninstallPrinterA( PRNPRINTERINFOA * pPrnInfo );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnRegisterEMFCallbackA( L_CHAR * pszPrinterName, PRNEMFRGSPROC fnEMFCallback, L_VOID * pData);
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnRegisterJobCallbackA( L_CHAR * pszPrinterName, PRNJOBINFOPROC fnJobInfoCallBack, L_VOID * pData);
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnUnRegisterEMFCallbackA( L_CHAR * pszPrinterName );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnUnRegisterJobCallbackA( L_CHAR * pszPrinterName );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnSetPrinterSpecificationsA( L_CHAR * pszPrinterName, PRNPRINTERSPECIFICATIONS * pSpecifications );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnGetPrinterSpecificationsA( L_CHAR * pszPrinterName, PRNPRINTERSPECIFICATIONS * pSpecifications );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnIsLeadtoolsPrinterA( L_CHAR * pszPrinterName,L_BOOL* pbLeadtoolsPrinter);
#if defined(FOR_UNICODE)
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnLockPrinter( L_TCHAR * pszPrinterName, L_TCHAR * pszPassword );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnUnlockPrinter( L_TCHAR * pszPrinterName, L_TCHAR * pszPassword );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnIsPrinterLocked( L_TCHAR * pszPrinterName, L_BOOL * pbLocked );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnInstallPrinter( PRNPRINTERINFO * pPrnInfo, L_UINT32 uFlags);
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnUninstallPrinter( PRNPRINTERINFO * pPrnInfo );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnRegisterEMFCallback( L_TCHAR * pszPrinterName, PRNEMFRGSPROC fnEMFCallback, L_VOID * pData);
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnRegisterJobCallback( L_TCHAR * pszPrinterName, PRNJOBINFOPROC fnJobInfoCallBack, L_VOID * pData);
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnUnRegisterEMFCallback( L_TCHAR * pszPrinterName );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnUnRegisterJobCallback( L_TCHAR * pszPrinterName );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnSetPrinterSpecifications( L_TCHAR * pszPrinterName, PRNPRINTERSPECIFICATIONS * pSpecifications );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnGetPrinterSpecifications( L_TCHAR * pszPrinterName, PRNPRINTERSPECIFICATIONS * pSpecifications );
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnIsLeadtoolsPrinter( L_TCHAR * pszPrinterName,L_BOOL* pbLeadtoolsPrinter);
#else
define L_PrnLockPrinter L_PrnLockPrinterA
define L_PrnUnlockPrinter L_PrnUnlockPrinterA
define L_PrnIsPrinterLocked L_PrnIsPrinterLockedA
define L_PrnInstallPrinter L_PrnInstallPrinterA
define L_PrnUninstallPrinter L_PrnUninstallPrinterA
define L_PrnRegisterEMFCallback L_PrnRegisterEMFCallbackA
define L_PrnRegisterJobCallback L_PrnRegisterJobCallbackA
define L_PrnUnRegisterEMFCallback L_PrnUnRegisterEMFCallbackA
define L_PrnUnRegisterJobCallback L_PrnUnRegisterJobCallbackA
define L_PrnSetPrinterSpecifications L_PrnSetPrinterSpecificationsA
define L_PrnGetPrinterSpecifications L_PrnGetPrinterSpecificationsA
define L_PrnIsLeadtoolsPrinter L_PrnIsLeadtoolsPrinterA
#endif // #if defined(FOR_UNICODE)
#undef L_HEADER_ENTRY
#include "Ltpck.h"
#endif // #if !defined(LTPRINTER_H)
13. |
In Solution Explorer, right-click on the Header Files folder, then Add->New Item. |
14. |
In Categories, select Code. In the Templates, select Header File (.h). In the Name field type stdAfx then click Add. Inspect the newly created header file and make sure it is empty then add the following code: |
#if !defined(AFX_STDAFX_H__FE71D496_8F54_4417_9E80_A39014A134CF__INCLUDED_)
#define AFX_STDAFX_H__FE71D496_8F54_4417_9E80_A39014A134CF__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#include <string.h>
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxpriv.h>
#include "..\..\..\Include\L_Bitmap.h"
#include "..\..\..\include\ltDlg.h"
#include "..\..\..\Include\Ltprinter.h"
#include "..\..\..\Include\ltDocWrt.h"
#include "PageListView.h"
#include "PrinterDemo.h"
#include "ProgressDlg.h"
#include "PrinterPasswordDlg.h"
#include "UninstallPrinterDlg.h"
#include "InstallPrinterPage.h"
#include "MainFrm.h"
#include "PrinterDemoDoc.h"
#include "PrinterDemoView.h"
#include "..\Common\ltdemos.h"
#define CONNECTION_EXE_PATH TEXT( "SOFTWARE\\LEAD Technologies, Inc.\\Printer\\Data")
#define CONNECTION_DRIVER_DATA TEXT("\\PrinterDriverData" )
#define LEADTOOLS_PRINTER_SOFTWARE_KEY TEXT("SOFTWARE\\LEAD Technologies, Inc.\\Printer\\")
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__FE71D496_8F54_4417_9E80_A39014A134CF__INCLUDED_)
15. |
In the Source Files, right -click on the folder. Choose Add->New Item. Choose Code in Categories, and C++ File(.cpp) in Templates. Type Imports in the name field and click Add. |
16. |
Right click on Imports.cpp and click Open. Add the following code: |
#include "stdafx.h"
#if defined(WIN64)
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\CDLL\\x64\\Ltkrn_x.lib")
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\cdll\\x64\\Ltprinter_x.lib")
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\cdll\\x64\\LtDocWrt_x.lib")
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\cdll\\x64\\Ltdlgfile_x.lib")
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\cdll\\x64\\Ltdlgkrn_x.lib")
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\cdll\\x64\\Ltfil_x.lib")
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\cdll\\x64\\Ltdis_x.lib")
#else
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\CDLL\\Win32\\Ltkrn_u.lib")
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\cdll\\win32\\Ltprinter_u.lib")
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\cdll\\win32\\LtDocWrt_u.lib")
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\cdll\\win32\\Ltdlgfile_u.lib")
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\cdll\\win32\\Ltdlgkrn_u.lib")
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\cdll\\win32\\Ltfil_u.lib")
#pragma comment(lib, "..\\..\\..\\Lib"L_VER_DESIGNATOR"\\cdll\\win32\\Ltdis_u.lib")
#endif // #if defined(WIN64)
17. |
In the Source Files, right click on the folder. Choose Add -> New Item. Choose Code in Categories, In the Templates, select Header File (.h). In Name field type LEADTOOLSPrinter and choose Add. |
18. |
Right-click on LEADTOOLSPrinter.h and click Open. Add to it the following code: |
// LEADTOOLSPrinter.h :
//
///////////////////////////////////////////////////////////////////////
#if ! defined (AFX_LeadtoolsPrinter_H__4484BA1F_608A_42B7_82D2_9921D8DAE966__INCLUDED_)
#define AFX_LeadtoolsPrinter_H__4484BA1F_608A_42B7_82D2_9921D8DAE966__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CLeadtoolsPrinter
{
protected : // create from serialization only
CLeadtoolsPrinter ();
public :
virtual ~ CLeadtoolsPrinter();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected :
L_VOID DrawStartedPage(CDC* pDC , RECT * pClientRect);
L_VOID RegisterJobCallBack();
L_VOID RegisterEmfCallBack();
L_INT InstallPrinter();
L_INT PrintCurrentPage();
L_VOID LockPrinter();
L_VOID UnlockPrinter();
static L_INT (EXT_CALLBACK OnEmfRgsProc)( L_WCHAR*, HGLOBAL, L_UINT, L_VOID* );
static L_INT (EXT_CALLBACK OnJobInfoProc)( L_WCHAR*, DWORD, DWORD, L_VOID* );
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_LeadtoolsPrinter_H__4484BA1F_608A_42B7_82D2_9921D8DAE966__INCLUDED_)
19. |
In the Source Files, right-click on the folder. Choose Add->New Item. Choose Code in Categories, and C++ File(.cpp) in Templates. Type LEADTOOLSPrinter in the name field and click Add. |
20. |
Right-click on LEADTOOLSPrinter.cpp and click Open. Add to it the following code: |
#include "stdafx.h"
#include " LEADTOOLSPrinter.h "
L_INT CLeadtoolsPrinter::InstallNewPrinter()
{
PRNPRINTERINFO docPrinterInfo;
memset(&docPrinterInfo, 0, sizeof(PRNPRINTERINFO));
docPrinterInfo.uStructSize = sizeof(PRNPRINTERINFO);
docPrinterInfo.pszRootDir =
TEXT("C:\\Program Files\\PrinterDriver");
docPrinterInfo.pszPrinterName = TEXT("TestPrinter");
docPrinterInfo.pszDriverName = TEXT("TestPrinter");
docPrinterInfo.pszProductName = TEXT("TestPrinter");
docPrinterInfo.pszRegistryKey = TEXT("SOFTWARE\\Printer\\TestPrinter");
docPrinterInfo.pszUrl = TEXT("http://www.LEADTOOLS.com");
docPrinterInfo.pszPassword = TEXT("123");
docPrinterInfo.pszPrinterExe = TEXT("c:\\TestDemo.exe");
docPrinterInfo.pszAboutString = TEXT("LEADTOOLSPriner");
docPrinterInfo.pszAboutIcon = TEXT("c:\\LEADTOOLSPriner.ico");
L_PrnInstallPrinter(&docPrinterInfo, 0);
}
void CLeadtoolsPrinter::RegisterEmfCallBack()
{
L_PrnRegisterEMFCallback(TEXT("TestPrinter"),OnEmfRgsProc,this);
}
void CLeadtoolsPrinter::RegisterJobCallBack()
{
L_PrnRegisterJobCallback(TEXT("TestPrinter"), OnJobInfoProc,this);
}
L_INT CLeadtoolsPrinter::OnEmfRgsProc( L_WCHAR * /*pszPrinter*/,
HGLOBAL hMem,
L_UINT uSize,
L_VOID * pData )
{
static L_INT nCounter = 0;
HANDLE hFile = INVALID_HANDLE_VALUE;
DWORD uSizeWritten = 0;
L_UCHAR * pEmfData= (L_UCHAR*) GlobalLock( hMem );
CString szFileName = TEXT("c:\\1.emf");
if( pEmfData )
{
hFile = CreateFile(szFileName, GENERIC_WRITE, FILE_SHARE_READ,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL);
if( hFile != INVALID_HANDLE_VALUE )
{
WriteFile( hFile, pEmfData, uSize, & uSizeWritten, NULL );
CloseHandle( hFile );
}
GlobalUnlock( hMem );
}
// Don't forget freeing the mem.
GlobalFree( hMem );
return 1;
}
// You need always to free hMem.
L_INT CLeadtoolsPrinter::OnJobInfoProc( L_WCHAR * pszPrinter, DWORD dwJobID,
DWORD dwFlags, L_VOID * pData )
{
switch( dwFlags )
{
case PRN_JOB_START:
//Job was started
break;
case PRN_JOB_END:
//Job was ended
break;
}
return 1;
}
L_INT CLeadtoolsPrinter::PrintCurrentPage()
{
HDC hDC = CreateDC(NULL, TEXT("TestPrinter"), NULL,NULL);
if(hDC)
{
int nRet = 0;
DOCINFO docInfo;
memset(&docInfo,0,sizeof(DOCINFO));
nRet = StartDoc(hDC,&docInfo);
if(nRet)
{
nRet = StartPage(hDC);
if(nRet)
{
RECT rcPaper;
rcPaper.left = 0;
rcPaper.top = 0;
rcPaper.right = GetDeviceCaps(hDC, HORZRES);
rcPaper.bottom = GetDeviceCaps(hDC, VERTRES);
CDC cd;
cd.Attach(hDC);
DrawStartedPage(&cd, &rcPaper);
cd.Detach();
nRet = EndPage(hDC);
}
nRet = EndDoc(hDC);
}
DeleteDC(hDC);
}
}
void CLeadtoolsPrinter::DrawStartedPage(CDC * pDC, RECT * pClientRect)
{
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
HFONT hOldFont = NULL;
HFONT hFont = NULL;
lf.lfHeight = - MulDiv( 12, pDC->GetDeviceCaps( LOGPIXELSY ), 72);
lstrcpy(lf.lfFaceName, TEXT("Times New Roman") );
hFont = CreateFontIndirect( & lf );
hOldFont = (HFONT )pDC->SelectObject( hFont );
pDC->SetTextColor( RGB( 0, 0, 255 ) );
CString strPageText= "\n LEADTOOLS Printer Main Demo \
\n ------------------------------------------------------------ \
\n This demo program demonstrates the usage of the LEADTOOLS Printer functionality. \
\n ------------------------------------------------------------ \
\n \
\n You can use this demo in one of two ways: \
\n \
\n Printing from other applications: \
\n 1 - Print from any application to the currently selected printer (see the demo caption for the currently selected printer). \
\n 2 - From the main menu, select \"File | Save As\", then save the printed document as PDF, DOC, etc, or as a supported raster format. \
\n You can repeat the save as many times as necessary. \
\n \
\n Printing from this application: \
\n 1 - From the main menu, select \"File | Print Current Page\", to print the contents of this page. \
\n 2 - From the main menu, select \"File | Save As\", then save the printed document as PDF, DOC, etc, or as a supported raster format. \
\n You can repeat the save as many times as necessary. ";
pDC->DrawText( strPageText, strPageText.GetLength(), pClientRect, DT_LEFT);
pDC->SelectObject( hOldFont );
DeleteObject( hFont );
}
void CLeadtoolsPrinter::LockPrinter()
{
int nRet=0;
nRet=L_PrnLockPrinter(TEXT("TestPrinter"), TEXT("1234"));
if(nRet!=SUCCESS)
{
MessageBox(TEXT("Locking printer failed"), TEXT("Error"), MB_OK );
}
else
MessageBox(TEXT("Printer is locked. You will no longer be able to print to it."), TEXT("LEADTOOLS Printer"), MB_OK );
}
}
void CLeadtoolsPrinter::UnlockPrinter()
{
L_INT nRet = L_PrnUnlockPrinter(TEXT("TestPrinter"), TEXT("1234"));
if (nRet == SUCCESS)
MessageBox(TEXT("Printer is unlocked."), TEXT("LEADTOOLS Printer"), MB_OK );
else
MessageBox(TEXT("Unlocking printer failed."), TEXT("Error"), MB_OK );
}
}
21. |
Compile and run the code to test it. |
For more information, refer to:
Working with the LEADTOOLS Virtual Printer
See also: