Printing Problem - Console App - C++ - VS2005
-
I need a console app (it is called from various other programs) that processes some data from various files and at times needs to send data to a (let's say generic text) printer with some printer control instructions. I cam across a sample in the help files with starts: :(
// RawDataToPrinter - sends binary data directly to a printer // // szPrinterName: NULL-terminated string specifying printer name // lpData: Pointer to raw data bytes // dwCount Length of lpData in bytes // // Returns: TRUE for success, FALSE for failure. // BOOL RawDataToPrinter(LPSTR szPrinterName, LPBYTE lpData, DWORD dwCount) { HANDLE hPrinter; DOC_INFO_1 DocInfo; DWORD dwJob; DWORD dwBytesWritten; // Need a handle to the printer. if( ! OpenPrinter( szPrinterName, &hPrinter, NULL ) ) return FALSE; .....
This seemed to do what I need. I included WinNT.h and then the fun began: Compiling just presents a long list off errors in the WinNT.h file: c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(273) : error C2146: syntax error : missing ';' before identifier 'WCHAR' c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(273) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(276) : error C2143: syntax error : missing ';' before '*' and many others. Any ideas? Suggestions? -- Honestly I have not yet started to celebrate the new year! Ludwig -
I need a console app (it is called from various other programs) that processes some data from various files and at times needs to send data to a (let's say generic text) printer with some printer control instructions. I cam across a sample in the help files with starts: :(
// RawDataToPrinter - sends binary data directly to a printer // // szPrinterName: NULL-terminated string specifying printer name // lpData: Pointer to raw data bytes // dwCount Length of lpData in bytes // // Returns: TRUE for success, FALSE for failure. // BOOL RawDataToPrinter(LPSTR szPrinterName, LPBYTE lpData, DWORD dwCount) { HANDLE hPrinter; DOC_INFO_1 DocInfo; DWORD dwJob; DWORD dwBytesWritten; // Need a handle to the printer. if( ! OpenPrinter( szPrinterName, &hPrinter, NULL ) ) return FALSE; .....
This seemed to do what I need. I included WinNT.h and then the fun began: Compiling just presents a long list off errors in the WinNT.h file: c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(273) : error C2146: syntax error : missing ';' before identifier 'WCHAR' c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(273) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(276) : error C2143: syntax error : missing ';' before '*' and many others. Any ideas? Suggestions? -- Honestly I have not yet started to celebrate the new year! LudwigTry creating a console application with win32 support.
-Prakash