ITask::SetApplicationName method (mstask.h)

[[This API may be altered or unavailable in subsequent versions of the operating system or product. Please use the Task Scheduler 2.0 Interfaces instead.] ]

This method assigns a specific application to the current task.

Syntax

HRESULT SetApplicationName(
  LPCWSTR pwszApplicationName
);

Parameters

pwszApplicationName

A null-terminated string that contains the name of the application that will be associated with the task. Use an empty string to clear the application name.

Return value

The SetApplicationName method returns one of the following values.

Return code Description
S_OK
The operation was successful.
E_INVALIDARG
The arguments are not valid.
E_OUTOFMEMORY
Not enough memory is available.

Remarks

If you do not specify a path for the application, the Task Scheduler searches the environment path to find the correct path. If the application name specifies a program, the name should use the .exe extension to ensure that the Task Scheduler user interface properly displays the application's icon.

After calling SetApplicationName, make sure you call IPersistFile::Save to save the modified task to disk.

Examples

For an example of how to set the application name, see C/C++ Code Example: Setting Application Name.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header mstask.h
Library Mstask.lib
DLL Mstask.dll
Redistributable Internet Explorer 4.0 or later on Windows NT 4.0 and Windows 95

See also

GetApplicationName

ITask