COMPILE DATABASE

ProcessID, ThreadID

These properties of the _VFP application object, added in VFP 6 SP3, return the Windows ProcessID and ThreadID.

Usage

nThreadID = _VFP.ThreadID nProcessID = _VFP.ProcessID
Starting a program in Windows creates a process. Each process has a numeric ID associated with it. (Go into the Task Manager, select the Processes tab, and you'll see the Process ID, or PID). Within each process, there is at least one thread. A thread shares the process' virtual address space and system resources. A single-threaded application has one thread; a multithreaded application has many threads that can appear to run at the same time using preemptive multitasking (available in Windows NT and later). VFP is, practically speaking, a single-threaded application for its main logic, although it does spawn a couple of "helper" threads on occasion.

What does this mean to your application? Mostly, it explains how it runs, and you don't have to worry about it. Now, if you're writing COM objects, you'll likely need to understand a little more about it. For more information on this, see the Help file topic, "Scalability and Multithreading." Using the ProcessID and ThreadID properties can help you debug COM objects. You can also pass these values to certain Windows APIs for more functionality, for example, to kill a process.

Example

nThreadID = _VFP.ThreadID nProcessID = _VFP.ProcessID

See Also

_VFP, Application, Build DLL, Build MTDLL


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net