I thought it might be helpful to explain how I distribute the files that are required to
support my applications using a free table within the app itself.
First I add a table to the application called BINARIES.DBF it has a simple structure:
Name (character 10) not null
Binary (memo (binary)) not null
I add records to this for each file I want to include, then replace the Binary field with the file I want
Then when I need the file deployed I just do this (m.WHERAMI is a variable that has the location of the .exe):
To use this to distribute and install the reg changes for W11 and general fields I put a button on my utilities menu
with this code in the click method:
Myfile() is a variation on FILE() that eliminates the false positives caused by the Path
Browser is just a wrapper for ShellExecute
Regards
Griff
Keep [Smile]ing
support my applications using a free table within the app itself.
First I add a table to the application called BINARIES.DBF it has a simple structure:
Name (character 10) not null
Binary (memo (binary)) not null
I add records to this for each file I want to include, then replace the Binary field with the file I want
Code:
select 0
use ("D:\projects\myproject\binaries")
append blank
replace binaries.Name with "WORDFILE1", binaries.binary with filetostr("the file I want.docx")
use
Then when I need the file deployed I just do this (m.WHERAMI is a variable that has the location of the .exe):
Code:
select 0
use ("D:\projects\myproject\binaries")
locate for name="WORDFILE1"
strtofile(binaries.binary,m.WHEREAMI+"WordFile.docx")
use
To use this to distribute and install the reg changes for W11 and general fields I put a button on my utilities menu
with this code in the click method:
Code:
IF !MYFILE(m.WHEREAMI+"BitmapImage.reg")
SELECT 0
USE (D:\projects\myproject\BINARIES")
LOCATE FOR NAME = "BITMAP"
IF FOUND()
STRTOFILE(sound.sound,m.WHEREAMI+"BitmapImage.reg")
BROWSER(m.WHEREAMI+"BitmapImage.reg")
ENDIF
USE
ENDIF
IF !MYFILE(m.WHEREAMI+"Paint.Picture.reg")
SELECT 0
USE (D:\projects\myproject\BINARIES")
LOCATE FOR NAME = "PAINT"
IF FOUND()
STRTOFILE(sound.sound,m.WHEREAMI+"Paint.Picture.reg")
BROWSER(m.WHEREAMI+"Paint.Picture.reg")
ENDIF
USE
ENDIF
Myfile() is a variation on FILE() that eliminates the false positives caused by the Path
Browser is just a wrapper for ShellExecute
Code:
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)
FUNCTION BROWSER
PARAMETER m.FILENAME,m.LINEPARAMS,m.TESTFILE
LOCAL LNRETVAL, LCOPERATION
PRIVATE m.FILENAME,m.LINEPARAMS,m.TESTFILE
LCOPERATION = "Open"
**
DECLARE INTEGER ShellExecute IN SHELL32.DLL ;
INTEGER handle,;
STRING @sFile,;
STRING @lp,;
STRING @DIR,;
STRING @dir1,;
INTEGER ncmd
**
IF PCOUNT() < 3
m.TESTFILE = .T.
ENDIF
IF PCOUNT() < 2
m.LINEPARAMS = ""
ENDIF
IF m.TESTFILE
IF MYFILE(m.FILENAME)
LNRETVAL = SHELLEXECUTE(0, LCOPERATION, m.FILENAME, m.LINEPARAMS, "", 1)
ELSE
MESSAGEBOX("Unable to locate the file/folder/web page:"+m.FILENAME,48,"Problem")
ENDIF
ELSE
LNRETVAL = SHELLEXECUTE(0, LCOPERATION, m.FILENAME, m.LINEPARAMS, "", 1)
ENDIF
CLEAR DLLS SHELLEXECUTE
RETURN(.F.)
Regards
Griff
Keep [Smile]ing
There are 10 kinds of people in the world, those who understand binary and those who don't.
I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.