FIX: "Unable to Find Visual Class Library" Errors When You Build a Project with a NewObject Function (317493)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 7.0

This article was previously published under Q317493

SYMPTOMS

When you build a project that includes a program or method that contains the NewObject function, and the program passes the NewObject function a long parameter that calls a Visual FoxPro function, the following error messages may appear:
Unable to find Visual Class Library PASSING A LONG STRING AS A NEWOBJECT() EPARAMETER1,

-and-

Unable to find Visual Class Library VFP 7
This problem does not occur when the parameter does not contain a Visual FoxPro function call.

RESOLUTION

To resolve this problem, obtain the latest service pack for Visual FoxPro for Windows 7.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

316964 How to Obtain the Latest Visual FoxPro for Windows 7.0 Service Pack

STATUS

Microsoft has confirmed that this is a problem in Microsoft Visual FoxPro for Windows 7.0. This problem was first corrected in Visual FoxPro for Windows 7.0 Service Pack 1.

MORE INFORMATION

Steps to Reproduce Behavior

Paste the following code in a program (.prg) file named Test.prg and then run the program from the Command window.

Note: If you use the Project Manager to build the project, you receive the same error messages.
#DEFINE PROJNAME 'testxx'

CLEAR ALL
SET SAFETY OFF
CLEAR
DELETE FILE PROJNAME+ '.pj?'
DELETE FILE PROJNAME+ '.exe'
TEXT to lcProgram NOSHOW

newobject("TestClass","mainxx.prg","", ;
"This is a test of a strange behavior of the"+CHR(32)+ ;
"Test1 VFP7 Project Manager.  Something to do with "+ ;
"passing a long string as a NEWOBJECT() eParameter1, "+ ;
"and that string including a function call.")

newobject("TestClass","mainxx.prg","", ;
PROGRAM() + " This is a test of a strange behavior of the " + ;
"XFP 7.0 Project Manager.  Something to do with " + ;
"passing a long string as a NEWOBJECT() eParameter1, " + ;
"and that string including a function call.")

newobject("TestClass","mainxx.prg","", ;
"Note that this string is just about as long, but does not " + ;
"generate an error in the VFP 7.0 Project Manager.  " + ;
"Something to do with " + ;
"passing a long string as a NEWOBJECT() eParameter1, " + ;
"and that string including a function call.")

RETURN

DEFINE CLASS TestClass AS Custom
PROCEDURE Init(tcString)
   MESSAGEBOX(tcString)
ENDPROC
ENDDEFINE

ENDTEXT

=STRTOF(lcProgram,'mainxx.prg')
CREATE PROJECT PROJNAME NOWAIT
LOCAL pj AS VisualFoxpro.IFoxProject
pj=_VFP.APPLICATION.ACTIVEPROJECT
pj.DEBUG = .F.
pj.FILES.ADD('mainxx.prg')
* Rebuild the project and display errors if there are any.
? pj.BUILD(PROJNAME,1,.T.,.T.)
* Build an executable and display errors if there are any.
? pj.BUILD(PROJNAME,3,.T.,.T.)
pj.CLOSE
RETURN
				

Modification Type:MajorLast Reviewed:3/6/2002
Keywords:kbbug kbCodeSnippet kbDSupport kbProjManager KB317493