Home > Archive > FoxPro Help and Support > May 2005 > How does VFP locate class libraries during runtime?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How does VFP locate class libraries during runtime?
Peter

2005-04-26, 8:25 pm

I have a question about how controls locate their class libraries during
runtime. If I have 2 exes (main.exe and module.exe) which use custom.vcx but
the two custom.vcxs are not the same, how does VFP know which custom.vcx to
use when running a form which has controls from custom.vcx of the module.exe?

1. Does it matter whether the form is included or excluded in the project?
2. Can we control how VFP locates the class libraries?


Thanks,

Craig Berntson

2005-04-26, 8:25 pm

The location of the VCX is stored in the form. It's path is relative to the
location of the form.

--
Craig Berntson
MCSD, Visual FoxPro MVP
www.craigberntson.com
Salt Lake City Fox User Group
www.slcfox.org
www.foxcentral.net


"Peter" <Peter@discussions.microsoft.com> wrote in message
news:B51F6790-1283-4852-9D99- 8CF3BCBB4F4D@microso
ft.com...
>I have a question about how controls locate their class libraries during
> runtime. If I have 2 exes (main.exe and module.exe) which use custom.vcx
> but
> the two custom.vcxs are not the same, how does VFP know which custom.vcx
> to
> use when running a form which has controls from custom.vcx of the
> module.exe?
>
> 1. Does it matter whether the form is included or excluded in the project?
> 2. Can we control how VFP locates the class libraries?
>
>
> Thanks,
>



Fred Taylor

2005-04-26, 8:25 pm

You can use SET CLASSLIB TO command to control the order. and it will also
make a difference if the form is external to the .EXE or not. If it's
internal, it use what's in the .EXE, otherwise it will use the path.

--
Fred
Microsoft Visual FoxPro MVP


"Peter" <Peter@discussions.microsoft.com> wrote in message
news:B51F6790-1283-4852-9D99- 8CF3BCBB4F4D@microso
ft.com...
>I have a question about how controls locate their class libraries during
> runtime. If I have 2 exes (main.exe and module.exe) which use custom.vcx
> but
> the two custom.vcxs are not the same, how does VFP know which custom.vcx
> to
> use when running a form which has controls from custom.vcx of the
> module.exe?
>
> 1. Does it matter whether the form is included or excluded in the project?
> 2. Can we control how VFP locates the class libraries?
>
>
> Thanks,
>



Fred Taylor

2005-04-27, 3:24 am

I don't think it has anything to do with the location of the form, Craig.
It's relative to the current folder when you modify the form.

--
Fred
Microsoft Visual FoxPro MVP


"Craig Berntson" < iamcraig@iamcraigber
ntson.com> wrote in message
news:%23d1u1NsSFHA.612@TK2MSFTNGP12.phx.gbl...
> The location of the VCX is stored in the form. It's path is relative to
> the location of the form.
>
> --
> Craig Berntson
> MCSD, Visual FoxPro MVP
> www.craigberntson.com
> Salt Lake City Fox User Group
> www.slcfox.org
> www.foxcentral.net
>
>
> "Peter" <Peter@discussions.microsoft.com> wrote in message
> news:B51F6790-1283-4852-9D99- 8CF3BCBB4F4D@microso
ft.com...
>
>



Craig Berntson

2005-04-27, 11:24 am

Fred,

You're right. Thanks for the clarification.

--
Craig Berntson
MCSD, Visual FoxPro MVP
www.craigberntson.com
Salt Lake City Fox User Group
www.slcfox.org
www.foxcentral.net


"Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
news:uEswCQtSFHA.3176@TK2MSFTNGP09.phx.gbl...
>I don't think it has anything to do with the location of the form, Craig.
>It's relative to the current folder when you modify the form.
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "Craig Berntson" < iamcraig@iamcraigber
ntson.com> wrote in message
> news:%23d1u1NsSFHA.612@TK2MSFTNGP12.phx.gbl...
>
>



Peter

2005-04-29, 3:27 am

Hi Fred,

Is there a search order for vcx like the search order for procedure?

Thanks,

Peter

"Fred Taylor" wrote:

> You can use SET CLASSLIB TO command to control the order. and it will also
> make a difference if the form is external to the .EXE or not. If it's
> internal, it use what's in the .EXE, otherwise it will use the path.
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "Peter" <Peter@discussions.microsoft.com> wrote in message
> news:B51F6790-1283-4852-9D99- 8CF3BCBB4F4D@microso
ft.com...
>
>
>

Fred Taylor

2005-04-29, 3:27 am

Sure. When you do SET CLASSLIB TO, you either provide a list of .VCX files,
or you can append to the list by using the ADDITIVE keyword. The order they
appear in the list is the order they're searched in.

--
Fred
Microsoft Visual FoxPro MVP


"Peter" <Peter@discussions.microsoft.com> wrote in message
news:7685DA37-F943-480E-AE58- 598C57E071C4@microso
ft.com...[color=darkred]
> Hi Fred,
>
> Is there a search order for vcx like the search order for procedure?
>
> Thanks,
>
> Peter
>
> "Fred Taylor" wrote:
>


Peter

2005-04-29, 3:27 am

Hi Fred,

The search order I'm referring to is something like this:

When you issue the DO command with a procedure name, Visual FoxPro searches
for the procedure in the following order:

1. The file containing the DO command.
2. The current database.
3. Procedure files opened with SET PROCEDURE.
For more information, see SET PROCEDURE Command.
4. Program files in the execution chain.
Visual FoxPro searches program files in order from the most recently
executed program to the first program executed.
5. A standalone program file.

If a matching program file is found, Visual FoxPro executes the program.
Otherwise, Visual FoxPro generates an error message.

To execute a procedure in a specific file, include the IN clause in the DO
command.



"Fred Taylor" wrote:

> Sure. When you do SET CLASSLIB TO, you either provide a list of .VCX files,
> or you can append to the list by using the ADDITIVE keyword. The order they
> appear in the list is the order they're searched in.
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "Peter" <Peter@discussions.microsoft.com> wrote in message
> news:7685DA37-F943-480E-AE58- 598C57E071C4@microso
ft.com...
>
>
>

Fred Taylor

2005-04-29, 11:26 am

Exactly as I said, with one difference.

If your class was defined in a .PRG, the search path will include the method
you've specified first, looking for the DEFINE CLASS. Then the SET CLASSLIB
order kicks in.

--
Fred
Microsoft Visual FoxPro MVP


"Peter" <Peter@discussions.microsoft.com> wrote in message
news:4E9731B1-DF42-426C-ACA2- E601E7AC9B7E@microso
ft.com...[color=darkred]
> Hi Fred,
>
> The search order I'm referring to is something like this:
>
> When you issue the DO command with a procedure name, Visual FoxPro
> searches
> for the procedure in the following order:
>
> 1. The file containing the DO command.
> 2. The current database.
> 3. Procedure files opened with SET PROCEDURE.
> For more information, see SET PROCEDURE Command.
> 4. Program files in the execution chain.
> Visual FoxPro searches program files in order from the most recently
> executed program to the first program executed.
> 5. A standalone program file.
>
> If a matching program file is found, Visual FoxPro executes the program.
> Otherwise, Visual FoxPro generates an error message.
>
> To execute a procedure in a specific file, include the IN clause in the DO
> command.
>
>
>
> "Fred Taylor" wrote:
>


Dan Freeman

2005-04-29, 11:26 am

From the help topic for Createobject():

Visual FoxPro searches for the class or OLE object in the following order:
1.. Visual FoxPro base classes


2.. Classes in the current program


3.. Classes in .vcx class libraries opened with SET CLASSLIB


4.. Classes in procedure files opened with SET PROCEDURE


5.. Classes in the Visual FoxPro program execution chain


6.. The OLE registry if SET OLEOBJECT is ON



Peter wrote:[color=darkred
]
> Hi Fred,
>
> The search order I'm referring to is something like this:
>
> When you issue the DO command with a procedure name, Visual FoxPro
> searches for the procedure in the following order:
>
> 1. The file containing the DO command.
> 2. The current database.
> 3. Procedure files opened with SET PROCEDURE.
> For more information, see SET PROCEDURE Command.
> 4. Program files in the execution chain.
> Visual FoxPro searches program files in order from the most
> recently executed program to the first program executed.
> 5. A standalone program file.
>
> If a matching program file is found, Visual FoxPro executes the
> program. Otherwise, Visual FoxPro generates an error message.
>
> To execute a procedure in a specific file, include the IN clause in
> the DO command.
>
>
>
> "Fred Taylor" wrote:
>


Fred Taylor

2005-04-29, 8:27 pm

Guess I got that backwards, then. Thanks Dan.

--
Fred
Microsoft Visual FoxPro MVP


"Dan Freeman" <spam@microsoft.com> wrote in message
news:%23u8XkCNTFHA.584@TK2MSFTNGP15.phx.gbl...
> From the help topic for Createobject():
>
> Visual FoxPro searches for the class or OLE object in the following order:
> 1.. Visual FoxPro base classes
>
>
> 2.. Classes in the current program
>
>
> 3.. Classes in .vcx class libraries opened with SET CLASSLIB
>
>
> 4.. Classes in procedure files opened with SET PROCEDURE
>
>
> 5.. Classes in the Visual FoxPro program execution chain
>
>
> 6.. The OLE registry if SET OLEOBJECT is ON
>
>
>
> Peter wrote:
>
>



Dan Freeman

2005-05-02, 11:24 am

I always have to look it up. The only two I can always remember is that it
starts with the base classes and ends in the registry. <g>

Dan

Fred Taylor wrote:[color=darkred
]
> Guess I got that backwards, then. Thanks Dan.
>
>
> "Dan Freeman" <spam@microsoft.com> wrote in message
> news:%23u8XkCNTFHA.584@TK2MSFTNGP15.phx.gbl...


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com