Visual FoxPro General
Hi CYH,
There is a very good tool for viewing these kinds of files:
http://www.gdpicture.com/products/gdviewer-ocx-image-viewer-activex.php
I use it myself and i think it is the BEST... Also they have perfect support.
Hope this helps..
Greetings, Leo
Hi Leo,
Your information is super.
I am sorry for not making my question clear, in my foxpro program, I can use the following codes to open an excel file :
oExcel = CreateObject("Excel.Application")
oExcel.Visible = -1
oexcel.workbooks.open("d:\mainmenu\list.xls")
return
Now, I want to use a similar way to open a .TIFF file in my foxpro program, I don't know how to make it, can you please help
Hi CYH,
This is a VERY good piece off code I use....
If anyone have suggestions to make it better, please let me know.
Always looking for better solutions
******************************************************************************
**** Function name: Win_Open_File
**** Created By : L.Lems (2basix) http://www.2basix.nl
****
**** Purpose : Opens the file in the native windows program
**** Parameters :
**** Return value :
**** Remarks : cCommand : print, open
****
****
******************************************************************************
FUNCTION Win_Open_file(cFileName,cParameter,bNOCheckFileExist,cCommand)
LOCAL cBestand,cFileM,nPCnt,cPara,bCheck,cCmd
IF VARTYPE(pbDeclareShellExe)="U"
PUBLIC pbDeclareShellExe
pbDeclareShellExe = .F.
ENDIF
nPCnt=PCOUNT()
cPara=""
cCmd="open" && Default command
IF PCOUNT()>=4
IF VARTYPE(cCommand)="C" AND !EMPTY(cCommand)
cCmd=ALLTRIM(cCommand)
ENDIF
ENDIF
IF !pbDeclareShellExe
DECLARE INTEGER ShellExecute IN SHELL32.DLL ;
INTEGER nWinHandle, ;
STRING cOperation, ;
STRING cFileName, ;
STRING cParameters, ;
STRING cDirectory, ;
INTEGER nShowWindow
pbDeclareShellExe=.T.
ENDIF
IF nPcnt < 1
RETURN -1
ENDIF
IF VARTYPE(cFilename)!="C"
RETURN -2
ENDIF
IF VARTYPE(cParameter)=="C"
cPara=cParameter
ENDIF
IF bNOCheckFileExist
bCheck=.T. && No file checking so true
ELSE
bCheck=FILE(cFilename) && do the file exist check
ENDIF
*!* Callto: is a skype thing, YES you can als start a skype call from FOXPRO
IF !(LOWER(LEFT(cFileName,5))="http:" OR ;
LOWER(LEFT(cFileName,6))="https:" OR ;
LOWER(LEFT(cFileName,4))="ftp:" OR ;
LOWER(LEFT(cFileName,7))="mailto:" OR ;
LOWER(LEFT(cFileName,7))="callto:") AND !bCheck
=MESSAGEBOX("File NOT Found !"+CHR(13)+CHR(13)+cFileName,48,"Win_Open_File",5000)
RETURN -3
ENDIF
*!* WAIT WINDOW "Start"+CHR(13)+cFilename NOWAIT NOCLEAR
nRet=ShellExecute(0,cCmd,cFileName,cPara,"",1)
*!*******************************************
*!* http://www.pinvoke.net/default.aspx/shell32/ShellExecute.html
*!********************************************
DO CASE
CASE nRet=2
WAIT WINDOW cFilename NOWAIT NOCLEAR
=MESSAGEBOX("File NOT found !",16,"Win_Open_File",5000)
CASE nRet=29
WAIT WINDOW cFilename NOWAIT NOCLEAR
=MESSAGEBOX("Failure to load application!",16,"Win_Open_File",5000)
CASE nRet=30
WAIT WINDOW cFilename NOWAIT NOCLEAR
=MESSAGEBOX("Application is busy!",16,"Win_Open_File",5000)
CASE nRet=31
WAIT WINDOW cFilename NOWAIT NOCLEAR
=MESSAGEBOX("Unknown file type! OR"+CHR(13)+"Not Printable.. OR"+CHR(13)+;
"Command unknown:"+cCmd,16,"Win_Open_File",5000)
ENDCASE
WAIT CLEAR
RETURN 0