Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
m.FILEHANDLE = FCREATE("c:\myfolder\myfile.txt")
IF m.FILEHANDLE < 0 && Check for error opening file
MESSAGEBOX("Unable to Access ",0,"Error")
QUIT
ENDIF
m.FILEHANDLE = FOPEN("c:\myfolder\myfile.txt",2)
IF m.FILEHANDLE < 0 && Check for error opening file
= MESSAGEBOX("Unable to Access",0,"Error")
QUIT
ENDIF
Im trying to check if an excel file is open, meaning visible in your taskbar?
FUNCTION CheckWindow
DECLARE INTEGER GetActiveWindow IN Win32API
DECLARE INTEGER GetWindow IN Win32API ;
INTEGER hWnd, INTEGER nType
DECLARE INTEGER GetWindowText IN Win32API ;
INTEGER hWnd, STRING @cText, INTEGER nType
lcTitle = "Excel"
* Change the above to any unique string that appears
* in the title bar of the window you are looking for
hNext = GetActiveWindow()
llSuccess = .F.
* iterate through the windows in the stack
DO WHILE hNext<>0
cText = REPLICATE(CHR(0),80)
GetWindowText(hNext,@cText,80)
IF UPPER(lcTitle) $ UPPER(cText)
llSuccess = .T.
EXIT
ENDIF
hNext = GetWindow(hNext,2)
ENDDO
RETURN llSuccess
IF ISITOPEN("c:\myfolder\myfile.xls")
MESSAGEBOX("hello it's open",48,"Problem")
ELSE
MESSAGEBOX("Excellent, it isn't open",48,"No Problem")
ENDIF
FUNCTION ISITOPEN
PARAMETER m.FILENAME
PRIVATE m.FILENAME,m.FILEHANDLE,m.FLG
m.FILEHANDLE = -1
m.FLG = .T.
IF MYFILE(m.FILENAME)
m.FILEHANDLE = FOPEN(m.FILENAME,2)
ELSE
m.FILEHANDLE = FCREATE(m.FILENAME)
ENDIF
IF m.FILEHANDLE < 0 && Check for error opening file
m.FLG = .F.
ELSE
FCLOSE(m.FILEHANDLE)
ENDIF
RETURN(m.FLG)
FUNCTION MYFILE
PARAMETER m.FILENAME
PRIVATE m.FILENAME,m.FLG
m.FLG = .F.
IF !EMPTY(m.FILENAME)
IF ADIR(TMPDIRFILES,m.FILENAME) > 0
m.FLG = .T.
ENDIF
ENDIF
RETURN(m.FLG)
Checking the windows will not help if the copy of excel is hidden - i.e. opened with automation and crashed..