Looks fabulous. Glad to know that it works with BC%.01 (which is what I am using) But one more questions. I don't want to sound dumb but whgat is the pDevice parameter that I am passing it?? Thanks.
Main Topics
Browse All TopicsHow do I set the page orentaion of the printer with out using the printer dialog? I have an MDI that some reports should be landscape and some should be portrait. I have not quite been able to figure how to do this.
Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I don't think that is correct for BC5.01.
I put the code into my programs just to give it a test compile and there are several things that are only Microsoft.
The structs: PRINTER_INFO_Z, PRINTER_DEFAULTS, PRINTER_ALL_ACCESS.
The Functions: ZeroMemory(), OpenPrinter, GetPrinter, DocumentProperties, and SetPrinter.
Any other ideas??
Thanks.
Next is my own working code(from my apps, solded to 15 users), for BC 5.01
This code , i hope, replyes to all
you questions:
/*========================
/* Name : GetPrinterDC */
/* Description : Get DC of Default Printer(from WIN.INI) */
/* Arguments : None */
/* Return : Context or NULL(error) */
/*========================
HDC GetPrinterDC (HWND hwnd)
{
HDC hDC = NULL;
char szPrinter[80], *szDevice, *szDriver, *szOutput;
memset(szPrinter, 0, sizeof(szPrinter));
GetProfileString("windows"
if (*szPrinter) //get defoult printer
{
if (NULL != (szDevice = strtok(szPrinter,",")) &&
NULL != (szDriver = strtok(NULL,",")) &&
NULL != (szOutput = strtok(NULL,",")))
{
LPDEVMODE lpDevMode = GetLandscapeDevMode(hwnd,s
//create DC
hDC = CreateDC(szDriver,szDevice
if (lpDevMode)
free(lpDevMode);
}
}
return hDC; // if EnumPrinters failed, so return null hdc
}
/*========================
/* Name : GetLandscapeDevMode */
/* Description : Set Landscape mode(frm MSDN */
/* Arguments : Result,1-stSubTitlw,1-st sub text, */
/* : 2-stSubTitlw,2-nd sub text,size of Text */
/* : current line, Number items in Print, */
/* : delimeter */
/* Return val : None */
/*========================
LPDEVMODE GetLandscapeDevMode(HWND hWnd, char *pDevice)
{
HANDLE hPrinter;
LPDEVMODE pDevMode;
DWORD dwNeeded, dwRet;
/* Start by opening the printer */
if (!OpenPrinter(pDevice, &hPrinter, NULL))
return NULL;
/*
* Step 1:
* Allocate a buffer of the correct size.
*/
dwNeeded = DocumentProperties(hWnd,
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 our needs.
*/
dwRet = DocumentProperties(hWnd,
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;
/*
* Step 3:
* Merge the new settings with the old.
* This gives the driver a chance to update any private
* portions of the DevMode structure.
*/
dwRet = DocumentProperties(hWnd,
hPrinter,
pDevice,
pDevMode, /* Reuse our buffer for output. */
pDevMode, /* Pass the driver our changes. */
DM_IN_BUFFER | /* Commands to Merge our changes and */
DM_OUT_BUFFER); /* write the result. */
/* Done with the printer */
ClosePrinter(hPrinter);
if (dwRet != IDOK)
{
/* if failure, cleanup and return failure */
free(pDevMode);
return NULL;
}
/* return the modified DevMode structure */
return pDevMode;
}
>>Did you write your own functions for these??
No it is standart API .
For example OpenPrinter(from BC help):
-------------
OpenPrinter
The OpenPrinter function retrieves a handle identifying the specified printer or print server.
BOOL OpenPrinter(
LPTSTR pPrinterName, // pointer to printer or server name
LPHANDLE phPrinter, // pointer to printer or server handle
LPPRINTER_DEFAULTS pDefault // pointer to printer defaults structure
);
Parameters
pPrinterName
Points to a null-terminated string that specifies the name of the printer or print server.
phPrinter
Points to a variable that receives the handle identifying the opened printer or print server object.
pDefault
Points to a PRINTER_DEFAULTS structure. This value can be NULL.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
The pDefault parameter allows an application to specify the data type and device mode values that are used for printing documents submitted by the StartDocPrinter function. However, these values can be overridden by using the SetJob function once a document has been started.
The DesiredAccess member of the PRINTER_DEFAULTS data structure pointed to by pDefault specifies the accesses that an application wishes to perform using the handle returned by OpenPrinter
.. If an application wishes to open a printer to perform administrative tasks, such as the SetPrinter function, it should open the printer with PRINTER_ALL_ACCESS access. If an application wishes only to perform basic printing operations, an access value that includes PRINTER_ACCESS_USE is sufficient.
Windows 95: OpenPrinter ignores the DesiredAccess member of PRINTER_DEFAULTS.
An application can determine what permissions a client has on a print server, or obtain a handle to a print server to call WaitForPrinterChange. To do so, it should call OpenPrinter with pPrinterName set to the name of the server and should specify a server access mask value such as SERVER_ALL_ACCESS. The pDatatype and pDevMode members of the PRINTER_DEFAULTS data structure should be set to NULL. The handle returned by such a call may be passed to the ClosePrinter or WaitForPrinterChange function.
If a user does not hold permission to open a specified printer or print server with the desired access, the OpenPrinter call will fail, and GetLastError will return the value ERROR_ACCESS_DENIED.
See Also
ClosePrinter, SetPrinter, StartDocPrinter, WaitForPrinterChange, PRINTER_DEFAULTS
--------
DocumentProperties
The DocumentProperties function retrieves or modifies printer initialization information or displays a printer-configuration dialog box for the specified printer.
LONG DocumentProperties(
HWND hWnd, // handle to window that displays dialog box
HANDLE hPrinter, // handle to printer object
LPTSTR pDeviceName, // pointer to device name
PDEVMODE pDevModeOutput, // pointer to modified device mode structure
PDEVMODE pDevModeInput, // pointer to original device mode structure
DWORD fMode // mode flag
);
Parameters
hWnd
Identifies the parent window of the printer-configuration dialog box.
hPrinter
Identifies a printer object.
pDeviceName
Points to a null-terminated string that specifies the name of the device for which the printer-configuration dialog box should be displayed.
pDevModeOutput
Points to a DEVMODE structure that receives the printer configuration data specified by the user.
pDevModeInput
Pointer to a DEVMODE structure that the operating system uses to initialize the dialog box controls.
This parameter is only used if the DM_IN_BUFFER flag is set in the fMode parameter. If DM_IN_BUFFER is not set, the operating system uses the printer's default DEVMODE.
fMode
Specifies a mask of values that determines the operations the function performs. If this parameter is zero, the DocumentProperties function returns the number of bytes required by the printer driver's DEVMODE data structure. Otherwise, use one or more of the following constants to construct a value for this parameter; note, however, that in order to change the print settings, an application must specify at least one input value and one output value:
Value Meaning
DM_IN_BUFFER Input value. Before prompting, copying, or updating, the function merges the printer driver's current print settings with the settings in the DEVMODE structure specified by the pDevModeInput parameter. The function updates the structure only for those members specified by the DEVMODE structure's dmFields member. This value is also defined as DM_MODIFY. In cases of conflict during the merge, the settings in the DEVMODE structure specified by pDevModeInput override the printer driver's current print settings.
DM_IN_PROMPT Input value. The function presents the printer driver's Print Setup dialog box and then changes the settings in the printer's DEVMODE data structure to those values specified by the user. This value is also defined as DM_PROMPT.
DM_OUT_BUFFER Output value. The function writes the printer driver's current print settings, including private data, to the DEVMODE data structure specified by the pDevModeOutput parameter. The caller must allocate a buffer sufficiently large to contain the information. If the bit DM_OUT_BUFFER sets is clear, the pDevModeOutput parameter can be NULL. This value is also defined as DM_COPY.
Return Values
If the fMode parameter is zero, the return value is the size of the buffer required to contain the printer driver initialization data. Note that this buffer can be larger than a DEVMODE structure if the printer driver appends private data to the structure.
If the function displays the initialization dialog box, the return value is either IDOK or IDCANCEL, depending on which button the user selects.
If the function does not display the dialog box and is successful, the return value is IDOK.
If the function fails, the return value is less than zero.
Remarks
The printer object handle identified by the hPrinter parameter can be obtained by calling the OpenPrinter function.
The string pointed to by the pDeviceName parameter can be obtained by calling the GetPrinter function.
Note that the DEVMODE structure actually used by a printer driver contains the device-independent part (as defined above) followed by a driver-specific part that varies in size and content with each driver and driver version. Because of this driver dependence, it is very important for applications to query the driver for the correct size of the DEVMODE structure before allocating a buffer for it.
To make changes to print settings that are local to an application, an application should follow these steps:
1. Get the number of bytes required for the full DEVMODE structure by calling DocumentProperties and specifying zero in the fMode parameter.
2. Allocate memory for the full DEVMODE structure.
3. Get the current printer settings by calling DocumentProperties. Pass a pointer to the DEVMODE structure allocated in Step 2 as the pDevModeOutput parameter and specify the DM_OUT_BUFFER value.
4. Modify the appropriate members of the returned DEVMODE structure and indicate which members were changed by setting the corresponding bits in the dmFields member of the DEVMODE.
5. Call DocumentProperties and pass the modified DEVMODE structure back as both the pDevModeInput and pDevModeOutput parameters and specify both the DM_IN_BUFFER and DM_OUT_BUFFER values (which are combined using the OR operator).
The DEVMODE structure returned by the third call to DocumentProperties can be used as an argument in a call to the CreateDC function.
To create a handle to a printer-device context using the current printer settings, you only need to call DocumentProperties twice, as described above. The first call gets the size of the full DEVMODE and the second call initializes the DEVMODE with the current printer settings. Pass the initialized DEVMODE to CreateDC to obtain the handle to the printer device context.
See Also
AdvancedDocumentProperties
OK I figured out where you are coming from. The problem I was having was that it was set up as a win3.x (16 bit) application instead of a win32 app. Those functions are now valid functions. But now I have a new problem....I should probably post it as a new question but I will start just by boosting thepoints to compensate. Now that it is a win32 app my comm port communications are no longer compilable. I was using functions of importb, CloseComm, WriteComm, OpenComm and SetEventCommMask. What should I be using instead??
Thanks again.
1. I am very glad to solve you 1-st
problem.
2. About SerialCommunication:
Yes, you are right, you must rewrite
code! SerialPort Examples see: http://codeguru.developer.
http://codeguru.developer.
http://msdn.microsoft.com/
http://home.das-netz.de/pa
//articles
'http://www.microsoft.com/
'http://msdn.microsoft.com
Small example:
//example of using SerialPort
#include <windows.h>
#include <stdio.h>
int main(int argc,char *argv[])
{
HANDLE *cfd;
int errno;
int i;
int nBytesRead;
int nBytesToRead;
char inBuffer[1024];
int nBytesWritten;
int nBytesToWrite;
char outBuffer[1024];
COMMTIMEOUTS ct;
DCB dcb;
if ( (cfd=CreateFile("COM1:",GE
errno = GetLastError();
printf("CreatFile failed. Errno=%d\n",errno);
return -1;
}
printf("CreatFile OK\n");
if ( !SetupComm(cfd,1024,1024)!
errno = GetLastError();
printf("SetupComm failed. Errno=%d\n",errno);
return -1;
}
printf("SetupComm OK\n");
if ( !GetCommState(cfd,&dcb) ) {
errno = GetLastError();
printf("GetCommState failed. Errno=%d\n",errno);
return -1;
}
printf("GetCommState OK\n");
printf("DCBlength=0x%04x\n
printf("BaudRate=%d\n",dcb
printf("fBinary=0x%04x\n",
printf("fParity=0x%04x\n",
printf("fOutxCtsFlow=0x%04
printf("fOutxDsrFlow=0x%04
printf("fDtrControl=0x%04x
printf("fDsrSensitivity=0x
printf("fTXContinueOnXoff=
printf("fOutX=0x%04x\n",dc
printf("fInX=0x%04x\n",dcb
printf("fErrorChar=0x%04x\
printf("fNull=0x%04x\n",dc
printf("fRtsControl=0x%04x
printf("fAbortOnError=0x%0
printf("XonLim=0x%02x\n",d
printf("XoffLim=0x%02x\n",
printf("ByteSize=0x%02x\n"
printf("Parity=0x%02x\n",d
printf("StopBits=0x%02x\n"
printf("XonChar=0x%02x\n",
printf("XoffChar=0x%02x\n"
printf("ErrorChar=0x%02x\n
printf("EofChar=0x%02x\n",
printf("EvtChar=0x%02x\n",
dcb.BaudRate = 9600;
if ( !SetCommState(cfd,&dcb) ) {
errno = GetLastError();
printf("SetCommState failed. Errno=%d\n",errno);
return -1;
}
printf("SetCommState OK\n");
if ( !GetCommTimeouts(cfd,&ct) ) {
errno = GetLastError();
printf("GetCommTimeouts failed. Errno=%d\n",errno);
return -1;
}
printf("Got CT\n");
printf("ReadIntervalTimeou
printf("ReadTotalTimeoutMu
printf("ReadTotalTimeoutCo
printf("WriteTotalTimeoutM
printf("WriteTotalTimeoutC
ct.ReadIntervalTimeout = 10;
ct.ReadTotalTimeoutMultipl
ct.ReadTotalTimeoutConstan
ct.WriteTotalTimeoutMultip
ct.WriteTotalTimeoutConsta
if ( !SetCommTimeouts(cfd,&ct) ) {
errno = GetLastError();
printf("SetCommTimeouts failed. Errno=%d\n",errno);
return -1;
}
printf("Set CT\n");
// Attempt a synchronous write operation.
nBytesToWrite = 4;
strcpy(outBuffer,"AT?\r");
if ( !WriteFile(cfd,outBuffer,n
printf("No one's home\n");
return -1;
}
printf("BytesWritten: %d\n",nBytesWritten);
// Attempt a synchronous read operation.
nBytesToRead = 20;
if ( !ReadFile(cfd,inBuffer,nBy
printf("EOF\n");
return -1;
}
printf("BytesRead: %d\n",nBytesRead);
for ( i=0 ; i<nBytesRead ; i++ )
printf("%02x [%c]\n",inBuffer[i],inBuff
if ( CloseHandle(cfd) )
printf("Close OK\n");
else
printf("Close failed\n");
return 0;
}
//load CPL apps
GetStartupInfo(&startUpInf
startUpInfo.dwFlags &= STARTF_USESHOWWINDOW;
startUpInfo.wShowWindow &= SW_HIDE;
success =
CreateProcess(
0, // pointer to name of executable module
"Rundll32.exe Shell32.dll,Control_RunDLL
// pointer to command line string
0, // pointer to process security attributes
0, // pointer to thread security attributes
FALSE, // handle inheritance flag
CREATE_NEW_CONSOLE, // creation flags
0, // pointer to new environment block
0, // pointer to current directory name
&startUpInfo, // pointer to STARTUPINFO
&procInfo // pointer to PROCESS_INFORMATION
);
}
3. About inport/outport:
It is not easy, you can or use
assermbler, or some DLL(I use winio.dll from sysinternals).
If you want, i can sent you all stuff
with DLL: write you EMail
Alex
>>I should probably post it as a new question
Roule of EE: Only 1 question in you Q!
And about inp/outp:
Yesteday I got 500*4 PTS (in C++ area)
for reply to inp/outp Q...
A)Landscape printing : it 's a FAQ . following are 4 ways of how to do the job.
B) example of converting WIN16 to WIN32 serial acces
HTP
Jean-Paul
A)))))
//////// FIRST one //////////////////////////
==> in .H file...
// Class that will change a printer's orientation
// Either set to DMORIENT_LANDSCAPE or DMORIENT_PORTRAIT
//------------------------
class TemporaryPrinterOrientatio
{
public:
TemporaryPrinterOrientatio
virtual ~TemporaryPrinterOrientati
private:
// NOTE: See comment in CPP file...
// DEVMODE devMode;
int oldOrientation;
TPrinter* printer;
};
==> in .CPP file...
//------------------------
TemporaryPrinterOrientatio
: printer( printer )
//------------------------
{
switch( tempOrientation )
{
case DMORIENT_LANDSCAPE:
case DMORIENT_PORTRAIT:
{
DEVMODE const* pDevMode = printer->GetSetup( ).GetDevMode( );
// devMode = *pDevMode;
// oldOrientation = devMode.dmOrientation;
// devMode.dmOrientation = tempOrientation;
// printer->GetSetup( ).SetDevMode( &devMode );
// NOTE: When SetDevMode is executed a global block of memory that
// holds the DEVMODE structure is freed and then re-allocated. This
// appears to cause problems with the PostScript printer driver due
// perhaps to it keeping a copy of the original handle (???).
// In order to work-around this problem with the PostScript driver
// we instead attack the actual global memory itself by casting
// the constant pointer to make it accessible.
if( pDevMode )
{
oldOrientation = ( ( DEVMODE* )pDevMode )->dmOrientation;
( ( DEVMODE* )pDevMode )->dmOrientation = tempOrientation;
}
break;
}
default:
throw xmsg( "Unknown page orientation" );
}
}
//------------------------
TemporaryPrinterOrientatio
{
DEVMODE const* pDevMode = printer->GetSetup( ).GetDevMode( );
// devMode = *pDevMode;
// devMode.dmOrientation = oldOrientation;
// printer->GetSetup( ).SetDevMode( &devMode );
// NOTE: See above for explanation...
if( pDevMode ) ( ( DEVMODE* )pDevMode )->dmOrientation = oldOrientation;
}
//////////////////////////
///////////SECOND/////////
#include <owl/printer.h>
class TLandPrinter: public TPrinter
{
public:
TLandPrinter () : TPrinter () {}
bool Print (TWindow *parent, TPrintout &printout, bool prompt);
{
DEVMODE *devMode = (DEVMODE *)Data->GetDevMode ();
devMode->dmOrientation = DMORIENT_LANDSCAPE;
return TPrinter::Print (parent, printout, prompt);
}
};
//////////////////////////
///////////THIRD//////////
void TSCPrinter::SetOrientation
{
DEVMODE* dm = (DEVMODE*) GetSetup().GetDevMode();
if( dm != 0 )
{
dm->dmOrientation = (x ? DMORIENT_PORTRAIT : DMORIENT_LANDSCAPE);
dm->dmFields |= DM_ORIENTATION;
}
}
//////////////////////////
////////////FOURTH////////
// hp <=== TPrinter object
DEVMODE *devMode = (DEVMODE *)hp->GetSetup().GetDevMod
devMode->dmOrientation = Orientation;
DC = new TPrintDC(hp->GetSetup().Ge
hp->GetSetup().GetDeviceNa
hp->GetSetup().GetOutputNa
//////////////////////////
B))
Example Converting WIN16 to WIN32 port access
"Technical Articles>>Windows Articles>>Kernel/Base Articles>>Serial Communications in WIN 32"
1. HANDLE h = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0,
NULL, OPEN_EXISTING, 0, NULL);
COMMTIMEOUTS cto = { MAXDWORD, 0, 0, 4, 4 };
SetCommTimeouts(CommHandle
DCB dcb = { 0 };
dcb.DCBlength = sizeof(dcb);
BuildCommDCB("COM1 96,n,8,1", &dcb);
SetCommState(h, &dcb);
2. ReadFile(h, buf, ct1, &ct2, NULL); // buf = buffer ct1 size of buf
WriteFile(h, buf, ct1, &ct2, NULL); // ct2 = bytes read/written
CloseHandle(h);
3. to increase speed :
DWORD CALLBACK Notify(void *); // declaration
DWORD id;
CloseHandle(CreateThread(N
DWORD CALLBACK Notify(void *param)
{
HANDLE *chp = (HANDLE *) param;
while (*chp != INVALID_HANDLE_VALUE)
{
SetCommMask(*chp, EV_RXCHAR);
DWORD mask;
// wait for input char
if (WaitCommEvent(*chp, &mask, NULL))
MainWindow->PostMessage(WM
}
return(0);
}
Business Accounts
Answer for Membership
by: AlexVirochovskyPosted on 2000-06-16 at 13:33:09ID: 2968196
Next if full code (from MSDN) about changing orientation Printer by Name:
on = DMORIENT_LANDSCAPE;
, WM_DEVMODECHANGE, 0L,
int ChangeOrientation(char *pDevice)
{
HGLOBAL hGlobal = NULL;
HGLOBAL hGlobal2 = NULL;
HANDLE hPrinter = NULL;
HWND hwnd = NULL;
DWORD dwNeeded = 0;
PRINTER_INFO_2 *pi2 = NULL;
PRINTER_DEFAULTS pd;
BOOL bFlag;
LONG lFlag;
/* Open printer handle (in Windows NT, you need full-access because you
will eventually use SetPrinter) */
ZeroMemory(&pd, sizeof(pd));
pd.DesiredAccess = PRINTER_ALL_ACCESS;
bFlag = OpenPrinter(pDevice, &hPrinter, &pd);
if (!bFlag || (hPrinter== NULL))
goto ABORT;
/* The first GetPrinter() tells you how big the buffer should be in
order to hold all of PRINTER_INFO_2. Note that this usually returns
as FALSE, which only means that the buffer (the third parameter) was
not filled in. You don't want it filled in here. */
GetPrinter(hPrinter, 2, 0, 0, &dwNeeded);
if (dwNeeded == 0)
goto ABORT;
/* Allocate enough space for PRINTER_INFO_2. */
hGlobal = GlobalAlloc(GHND, dwNeeded);
if (hGlobal == NULL)
goto ABORT;
pi2 = (PRINTER_INFO_2 *)GlobalLock(hGlobal);
if (pi2 == NULL)
goto ABORT;
/* The second GetPrinter() fills in all the current settings, so all you
need to do is modify what you're interested in. */
bFlag = GetPrinter(hPrinter, 2, (LPBYTE)pi2, dwNeeded, &dwNeeded);
if (!bFlag)
goto ABORT;
/* If GetPrinter didn't fill in the DEVMODE, get it by calling
DocumentProperties. */
if (!pi2->pDevMode)
{
dwNeeded = DocumentProperties(hwnd, hPrinter,
pDevice,
NULL, NULL, 0);
if (dwNeeded <= 0)
goto ABORT;
hGlobal2 = GlobalAlloc(GHND, dwNeeded);
if (!hGlobal2)
goto ABORT;
pi2->pDevMode = (DEVMODE *)GlobalLock(hGlobal2);
if (!pi2->pDevMode)
goto ABORT;
lFlag = DocumentProperties(hwnd, hPrinter,
pDevice,
pi2->pDevMode, NULL,
DM_OUT_BUFFER);
if (lFlag != IDOK)
goto ABORT;
}
/* Specify what we are attempting to change... */
pi2->pDevMode->dmFields = DM_COPIES;
pi2->pDevMode->dmCopies = 3;
pi2->pDevMode->dmFields = DM_ORIENTATION;
pi2->pDevMode->dmOrientati
/* Make sure the driver-dependent part of devmode is updated as
necessary. */
lFlag = DocumentProperties(hwnd, hPrinter,
pDevice,
pi2->pDevMode, pi2->pDevMode,
DM_IN_BUFFER | DM_OUT_BUFFER);
if (lFlag != IDOK)
goto ABORT;
/* Update printer information. */
bFlag= SetPrinter(hPrinter, 2, (LPBYTE)pi2, 0);
if (!bFlag)
/* The driver doesn't support, or it is unable to make the change. */
goto ABORT;
SendMessage(HWND_BROADCAST
(LPARAM)(LPCSTR) pDevice);
m_lngNCopies = 3;
ABORT:
return S_OK;
}
I use ~ same code in BC 5.01 and it works file.
I hope, it helps. Alex