>>declare long ShellExecute in "shell32.dll" ; >> long hwnd, string lpszOp, ; >> string lpszFile, string lpszParams, ; >> string lpszDir, long nShowCmd >>lcDocument = "c:\myPath\blah blah.doc" >>ShellExecute(0,'Print',m.lcDocument,0,0,1) >>>>No:
#include "wdconst.h" Local oWordDocument oWordDocument=Createobject("word.application") && Create word object With oWordDocument .Options.PrintBackGround = .T. .documents.Open(m.lcDocument) oWatcher = Createobject('myTimer', oWordDocument) .ActiveDocument.PrintOut(.T.) Endwith Read Events Define Class myTimer As Timer Interval = 1000 oWord = .Null. Procedure Init Lparameters toWord This.oWord = toWord Endproc Procedure Timer With This.oWord If .BackgroundPrintingStatus > 0 && Wait printing to finish Return Endif For Each oDoc In .documents oDoc.Close(wdDoNotSaveChanges) Endfor oDoc = .Null. .Quit(wdDoNotSaveChanges) Endwith This.Enabled = .F. Clear Events Endproc EnddefineCetin