StringFormat::GetLastStatus method (gdiplusstringformat.h)

The StringFormat::GetLastStatus method returns a value that indicates the nature of this StringFormat object's most recent method failure.

Syntax

Status GetLastStatus();

Return value

Type: Status

The StringFormat::GetLastStatus method returns an element of the Status enumeration.

If no methods invoked on this StringFormat object have failed since the previous call to StringFormat::GetLastStatus, then StringFormat::GetLastStatus returns Ok.

If at least one method invoked on this StringFormat object has failed since the previous call to StringFormat::GetLastStatus, then StringFormat::GetLastStatus returns a value that indicates the nature of the most recent failure.

Remarks

You can call StringFormat::GetLastStatus immediately after constructing a StringFormat object to determine whether the constructor succeeded.

The first time you call the StringFormat::GetLastStatus method of a StringFormat object, it returns Ok if the constructor succeeded and all methods invoked so far on the StringFormat object succeeded. Otherwise, it returns a value that indicates the nature of the most recent failure.

Examples

The following example creates a StringFormat object, calls two StringFormat methods, and then checks the status to see if an error occurred during the construction or either of the method calls.

StringFormat stringFormat;
stringFormat.SetAlignment(StringAlignmentCenter);
HotkeyPrefix hotkeyPrefix = stringFormat.GetHotkeyPrefix();

if (stringFormat.GetLastStatus() == Ok)
{
   // There have been no errors since the previous call to GetLastStatus.
}
else
{
   // An error occurred since the previous call to GetLastStatus.
}

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusstringformat.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

StringFormat

StringFormatFlags