#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) > >>