
Using ShellExecute to print
Quote:
> I have the following syntax. When I execute it I get a 1f back (which is a
> general error). The file exists and all I want is for my dialog to have a
> print button to send it to the default printer.
> HINSTANCE hi = ShellExecute(NULL, "print", (char *)ERRFile, NULL, NULL, 0);
> ERRFile is populated with "0540100X.129_ERR". The file exists in the same
> folder in which the program is running.
> I assume I am missing something so obvious that when I hear the answer it
> will be sickening.
> I didn't see any simple MFC function to just print a file so this seems the
> way to go.
> --
> Ed Fultz
> Sr. Software Engineer
> Pamet Systems
> Acton, Ma
The problem seems to be that there is no application associated with the
extension ".129_ERR" and therefore ShellExecute() has no idea which
application to launch in order to print your document!
Rename the document with an extension like ".txt" or something....
Hope that is the real reason and it is not too sickening! :-)
--
David Ching, Windows Consultant
DC Software Design, Inc.
http://www.dcsoft.com