c++windowswinapiwin32-process

I have a question about the paramether of GetPriorityClass Function (and [in] attribute)


DWORD GetPriorityClass(
  [in] HANDLE hProcess
);

In the documentation they says if the function succeeds, the return value is the priority class of the specified process.

The parameter takes [in] HANDLE hProcess that will be the process that i will be take the priority, but i dont know what means [in] or if i have to put some data into the parameter.


The docs says the next thing :

[in] hProcess

A handle to the process.


But doesnt explain or show some example or how can i fill the param.


Solution

  • As you can see in the documentation, GetPriorityClass:

    Retrieves the priority class for the specified process.

    (emphasis is mine)

    The handle to the process is passed as the hProcess input argument (marked with the [in] attribute) to the function.
    This just means you have to supply it yourself.

    Something like:

    HANDLE hMyProcess = ...;
    DWORD dwRes = GetPriorityClass(hMyProcess);
    if (dwRes == 0)
    {
        // Handle error
    }
    else
    {
        // Use the priority class in dwRes
    }
    

    Notes: