Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to make external prg look for DBF inside calling exe
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01625594
Message ID:
01625780
Vues:
68
>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.:
* myTableRepository.PRG, main program of the project

define class myRepository as Session olepublic
	function init() as Boolean
		use comtable && this table has only two fields, PK (Primary Key, AutoInc and index also named PK) and TableName C(xxx)
		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
	***** Whatever else you need
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform