Cicode Programming Reference > Cicode Function Categories > Task Functions Introduction > TaskHnd

TaskHnd

Gets the task handle of a specific task. You can then use the task handle with other task functions to control the task. If you do not specify a thread name, it will default to that of the current task.

Syntax

TaskHnd( [sName] )

sName:

The thread name of the task. The thread name is the name of the function that was passed to the TaskNew() function. For example, if. . .

TaskNew("MyTask","",0);

then:

hTask=TaskHnd("MyTask");

will return the handle of this task.

If you do not specify a thread name, it will default to that of the current task.

Return Value

The task handle, identifying the table where all data on the task is stored.

Related Functions

TaskKill, TaskNew, TaskResume, TaskSuspend

Example

! Get the task handle of the current task and then kill it.
hTask=TaskHnd();
TaskKill(hTask);
! Get the task handle of MyTask and then kill it.
hTask=TaskHnd("MyTask");
TaskKill(hTask);

See Also

Task Functions