L
Loway
Unregistered / Unconfirmed
GUEST, unregistred user!
以下自定义纸张的代码在Win98、ME中正常,在2000中没有任何反应,何故?如何解决?
请指教
void __fastcall SetPaper( int PW, int PL, bool PO )
{
char Device[256];
char Driver[256];
char Port[32];
THandle hDMode;
PDevMode pDMode;
Printer()->GetPrinter( Device, Driver, Port, hDMode );
if( hDMode != 0)
{
pDMode = ( PDevMode )GlobalLock( (void*)hDMode );
if( pDMode != NULL )
{
pDMode->dmPaperSize = 0;
pDMode->dmPaperLength = PL;
pDMode->dmPaperWidth = PW;
pDMode->dmOrientation = PO ? DMORIENT_PORTRAIT : DMORIENT_LANDSCAPE;
pDMode->dmFields = pDMode->dmFields | DM_PAPERSIZE;
pDMode->dmFields = pDMode->dmFields | DM_PAPERLENGTH;
pDMode->dmFields = pDMode->dmFields | DM_PAPERWIDTH;
pDMode->dmFields = pDMode->dmFields | DM_ORIENTATION;
}
GlobalUnlock( (void*)hDMode );
}
}
请指教
void __fastcall SetPaper( int PW, int PL, bool PO )
{
char Device[256];
char Driver[256];
char Port[32];
THandle hDMode;
PDevMode pDMode;
Printer()->GetPrinter( Device, Driver, Port, hDMode );
if( hDMode != 0)
{
pDMode = ( PDevMode )GlobalLock( (void*)hDMode );
if( pDMode != NULL )
{
pDMode->dmPaperSize = 0;
pDMode->dmPaperLength = PL;
pDMode->dmPaperWidth = PW;
pDMode->dmOrientation = PO ? DMORIENT_PORTRAIT : DMORIENT_LANDSCAPE;
pDMode->dmFields = pDMode->dmFields | DM_PAPERSIZE;
pDMode->dmFields = pDMode->dmFields | DM_PAPERLENGTH;
pDMode->dmFields = pDMode->dmFields | DM_PAPERWIDTH;
pDMode->dmFields = pDMode->dmFields | DM_ORIENTATION;
}
GlobalUnlock( (void*)hDMode );
}
}