Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to make external prg look for DBF inside calling exe
Message
From
09/10/2015 18:11:15
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01625594
Message ID:
01625797
Views:
60
>>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]

Thank you Hugo. BTW, did you ever take a look at Kud Venkat's videos? They are world class.

Alex
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform