Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Capturing Acrobat Reader printing errors
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01040598
Message ID:
01041418
Vues:
17
This message has been marked as a message which has helped to the initial question of the thread.
Something like this:
.....
        if "adobe"$LOWER(lcWinText) and hclass="#32770"
              ?'ERROR'
				oShell = CreateObject("WScript.Shell")
				IF oShell.AppActivate("Adobe Reader")
					oShell.SendKeys("{ENTER}")
				endif

				oShell=.null.
              exit
        endif
.....
>Thanks! This allows me to identify when an error occurs. Now another questin I have is it possible to programically close this error window put up by acrobat?
>
>Thanks again
>
>>Ron,
>>
>>Probably you could capture the window inside Adobe and with error message.
>>Try something similar to this:
>>
>>#DEFINE GW_HWNDLAST   1
>>#DEFINE GW_HWNDNEXT   2
>>#DEFINE GW_CHILD 5
>>
>>DECLARE INTEGER GetDesktopWindow IN user32
>>DECLARE INTEGER GetWindow IN user32 INTEGER hwnd, INTEGER wFlag
>>DECLARE INTEGER GetWindowText IN user32 INTEGER hwnd,;
>>    STRING @lpString, INTEGER cch
>>DECLARE INTEGER GetClassName IN Win32Api INTEGER, STRING, INTEGER
>>
>>hWindow = GetDesktopWindow()
>>hWindow = GetWindow(hWindow,GW_CHILD)
>>
>>DO WHILE hWindow <> GetWindow(hWindow, GW_HWNDLAST)
>>	hWindow = GetWindow(hWindow , GW_HWNDNEXT)	
>>	lcWinText =iGetWinText(hWindow)
>>	hclass = SPACE(80)
>>	nlen = getclassname(hWindow, @hclass, 80)
>>	hclass = LEFT(ALLT(hclass),nlen)
>>
>>        if "adobe"$LOWER(lcWinText) and hclass="#32770"
>>              ?'ERROR'
>>              exit
>>        endif
>>ENDDO
>>
>>
>>RETURN
>>*---------------------------------------------------------------
>>FUNCTION  iGetWinText(hWindow)
>>    LOCAL lnBufsize, lcBuffer
>>    lnBufsize = 1024
>>    lcBuffer = Repli(Chr(0), lnBufsize)
>>    lnBufsize = GetWindowText(hWindow, @lcBuffer, lnBufsize)
>>RETURN  Iif(lnBufsize=0, "", Left(lcBuffer,lnBufsize))
>>
>>
>>
>>
>>>Situation is that a clearing house has a method to receive incoming fax documents that are saved as PDF files in a folder location. My program is monitoring this folder and when it finds a PDF file, it is moved to another folder with and renamed. The following sends the PDF to the printer.
>>>
>>>
>>>
>>>.... if this is the first document then the following
>>>Declare Integer ShellExecute ;
>>> IN SHELL32.Dll ;
>>> INTEGER nWinHandle,;
>>> STRING cOperation,;
>>> STRING cFileName,;
>>> STRING cParameters,;
>>> STRING cDirectory,;
>>> INTEGER nShowWindow
>>>
>>>ShellExecute(0, "open", "acrord32.exe", " /p /h "+lcFile, "", 0)
>>>...
>>>...subsequent documents the following code
>>>
>>>ShellExecute(0,"print", lcFile,"","",0)
>>>
>>>
>>>
>>>each file is logged as when recieved and printed etc. If any errors happen it is documented as well. However, there are the occasional PDF files that are corrupt and I am not able to capture these errors. For example, a hundred or so faxes will come in one after the other which are converted to PDF's and stored in a designated folder. My routine moves them and sends to the printer and moves on to the next one etc. After the above code is used to sent to printer and there is a corrupt file, acrobat will present an error message and the staff simply clicks OKAY and goes on to next job in the printer QuE.
>>>
>>>Problem is that I need to identify these failures for the managment so that appropriate action can take place.
>>>
>>>Is there a better way so that one would be able to capture errors from acrobat reader??
>>>
>>>Thanks for any suggestions.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform