Windows Process ID
The Windows Process ID of a Visual DataFlex program is something it is sometimes useful to be able to retrieve in order to determine which of several process has done something, especially in the context of logging activity or events, say in the situation of a WebApp or Web Service where a pool of identical processes are servicing user client requests, as it uniquely identifies the running process.
It might also be used to determine which process to kill using Windows Task Manager (in the "Processes" tab the Process ID is shown in the PID column; select the one causing the problem, then click the "End Process" button and confirm) in the event that one of a number of processes is causing a problem.
A program or object need only retrieve the Windows Process ID once, at start-up, because of course it doesn't change.
Retrieving the Process ID involves calling a Windows API function in Kernel32.dll, defined in your code as follows:
External_Function GetCurrentProcessID "GetCurrentProcessId" Kernel32.dll Returns DWord
(Note that the terminal "d" of "GetCurrentProcessId" is lower-case and External Function calls are case-sensitive - something that caused me to fail to get it working for some time! --Mike)
Then in order to determine the Process ID you need only use something like:
Set piProcessID to (GetCurrentProcessID())