Thread object (Only Visual Project Type)
Since version 1.0.06.0019,
Easy Code includes
the new thread object, which can easily create
threads in any visual application.
A thread object is treated as a child control, so
it has a control identifier
constant as any other control. For more information
on how to get the control identifier, please see
child control identifiers.
When adding a thread object to a window, a procedure for the thread is also created. The name for this procedure will be the owner window name plus the thread object name (case sensitive) as in any other control. For example, if the thread is named Thread1 and it is inside a window named Window1, its procedure name will be Window1Thread1 and this will be the procedure called by the thread. Taking that into account, NEVER CHANGE the procedure name manually so that the thread can properly work. When you change the thread object name (or the owner window name) in the Properties window, Easy Code also changes the thread's procedure name according to the new name.
Also, you can pass the address of an existing variable to the thread's procedure by specifying its name in the Parameter property. The address of the specified variable will be passed as the lpParameter argument. Please see the Parameter property for more information.
After a thread is created, you may need to get its handle so that you can change its state and/or priority (set at design time). If so, just call the GetWindowItem method as you do for any other control. Please see the Threads and NetMon examples in the \EasyCode.Go\Examples folder.
REMARKS: Easy Code can create up to 48 threads for each application. In order to control a thread's priority and/or state, please refer to the GetThreadPriority, SetThreadPriority, ResumeThread and SuspendThread API functions.