I have added some additional code to the Get_PrintDC function of my Sipprt.c code so as to get the print out in landscape rather than the default portrait format.
The code reads as follows (the additional code is inserted after the return CreateDC line):
HDC NEAR Get_PrintDC( void )
{
static char szPrinter[80];
char *szDevice, *szDriver, *szOutput;
GetProfileString( "windows", "device", ",,,", szPrinter, 80 );
if( NULL != (szDevice = strtok (szPrinter, "," )) &&
NULL != (szDriver = strtok (NULL, ", ")) &&
NULL != (szOutput = strtok (NULL, ", " )))
return CreateDC( szDriver, szDevice, szOutput, NULL );
DEVMODE FAR *pDevMode=(DEVMODE FAR *) GlobalLock;
if (pDevMode->dmOrientation != DMORIENT_LANDSCAPE)
{pDevMode->dmOrientation = DMORIENT_LANDSCAPE;}
GlobalUnlock(pDevMode);
return 0 ;
}
This compiles, links and creates an executable withour error or warning, but does not change the printed orientation. Can anyone suggest a modified HDC NEAR Get_PrintDC( void ) - in its entirety please - that would achieve the landscape printout that I would like. Can you also explain the process as my search showed lots of people out there looking at this problem, but with no one giving definitive .c code solution.
I am using Code::Blocks 10.5, mingw32-gcc.exe c compiler, mingw32-g++.exe c++ compiler and dynamic libs linker, ar.exe static libs linker, windres.exe resource compiler and mingw32-make.exe make program. I am creating a 32 bit executable to run on Windows and doing my development on a Windows XP machine.
Best Wishes and thanks if you can help me
Finston