I did testing similar to what you suggested before I posted to the group. That's how I isolated the issue down to the AGETFILEVERSION() command.
I am storing my settings in an INI file which uses the same JUSTSTEM() path and name as the EXE file for different projects where the EXE might be named various ways. By identifying the primary EXE file, we know the settings file that corresponds to the EXE for that project without having to hard code the INI file name within any of our classes, forms or reports. It's just been an easy way to do things for the past 20+ years. During that time our code hasn't changed much for this particular class, but now when we are using the Oracle ODBC Driver, AGETFILEVERSION() returns an empty string instead of the normal array of data. No error, no stop, just an empty string and not an empty array just an empty string. I have confirmed from the tests I've been doing the reason it works the first time, is because we call AGETFILEVERSION() prior to getting a connection handle to the Oracle ODBC but once a connection is established, AGETFILEVERSION() will return only an empty string until I restart Foxpro.
My code was useful because as long as I had even an old version of the main EXE file in the development folder, running any program or form that needed to get values from the INI could easily check for the EXE filename and know which setting file to access. That is no longer the case and I'll have to come up with either a solution to what is causing AGETFILEVERISON() to fail or re-factor the class I use to find the EXE file name to use a different method. So far, the suggestions have been good, but most require you to be running the EXE to pull that information from the stack. My method didn't require the EXE to be running in order to identify the INI file.
I'll keep testing, Thanks!
Paul H. Tarver
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Frank Cazabon Sent: Wednesday, May 02, 2018 7:01 AM To: profoxtech@leafe.com Subject: Re: AGETFILEVERSION Fail
Maybe you could break it up into a little test program to narrow it down and ensure it's the Oracle connection causing the problem. Cut out all your code and do something like this:
AGETFILEVERSION("Your exe")
* test that correct values returned
* then connect to Oracle
* check AGETFILEVERSION()
* disconnect from Oracle
* check AGETFILEVERSION()
* then connect to Oracle
* check AGETFILEVERSION()
* disconnect from Oracle
* check AGETFILEVERSION()
FWIW I use NOT VERSION(2) = 0 to determine if I'm running in development mode (I almost never run the exe in development mode, just start from the main program or run the individual form). SYS(16,0) or PROGRAM(0) may also help you out as an alternative.
Frank.
Frank Cazabon
On 01/05/2018 03:23 PM, Paul H. Tarver wrote:
Frank,
Sorry for the delay in responding. Here's the basic code I'm using:
m.plFileDesc = "MAIN PROGRAM"
lnExeNumber = ADIR(laPrograms, '*.EXE') =ASORT(laPrograms,3,-1,1)
leRetVal = ''
IF m.lnExeNumber > 0
FOR lnLoopCnt = 1 TO m.lnExeNumber
lnElements = AGETFILEVERSION(laVersInfo,laPrograms[m.lnLoopCnt,1])
IF m.lnElements > 0 IF UPPER(ALLTRIM(laVersInfo(3))) ==ALLTRIM(m.plFileDesc)
leRetVal =ALLTRIM(laPrograms[m.lnLoopCnt,1]) EXIT
ENDIF ENDIFENDFOR
ENDIF
Here's the logical process:
- Start Foxpro, run form, get connection handle to Oracle via ODBC and
the
code above works perfectly. 2) Exit form (without closing Foxpro) and restart form and though we get a valid array from ADIR() but AGETFILEVERSION() returns '' 3) Exit Foxpro, restart and GOTO back to step 1
The reason for this code is to identify the application .EXE. Perhaps
there
is a better way to identify the application name that will eliminate the need to use AGETFILEVERSION() to identify the main .exe file for the application.
Paul
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Frank Cazabon Sent: Sunday, April 29, 2018 4:26 PM To: profoxtech@leafe.com Subject: Re: AGETFILEVERSION Fail
Paul,
what's the code you are using?
Frank.
Frank Cazabon
On 28/04/2018 02:38 PM, Paul H. Tarver wrote:
Has anyone ever had any problem with AGETFILEVERSION() failing to return values after an ODBC connection is made?
I'm using the Oracle ODBC Driver and until the SQLCONNECT() command is issued AGETFILEVERSION() works perfectly. After I issue the SQLCONNECT() command and get a valid handle, AGETFILEVERSION() will not return any values. I have to exit VFP and restart it, then, AGETFILEVERSION() works again until I make another connection to Oracle via ODBC.
I've used the Oracle's ODBC driver previously with no ill affect. But now.Grrrrrr!
Paul
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]