TaskSwitch

3.1

  #include <toolhelp.h>    

  BOOL TaskSwitch(htask, dwNewCSIP)    
  HTASK htask; /* handle of task, */  
  DWORD dwNewCSIP; /* execution address within task */

The TaskSwitch function switches to the given task. The task begins executing at the specified address.

Parameters

htask

Identifies the new task.

dwNewCSIP

Identifies the address within the given task at which to begin execution. Be very careful that this address is not in a code segment owned by the given task.

Return Value

The return value is nonzero if the task switch is successful. Otherwise, it is zero.

Comments

When the task identified by the htask parameter yields, TaskSwitch returns to the calling application.

TaskSwitch changes the CS:IP value of the task's stack frame to the value specified by the dwNewCSIP parameter and then calls the DirectedYield function.

See Also

DirectedYield, TaskSetCSIP, TaskGetCSIP