IVsTaskList.RegisterCustomCategory(Guid, UInt32, VSTASKCATEGORY[]) Method

Definition

Registers a custom category with the task list.

public:
 int RegisterCustomCategory(Guid % guidCat, System::UInt32 dwSortOrder, cli::array <Microsoft::VisualStudio::Shell::Interop::VSTASKCATEGORY> ^ pCat);
public int RegisterCustomCategory (ref Guid guidCat, uint dwSortOrder, Microsoft.VisualStudio.Shell.Interop.VSTASKCATEGORY[] pCat);
abstract member RegisterCustomCategory : Guid * uint32 * Microsoft.VisualStudio.Shell.Interop.VSTASKCATEGORY[] -> int
Public Function RegisterCustomCategory (ByRef guidCat As Guid, dwSortOrder As UInteger, pCat As VSTASKCATEGORY()) As Integer

Parameters

guidCat
Guid

[in] GUID of the custom category you wish to register.

dwSortOrder
UInt32

[in] The requested sort placement within VSTASKCATEGORY for the custom category.

pCat
VSTASKCATEGORY[]

[out] Pointer to the actual sort placement of the custom category within VSTASKCATEGORY.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsTaskList::RegisterCustomCategory(  
   REFGUID guidCat,  
   [in] DWORD dwSortOrder,  
   [out] VSTASKCATEGORY *pCat  
);  

Each custom category must have its own GUID. The dwSortOrder parameter is the place in the VSTASKCATEGORY enumeration where the custom category should sort. For example, if you want your custom category to be placed after Code Sense errors (CAT_CODESENSE = 30) but before shortcuts (CAT_SHORTCUTS = 40) during a sort, you can pass in a value of 31 for dwSortOrder. If 31 is already being used by another custom category, the task list scans up until it finds a sort position not being used. The actual position within VSTASKCATEGORY that the task list assigns to your custom category is what is passed back as the *pCat parameter.

Much of the effect of a custom category can be achieved without actually implementing a custom category. Each task item can be given its own bitmap image and tasks can be sorted together by giving them the same subcategory. A few reasons why you would want to implement custom categories include:

  • It is important that your category be sorted in a particular place in the task list.

  • You don't want to use the CAT_MISC enumeration in VSTASKCATEGORY because other tasks might also be using it. In this case, all of the CAT_MISC tasks would be sorted together, making it impossible to assure that your tasks will be placed together during a sort.

  • You want a custom view where only your tasks are shown in the task list.

Note

Creating a custom category does not automatically create a custom view associated with it. Custom views are registry based, and are described in the AutoFilter2.

Applies to