//========================================================================== // // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. // // Copyright (c) Microsoft Corporation. All rights reserved. // //-------------------------------------------------------------------------- #include "PrintSDI.h" using namespace Gdiplus; //+--------------------------------------------------------------------------- // // function: GiveUsage // // Synopsis: prints the usage of the application // // Arguments: [AppName] - Name of the application whose usage has to be printed // // Returns: void // //---------------------------------------------------------------------------- void GiveUsage(LPTSTR AppName) { _tprintf( TEXT("Usage : %s \n \ /s (optional) Fax Server Name \n \ /p (optional) Fax Printer Name \n \ /f Fax Number \n \ /n Sender Name \n \ /c Server side coverpage to be sent E.g. confident.cov \n"),AppName); _tprintf( TEXT("Usage : %s /? -- help message\n"),AppName); } int __cdecl _tmain(int argc, _TCHAR* argv[]) { HRESULT hr = S_OK; bool bRetVal = true; LPTSTR lptstrServerName = NULL; LPTSTR lptstrPrinterName=NULL; LPTSTR lptstrNumber = NULL; LPTSTR lptstrName = NULL; LPTSTR lptstrCoverPageName = NULL; // FaxPrintInfo is the fax print info FAX_PRINT_INFO FaxPrintInfo; // dwFaxId is the fax job id DWORD dwFaxId; // FaxContextInfo is the fax context FAX_CONTEXT_INFO FaxContextInfo; // CoverPageInfo is the cover page info FAX_COVERPAGE_INFO CoverPageInfo; // szFaxPrinterName is the name of the fax printer LPTSTR lptstrFaxPrinterName =NULL; // hFaxSvcHandle is the handle to the fax server HANDLE hFaxSvcHandle = NULL; // pFaxConfig is a pointer to the fax configuration PFAX_CONFIGURATION pFaxConfig = NULL; // buffer to receive array of job data PFAX_JOB_ENTRY pJobs = NULL; GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); DOCINFO docInfo; ZeroMemory(&docInfo, sizeof(docInfo)); size_t argSize = 0; int argcount = 0; #ifdef UNICODE argv = CommandLineToArgvW( GetCommandLine(), &argc ); #else argv = argvA; #endif if (argc == 1) { _tprintf( TEXT("Missing args.\n") ); GiveUsage(argv[0]); bRetVal = false; goto Exit1; } // check for commandline switches for (argcount=1; argcountDrawLine(pen, 50, 50, 350, 550); graphics->DrawRectangle(pen, 50, 50, 300, 500); graphics->DrawEllipse(pen, 50, 50, 300, 500); delete pen; delete graphics; if (!EndPage(FaxContextInfo.hDC)) { _tprintf(TEXT(" Test Error: EndPage failed with error code 0x%08x"),GetLastError()); } if (!EndDoc(FaxContextInfo.hDC)) { _tprintf(TEXT(" Test Error: EndDoc failed with error code 0x%08x"),GetLastError()); } Exit: if (!DeleteDC(FaxContextInfo.hDC)) { _tprintf(TEXT(" Test Error: DeleteDC failed with error code 0x%08x"),GetLastError()); } Exit1: GdiplusShutdown(gdiplusToken); if(lptstrServerName) free(lptstrServerName); if(lptstrCoverPageName) free(lptstrCoverPageName); if(lptstrFaxPrinterName) free(lptstrFaxPrinterName); if(lptstrName) free(lptstrName); if(lptstrNumber) free(lptstrNumber); if(lptstrPrinterName) free(lptstrPrinterName); return bRetVal; }