Dave

Many thanks for that - the only problem I have is that it will not print 
a file with a .ERR extension (it comes up with the "Invalid action ..." 
message) even though double-clicking on the file in Explorer opens the 
file with NotePad.  IOW there is an application associated with the ERR 
file but for some reason this method will not allow it to print.

Paul


Dave Crozier wrote:
> * API Call to print out or OPEN a document
>
> Declare Integer ShellExecute In Shell32.Dll ;
>       INTEGER nWinHandle,;
>       STRING cOperation,;
>       STRING cFileName,;
>       STRING cParameters,;
>       STRING cDirectory,;
>       INTEGER nShowWindow
>
> ShellExec("test.pdf","","c:\temp\")
>
> *********
> Procedure ShellExec (exeName, exeParms, exePath)
> Local nStat, errorDesc
>
>       * Use the next line to View
>       * nStat = ShellExecute(0,"open",exeName,exeParms,exePath,1)
>
>       * Use the next line to Print
>       nStat = ShellExecute(0,"print",exeName,exeParms,exePath,1)
>
>       * If nStat > 32, then it is the Instance Handle
>       * To get a Windows Handle see support.microsoft.com/kb/q242308/
>       If nStat <= 32
>               errorDesc = Icase(nStat=2,"Invalid path or filename", ;
>                       nStat=8,"Insufficient memory", ;
>                       nStat=11,"invalid EXE file", ;
>                       nStat=31,"Invalid action, or no application
> associated with the specified file", ;
>                       "Error description not available")
>               Messagebox("Error "+Ltrim(Str(nStat))+" ...
> "+errorDesc,16,"Program did not start.",2000)
>       Endif
>
> Return
>
> Dave Crozier
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Paul Newton
> Sent: 03 January 2008 15:00
> To: [email protected]
> Subject: Send text file to default printer
>
> Hi all
>
> Happy New Year
>
> I'm looking for a very quick, dirty (and silent) way to send a text file 
> (from VFP) to the default windows printer - any suggestions please ?
>
> Thanks
>
> Paul Newton
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to