Windows C++: DocumentProperties() не изменяет настройки печати StartDocPrinter()C++

Программы на C++. Форум разработчиков
Anonymous
 Windows C++: DocumentProperties() не изменяет настройки печати StartDocPrinter()

Сообщение Anonymous »

Хочу печатать на двусторонней печати (дуплекс), для этого использую:

Код: Выделить всё

#include 
#include 
#include 
#include 
#include 
#include 

LPDEVMODE GetLandscapeDevMode(HANDLE hPrinter, LPTSTR pDevice)
{
LPDEVMODE pDevMode;
DWORD dwNeeded, dwRet;

/*
* Step 1:
* Allocate a buffer of the correct size.
*/
dwNeeded = DocumentProperties(NULL,
hPrinter, /* Handle to our printer. */
pDevice, /* Name of the printer. */
NULL, /* Asking for size, so */
NULL, /* these are not used. */
0); /* Zero returns buffer size. */
pDevMode = (LPDEVMODE)malloc(dwNeeded);

/*
* Step 2:
* Get the default DevMode for the printer and
* modify it for your needs.
*/
dwRet = DocumentProperties(NULL,
hPrinter,
pDevice,
pDevMode, /* The address of the buffer to fill. */
NULL, /* Not using the input buffer. */
DM_OUT_BUFFER); /* Have the output buffer filled. */
if (dwRet != IDOK)
{
/* If failure, cleanup and return failure. */
free(pDevMode);
ClosePrinter(hPrinter);
return NULL;
}

/*
* Make changes to the DevMode which are supported.
*/
if (pDevMode->dmFields & DM_ORIENTATION)
{
/* If the printer supports paper orientation, set it.*/
pDevMode->dmOrientation = DMORIENT_LANDSCAPE;
}

if (pDevMode->dmFields & DM_DUPLEX)
{
/* If it supports duplex printing, use it. */
pDevMode->dmDuplex = DMDUP_HORIZONTAL;
std::wcerr 

Подробнее здесь: [url]https://stackoverflow.com/questions/79013379/windows-c-documentproperties-doesnt-modify-the-print-settings-of-startdoc[/url]

Вернуться в «C++»