Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem in production environment with vfp9

Status
Not open for further replies.

rha2000

Programmer
Aug 6, 2012
14
AR

Hello

The following code works in development environment:

LOCAL loListener
loListener = newobject('HyperlinkListener', 'HyperlinkListener.prg')
IF UPPER(TYPE("loListener")) <> "O" THEN
messagebox("FAIL! loListener could not be created. Check msvcr71.dll")
messagebox("loListener type=" + TYPE("loListener "))
ELSE
MESSAGEBOX("ok")
RELEASE loListener
ENDIF

But when I run it on the client's pc it doesn't work, it gives the error:
"FAIL! loListener could not be created. Check msvcr71.dll"

The HyperlinkListener.prg file contains the class:
define class HyperlinkListener as HTMLListener OF ;
home() + 'ffc\_ReportListener.vcx'
** code
enddefine

In the development environment HOME (1) returns "C:\Program Files (x86)\Microsoft Visual FoxPro 9\"
in the production environment HOME (1) returns empty.
The problem seems to be that it is when vfp9 is not installed.

The msvcr71.dll file is in the application directory and I copied it to system32, syswow64, and it is also registered when the program is installed.
On the other hand it seemed a problem with libraries, I copied to the main directory of the ffc application but it still doesn't work.
Beyond this trial and error experiment I did I could not find any variation in the situation.

The msvcr71.dll file is in the application directory and I copied it to system32, syswow64, and it is also registered when the program is installed.
On the other hand it seemed a problem with libraries, I copied to the main directory of the ffc application but it still doesn't work.
Beyond this trial and error experiment I did I could not find any variation in the situation.

At this point I ask myself:
Do I need to install any program on the client's pc?
Will it be some parameter that I am missing in NEWOBJECT?

Any ideas?

Thanks
 
To start with, HOME() and HOME(1) are not necessarily the same. When running from an EXE, the former returns the location of the VFP runtime libraries. The latter returns the directory where VFP was installed, which is not usually present on a production machine.

But in any case, that does not necessarily matter, as _ReportListener.vcx would normally be bound into your EXE. The best approach is to copy it to the root directory of your application within the development environment (the one containing your main program), and to include it in your project. That way, it will be found during the build process and included in the EXE.

And remove the path from the DEFINE CLASS.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
HI,

1-Please check the Helpfile for the difference of Home() and Home(1).
2-is the file hyperlinklister.prg stored in your pjx?
Koen
 
This kind of relative reference to libraries are normal in VFPs ffc classes the standard wizards for forms, reports etc also use.

If you just create a new project and add that prg and build an EXE, the compile should tell you it doesn't find _reportlistener.vcx and you need to locate it. Once you do the _reportlistener.vcx and _gdiplus.vcx are added to the PJX And compilation works.

At runtime the HtmlListner will be found within the EXE, then. But if you ignore compilation errors your exe will be incomplete and not find things that should be included into the PJX and then compiled into the EXE.

Bye, Olaf.



Olaf Doschke Software Engineering
 
In the attached image I describe the two cases.
In case 1 it does not work in development environment, in case 2 it works in development environment but not in production.

vfp9-problem_bopndv.png


I also attached the test code.

If I link to the libraries that are in the application folder it seems that some are missing, because it does not work, if I use the libraries of the FFC folder it works well in the development environment but not in production.
How can I know what library is missing if that is the problem?

I tried to add the _gdiplus.vcx library but it gives me the following error: "Allowed do nesting or expression evaluation level exceeded."

The hyperlinklistener.prg file is in the project.

Remove the path from the DEFINE CLASS, but remain the same.

Thank you for your contributions.

Organize the problem differently to describe it better.
 
 https://files.engineering.com/getfile.aspx?folder=85e1f72b-46e8-413d-b92d-b63e24029073&file=test.zip
Hi,

What is your path setting?

I notice in your test.zip there is no path setting at all
Koen
 
You screen shots show that the VCX is in a directory at or below c:\test. That's fine. But is c:\test actually in your search path (including in your default directory)? It is not enough for the project to know where the VCX is located. Your run-time code must be able to find it as well.

