Microsoft KB Archive/189603

= INFO: NewObject Command Respects the SET PROCEDURE Command =

Article ID: 189603

Article Last Modified on 12/11/1999

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q189603



SUMMARY
The NewObject function temporarily overrides the SET CLASSLIB and SET PROCEDURE commands in order to create an object from a specific class and class library. The SET PROCEDURE TO setting is retained, however, during the initialization of the NewObject object, in the event that the information in a procedure is required.



MORE INFORMATION
In the following example, an object instantiated using the NewObject command calls a procedure located in a .prg file:  Create a class named ProcTest in a class library name SetProcTest as follows:

CREATE CLASS ProcTest of SetProcTest as Custom

  In the Init Event of ProcTest, place the following code and save the class: lcValue = InitFunction MESSAGEBOX(lcValue)   Create a procedure called TestProg with the following code: PROCEDURE InitFunction RETURN "Hello"   In the Command window, issue the following commands: SET PROCEDURE to TestProg oProcTest = NEWOBJECT("ProcTest", "SetProcTest") 

Although the NewObject function performs its own SET CLASSLIB and SET PROCEDURE commands, in order to instantiate an object, the ability to use SET CLASSLIB or SET PROCEDURE settings previously invoked allows additional flexibility in this command. The SET CLASSLIB and SET PROCEDURE commands remain available to the NewObject command and do not have to be re-issued during the instantiation of an object.

Additional query words: kbVFp600 kbOOP

Keywords: kbinfo KB189603

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.