Using ShellExecute to print 
Author Message
 Using ShellExecute to print

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



Sun, 16 Jun 2002 03:00:00 GMT  
 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



Sun, 16 Jun 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ShellExecute & print problem

2. PrintDlg when using ShellExecute

3. debugger detects memory leak after using shellexecute

4. ShellExecute fails when using SHGetSpecialFolderLocation?

5. Using ShellExecute in VC++

6. PrintDlg when using ShellExecute

7. Using shellexecute to invoke Direct:Connect (Sterling Software)

8. Need help using ShellExecute()

9. Memory Leaks when using Shellexecute

10. Printng Power Point documents using ShellExecute

11. Opening multiple files using ShellExecute

12. Using ShellExecute

 

 
Powered by phpBB® Forum Software