Initialize,Your,Win32,Printer, computer Initialize Your Win32 Printer
----------------------------------------------------------Permission is granted for the below article to forward,reprint, distribute, use for ezine, newsletter, website,offer as free bonus or part of a product for sale as longas no changes a Gone are those times when the companies and the organisations didn't need a hi-tech system to handle them. Owing to the considerable increase in the business sector and thus, an enormous increase in the complexity of the organisational struc
Normal 0 It is frequently found that using a Printerin Win32 programming is the toughest suggestion. Living in a time of commandline programming and DOS, for controlling the outputs, we simply get redirectedtowards the line Printer or exercise with the codes of the Printer. Thereforethe operating systems of Windows, such as Windows XP, Windows 7 etc, enfold thevarious interfaces and make use of the device abstraction for controlling aPrinter and its peripherals. Considering this, the advantages will be, we can solve allthe printer problems on any printer, utilizing the same kind of codes, andWindows will watch out and translate every command the user uses according toyour wireless Printer. But the disadvantage is that it does offer any addedlayer of intricacy. This can be tough to visualize for the programmers who arejust beginners and also to the experienced coders as well. Therefore before starting the whole process you shouldremember the following things: The controlling procedure of the wireless Printer is carried out in the simplest way. To solve the Printer related problems one can use most of the HDC related output mechanisms. In addition to it, we can choose the wireless Printer thatis a default one. Choosing the Printer requires a single command that worksagainst the requirement of displaying the printer dialog box to the user. Printing in the operating systems of Windows We can make a print in the operating systems of Windows suchas Windows XP. That is before we start to continue with certain other processeswe are required to get hold of a device context (HDC). Its correct sequence isillustrated below: Choose a wireless printer.Obtain a suitable device context.Start the document.Make a beginning of the page.Finish the last part of the page.Draw the conclusion line of the document.Erase the context of the device. Choosing the Printer that is Default Selection of a Printer that is a default one can be selectedby its name. The selection process includes two-step procedures. These are: Obtaining the name Choosing the printer Both the processes are acquired by obtaining a devicecontext to it: char szPrinterName[255];unsigned long lPrinterNameLentgth;GetDefaultPrinter( szPrinterName, &lPrinterNameLength );HDC hPrinterDC;hPrinterDC = CreateDC("WINSPOOL\0", szPrinterName, NULL, NULL); In the command that is discussed on the top will ensure thereader to note that WINSPOOL queue has been used for obtaining the actualhandle to the default printer. One final task is remaining to continue as a part of theprocess of initialization. To continue this, we are required to utilize thestructure of DOCINFO: DOCINFO di;memset( &di, 0, sizeof(DOCINFO) );di.cbSize = sizeof(DOCINFO);di.lpszDocName = "PrintIt";di.lpszOutput = (LPTSTR) NULL;di.lpszDatatype = (LPTSTR) NULL;di.fwType = 0; The DocName can be anything that the application programmerfinds appropriate. It will appear on the printer as part of the job name.Having set some reasonable defaults, we can now call StartDoc, and check forerrors: int nError = StartDoc(hPrinterDC, &di);if (nError == SP_ERROR){ printf("\nError - please check printer."); // Handle the error intelligently} Now your computer is ready to initialize your Printingprocess along with your WindowsXP and other operating systems.
Initialize,Your,Win32,Printer,