>In several places in our application executable we have hooks that call custom, external, encrypted programs whose names are stored in a table.
>
>Recently, a new custom program needed to USE a confidential free table that is included in the executable, and VFP couldn't find it.
>
>Is there any way that we can force the external program to look for the table inside the exe file?
>
>TIA,
>
>Alex
Hi Alejandro,
I came late to this party, you already have a working solution however debatable is it so I will give you an alternative, which I understand it might not be viable for you in this case as it implies changes in both projects.
Anyways, in its simplest form my suggestion is that you create a project, lets call it TestCOMTable, in said project you include your table and a main program like this (remember, this is very simple code, no error checking etc.:
define class myRepository as Session olepublic
function init() as Boolean
use comtable
return .t.
endfunc
procedure Destroy() as VOID
use in select('comtable')
return null
endproc
function getTableName(tnPK as Integer) as String
local lcTableName as String
lcTableName = null
if vartype(tnPK) = 'N' and indexseek(tnPK, .t., 'comtable', 'pk')
lcTableName = alltrim(comtable.tablename)
endif
return lcTableName
endfunc
enddefine
Now you compile your project and from any of your programs you can do something like:
loRepository = CREATEOBJECT('TestCOMTable.myRepository')
lcTableName = loRepository.getTableName(1)
if not isnull(lcTableName)
use (lcTableName) alias myTable in 0 shared
endif
Cheers,
Hugo
[Update] I just re-read your message and find out you do not have tables in the fields but fxps, but the concept is the same... [/Update]
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?
"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare
"To die for a religion is easier than to live it absolutely"
Jorge L. Borges