Desktop Functions:

   Smart Device Functions:

Show Recent Changes
Subscribe (RSS)
Misc. Pages
Helpful Tools
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
IsProcessInJob (kernel32)
TODO - a short description

C# Signature:

[DllImport ("kernel32.dll")]

public static extern bool IsProcessInJob (IntPtr Process, IntPtr Job, out bool Result);

VB Signature:

User-Defined Types:

Alternative Managed API:



Tips & Tricks:


Process - A handle to the process to be tested. The handle must have the PROCESS_QUERY_INFORMATION access right.

Job - A handle to the job. If this parameter is NULL, the function tests if the process is running under any job.If this parameter is not NULL, the handle must have the JOB_OBJECT_QUERY access right.

Result - A pointer to a value that receives TRUE if the process is running in the job, and FALSE otherwise.

Return Value - If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.


Process - дескриптор процесса, должен иметь доступ PROCESS_QUERY_INFORMATION

Job - дескриптор задания, должен иметь доступ JOB_OBJECT_QUERY, если он IntPtr.Zero то проверяется, находится ли процесс в каком-либо задании.

Result - если true - процесс в задании, false - не в задании

Return Value - если все успешно - true, если ошибка - false.

Sample Code:


public class SecurityAttributes


  public int nLength; //Useless field = 0
  public IntPtr pSecurityDescriptor; //хз))
  public bool bInheritHandle; //Возможность наследования

  public SecurityAttributes ()
     this.bInheritHandle = true;
     this.nLength = 0;
     this.pSecurityDescriptor = IntPtr.Zero;


public static extern IntPtr GetCurrentProcess();


public static extern bool CloseHandle(IntPtr Object);

[DllImport("kernel32.dll",EntryPoint="CreateJobObjectW", CharSet=CharSet.Unicode)]

public static extern IntPtr CreateJobObject(SecurityAttributes JobAttributes, string lpName);


public static extern bool AssignProcessToJobObject(IntPtr Job, IntPtr Process);

[DllImport ("kernel32.dll")]

public static extern bool IsProcessInJob (IntPtr Process, IntPtr Job, out bool Result);

public static void Main ()


  bool Is;
  IntPtr Job = CreateJobObject (null, "Хуй =)");
  AssignProcessToJobObject(Job, GetCurrentProcess());

  IsProcessInJob (GetCurrentProcess (), Job, out Is);
  Console.WriteLine ("That process in that job: " + Is);

  IsProcessInJob (GetCurrentProcess (), IntPtr.Zero, out Is);
  Console.WriteLine ("That process in any job: " + Is);

  CloseHandle (Job);



Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

Access directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version