In general, it's not a good idea to hard-code directory paths within your code. Better to place all the needed components in the default directory or directories specified by SET PATH. Or, when it comes to class libraries, you could also use SET CLASSLIB.

By the way, if DEFINE CLASS cannot find the parent class or class library, it won't immediately return an error. That only happens when you try to instantiate the class.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
As I stated earlier, when the compiler sees a dependency it'll add the VCX library, and that includes other libraries classes of the library inherit from, so it can cause a whole cascade of added files to the project.

It will include the _gdiplus.vcx, as there must be some dependency. Maybe not important when you only want to use the HTMLlistener which only inherits from a long chain of other listeners going back to the reportlistener base class. But the problem you have when adding the _gdiplus.vcx points out something is weird with your VFP installation. A nesting error exceeding allowed level is about when you make a too deep recursive call or use an expression referencing itself directly or indirectly cause more than 128 calls on the call stack. I don't see how that could happen when you just add a library to the project, but if you use a framework, which even hooks into the development time acting on the PJX via a project hook, that might cause such an error.

Aside from that and totally independent, you always have a problem using FFC with VFP installed into program files, as the program files folder is read-only protected and while the VCXes contain both source and object code and need no compilation, the PRGs coming in the FFC folder don't all have their compiled FXP file and recompile all will also cause compilation of PRG and VCX source memos, so you end up with files in the VirtualStore folder. You should give users permission to write into the VFP home folder to solve this better than Windows solves this with its redirection of file writes into VirtualStore folders.

Or simpler: Install FVFP into a nonsystem folder like c:\Users\Public\VFP

And then, another thing about copying FFC libraries into your own local folder is, that it does reference back to the VFP installation folder with Home() references, which makes copying the FFC folder into your project folder fruitless in terms of how things are instantiated at design time and runtime.

You might also need SP2 to fix some issues.

In summary, I'd recommend what also wOOdy (Jürgen Wondzinski) wrote about the VFP9 installation: Install into a separate folder, get the SPs and also VFPX project add ons (Sedna and more, Thor, for example, as a basis for anything integrated into that IDE menu extension).

And then when you use FFC classes, use the ones from the installation folder, which then also is writable and doesn't cause problems when you recompile all.

If you extend or edit FFC classes, that's a bad idea when other projects or third party modules depend on originals, you better then Do copy the FFC folder, but even before you make the first edits there, you'd need to fix all backreferences using Home() both in code and (if so) in any expressions stored in properties, too. And that'll be tedious, so it's not really recommendable. If you need to change something, even a known bug, inherit the original class into a child class and change the child class, that's the OOP way of doing this, as it keeps original code untouched.

I actually don't assume you fiddled with the VCXes, but maybe that explains the recursion level error. The simplest thing to do is starting with a VFP9 installation from scratch. First, create a destination folder like C:\VFP9, then start the setup, because within the setup, at the step you're asked to confirm the usual install path c:\program files (x86)\Microsoft Visual Foxpro 9\ you can't create a new folder, you can only enter a path to an existing folder. But you can do at least that, and have no complications with UAC and file virtualization the OS does since Vista.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Hello

Thank you for your input, I solved the problem but others appeared to me.
The system with problems is in production, in development mode it works well.
Install vfp9SP2RT.exe on a client PC that was not working
REPORT FORM MY_INFO\REPORT.FRX OBJECT loListener
After installation it works when I use
REPORT FORM MY_INFO\REPORT.FRX OBJECT loListener
but when I use
REPORT FORM MY_INFO\REPORT.FRX PREVIEW
the report is not displayed, the window appears in gray.

In addition, even if I update only one pc, the change spread throughout the network.

In summary, what can be the problem for the listings
REPORT FORM MY_INFO\REPORT.FRX PREVIEW has stopped working.

What could be the problem?

 
The problem was simpler than I thought. When the list appeared in gray, I had to click on a page icon, and it was fixed.

one-page_nb0fiz.jpg


Maybe after installing "vfp9SP2RT.exe" it was configured in another way by default.

Thanks for your help.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top