Eagle
02-09-2006, 03:19 AM
Here's an example functionality that assists with ensuring resources
essential to correct running of your App are present and 'correct'
--[[Example function to check App runtime resource files whenever called-exit if 'anomolies'.
modify to suit as allways. May Not be practicle if App Runs from Optical Media and-or
many-large rescource files, however for smaller Apps any 'OnShow' delays are minimal,
depending on what you wish to target. ]]
function APP_TERM()
Window.Hide(Application.GetWndHandle());
Folder.SetCurrent(_TempFolder);
--perform any cleanup or other actions here
if bShowAPPEndmess then
--example display strings(could be allocated on Startup Actions)
local strNoAppStart = " - This Application Will Not Continue -";
local strNoAppBod = "Application must be properly Installed\r\n This Application will now Close";
Dialog.TimedMessage(strNoAppStart, strNoAppBod, 8000, MB_ICONINFORMATION);
end
Window.Close(Application.GetWndHandle(), CLOSEWND_TERMINATE);
end
--SREsources
function EnumResources()
local bRescVerif = true;
--[[set your table-s structure to suit- one example method only here,based on crc values,
pre-determined for a runtime rescourse location, (must be in order to work)]]
local tResIm = {12345678, yada yada, etc, etc, etc}; --for simplicity: numeric order of id values
local tRBins = File.Find(AppRescoureFolderpath, "\\*.*", false, false, nil, nil); --recurse off for example.
if (tRBins) then
if (Table.Count(tRBins) >= 5) then
Table.Sort(tRBins, nil);
for n, bin in tRBins do
if false then break end
if (File.GetCRC(bin) ~= tResIm[n]) then
bRescVerif = false;
end
end
else
bRescVerif = false;
end
end
if (not bRescVerif) or (tRBins == nil) then
bShowAPPEndmess = true; -- show a timed message or not.
APP_TERM();
end
end
--EREsources
--the call (best placed on the 'OnPreLoad' event for each page of App) and OnStartup actions
EnumResources(); --could add target paramaters to expand functionality etc.
hth
essential to correct running of your App are present and 'correct'
--[[Example function to check App runtime resource files whenever called-exit if 'anomolies'.
modify to suit as allways. May Not be practicle if App Runs from Optical Media and-or
many-large rescource files, however for smaller Apps any 'OnShow' delays are minimal,
depending on what you wish to target. ]]
function APP_TERM()
Window.Hide(Application.GetWndHandle());
Folder.SetCurrent(_TempFolder);
--perform any cleanup or other actions here
if bShowAPPEndmess then
--example display strings(could be allocated on Startup Actions)
local strNoAppStart = " - This Application Will Not Continue -";
local strNoAppBod = "Application must be properly Installed\r\n This Application will now Close";
Dialog.TimedMessage(strNoAppStart, strNoAppBod, 8000, MB_ICONINFORMATION);
end
Window.Close(Application.GetWndHandle(), CLOSEWND_TERMINATE);
end
--SREsources
function EnumResources()
local bRescVerif = true;
--[[set your table-s structure to suit- one example method only here,based on crc values,
pre-determined for a runtime rescourse location, (must be in order to work)]]
local tResIm = {12345678, yada yada, etc, etc, etc}; --for simplicity: numeric order of id values
local tRBins = File.Find(AppRescoureFolderpath, "\\*.*", false, false, nil, nil); --recurse off for example.
if (tRBins) then
if (Table.Count(tRBins) >= 5) then
Table.Sort(tRBins, nil);
for n, bin in tRBins do
if false then break end
if (File.GetCRC(bin) ~= tResIm[n]) then
bRescVerif = false;
end
end
else
bRescVerif = false;
end
end
if (not bRescVerif) or (tRBins == nil) then
bShowAPPEndmess = true; -- show a timed message or not.
APP_TERM();
end
end
--EREsources
--the call (best placed on the 'OnPreLoad' event for each page of App) and OnStartup actions
EnumResources(); --could add target paramaters to expand functionality etc.
hth