Font::GetLastStatus method (gdiplusheaders.h)

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

Syntax

Status GetLastStatus();

Return value

Type: Status

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

If no methods invoked on this Font object have failed, then Font::GetLastStatus returns Ok.

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

Remarks

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

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

Examples

The following example creates a Font object, checks to see that the call to create the object was successful, and, if it was, uses the Font object to draw text.

VOID Example_GetLastStatus(HDC hdc)
{
   Graphics graphics(hdc);

   // Create a Font object.
   Font myFont(L"Arial", 16);

   // Check the status of the last call.
   Status status = myFont.GetLastStatus();

   // If the call to create myFont succeeded, use myFont to write text.
   if (status == Ok)
   {
       SolidBrush solidbrush(Color(255, 0, 0, 0));
       WCHAR      string[] = L"The call succeeded";
       graphics.DrawString(string, 18, &myFont, PointF(0, 0), &solidbrush);
   }
}

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 gdiplusheaders.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Font

Font::IsAvailable

Graphics

Status

Using Text and Fonts