Mega Code Archive

 
Categories / Delphi / Examples
 

Rtfprinting

PRINT AN RTF FILE USING A (HIDDEN) INSTANCE OF WORDPAD!!! NEAT. shellExecute(mainForm.handle, nil, 'write.exe', 'myfile.rtf /p', nil, SW_HIDE); (using the 'WRITE.EXE' RATHER THAN 'WORDPAD.EXE' is a bit more universal because WORDPAD.EXE isn't always on the path, BUT THE 'WRITE.EXE STUB' will in fact run WordPad). The "/p" parameter is the undocumented feature. It will launch WordPad, print the file, then close WordPad. And with SW_HIDE, the only thing you see is the Printing status box. WordPad probably loads as much as it can into memory before printing, but it should be able to handle any size file by segmentation. And WordPad has a pretty small footprint, so it loads and prints fairly quickly. It's also generally on every Win95 system.