#include "Ltprinter.h"
L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnInstallPrinter(pPrnInfo、uFlags)
PRNPRINTERINFO * pPrnInfo; |
/* 構造体へのポインタ*/ |
L_UINT32 uFlags; |
/* LEADTOOLS仮想プリンタドライバー型*/ |
システムにLEADTOOLS仮想プリンタドライバーをインストールします。
パラメーター |
説明 |
pPrnInfo |
プリンターをインストールするとき、使われるLEADTOOLS仮想プリンタドライバー情報を格納する構造体へのポインタ。 |
uFlags |
今後使うため確保されて、このパラメーターの値として、ゼロを使います。 |
戻り値
SUCCESS |
関数は成功しました。 |
<1 |
エラーが発生しました。リターンコードを参照してください |
コメント
システムからLEADTOOLS仮想プリンタドライバーを削除するために、L_PrnUninstallPrinter関数を呼び出します。
必須のDLLとライブラリ
ツールキットバージョンに基づいた、必要な正確なDLLとライブラリのリストについては、LEADTOOLS仮想プリンタドライバーアプリケーションで含まれるファイルを参照してください。 |
Win32 x 64
参照
関数: |
L_PrnLockPrinter, L_PrnUnlockPrinter, L_PrnUninstallPrinter, L_PrnIsLeadtoolsPrinter, L_PrnGetUserDefaultPrinterSpecifications |
トピック: |
|
|
サンプル
L_VOID PreparePrinterSpecifications( PRNPRINTERSPECIFICATIONS * pSpecific ) { pSpecific->uStructSize = sizeof( PRNPRINTERSPECIFICATIONS ); /* Custom Papers IDs starts from "DMPAPER_USER + 200" */ pSpecific->uPaperID = DMPAPER_USER + 200; strcpy_s( pSpecific->szPaperSizeName, "Custom Paper Name" ); pSpecific->dPaperHeight = 11; pSpecific->dPaperWidth = 8; pSpecific->bDimensionsInInches = TRUE; pSpecific->bPortraitOrient = TRUE; strcpy_s( pSpecific->szMarginsPrinter, "Margins Printer Name" ); pSpecific->nPrintQuality = 300; pSpecific->nYResolution = 300; } L_LTPRINTERTEX_API L_INT PrinterExample() { PRNPRINTERINFO PrnInfo; memset(&PrnInfo, 0, sizeof(PRNPRINTERINFO)); PrnInfo.uStructSize=sizeof(PRNPRINTERINFO); PrnInfo.pszPrinterName= TEXT("TEST LEADTOOLS Printer"); PrnInfo.pszDriverName= TEXT("TEST LEADTOOLS Printer DRIVER"); PrnInfo.pszMonitorName= TEXT("TEST LEADTOOLS Printer"); PrnInfo.pszPortName= TEXT("TEST LEADTOOLS Printer"); PrnInfo.pszProductName = TEXT("LEADTOOLS Printer"); PrnInfo.pszRegistryKey= TEXT("LEADTOOLS Printer Inc."); PrnInfo.pszRootDir= TEXT("C:\\LEADTOOLS 19\\Bin\\Common"); PrnInfo.pszHelpFile= TEXT("C:\\LEADTOOLS 19\\Help\\LEADTOOLS_Printer.hlp"); PrnInfo.pszPassword= TEXT("TEST Password"); PrnInfo.pszUrl= TEXT("http://www.LEADTOOLSPRINTERDRIVER.com"); PrnInfo.pszPrinterExe= TEXT("C:\\LEADTOOLS 19\\Bin\\AnyApplicationExe"); L_INT nRet = L_PrnInstallPrinter(&PrnInfo, 0); if(nRet != SUCCESS) { return nRet; } MessageBox(0,TEXT("Install New Printer Completed Successfully"),TEXT("TEST LEADTOOLS Printer"),0); L_BOOL bLEADTOOLSPrinter=FALSE; nRet = L_PrnIsLeadtoolsPrinter(PrnInfo.pszPrinterName,&bLEADTOOLSPrinter); if(nRet != SUCCESS) { return nRet; } if(bLEADTOOLSPrinter==TRUE) { /* Set LEADTOOLS Printer Specifications */ PRNPRINTERSPECIFICATIONS Specific; PRNPRINTERSPECIFICATIONS outSpecific; ZeroMemory( & Specific, sizeof( PRNPRINTERSPECIFICATIONS ) ); ZeroMemory( & outSpecific, sizeof( PRNPRINTERSPECIFICATIONS ) ); PreparePrinterSpecifications(&Specific); nRet = L_PrnSetPrinterSpecifications(PrnInfo.pszPrinterName, &Specific); if(nRet != SUCCESS) { return nRet; } L_PrnGetPrinterSpecifications(PrnInfo.pszPrinterName, &outSpecific); #ifdef LTV175_CONFIG PRNPRINTERSPECIFICATIONS defaultSpecific; PRNPRINTERSPECIFICATIONS defaultoutSpecific; ZeroMemory( & defaultSpecific, sizeof( PRNPRINTERSPECIFICATIONS ) ); ZeroMemory( & defaultoutSpecific, sizeof( PRNPRINTERSPECIFICATIONS ) ); PreparePrinterSpecifications(&defaultSpecific); nRet = L_PrnSetUserDefaultPrinterSpecifications(PrnInfo.pszPrinterName, &defaultSpecific); if(nRet != SUCCESS) { return nRet; } L_PrnGetUserDefaultPrinterSpecifications(PrnInfo.pszPrinterName, &defaultoutSpecific); #endif L_BOOL bLocked = FALSE; nRet =L_PrnIsPrinterLocked(PrnInfo.pszPrinterName, &bLocked); if(nRet != SUCCESS) { return nRet; } if(bLocked) { L_PrnUnlockPrinter(PrnInfo.pszPrinterName,PrnInfo.pszPassword); } else { L_PrnLockPrinter(PrnInfo.pszPrinterName,PrnInfo.pszPassword); } } return SUCCESS; }