void SetCaption(HWND hwnd)
{
    size_t const bufferSize = 256;
    wchar_t caption[bufferSize];
    size_t length = 0;

    // Load the window title.
    SafeAppend(caption, bufferSize, &length, IDS_APP_TITLE);

    // Add a hyphen separator.
    SafeAppend(caption, bufferSize, &length, L" - ");

    // Append a string representing the measuring mode.
    switch (g_measuringMode)
    {
    case DWRITE_MEASURING_MODE_NATURAL:
        SafeAppend(caption, bufferSize, &length, IDS_NATURAL_MODE);
        break;

    case DWRITE_MEASURING_MODE_GDI_CLASSIC:
        SafeAppend(caption, bufferSize, &length, IDS_GDI_CLASSIC_MODE);
        break;

    case DWRITE_MEASURING_MODE_GDI_NATURAL:
        SafeAppend(caption, bufferSize, &length, IDS_GDI_NATURAL_MODE);
        break;
    }

    // Add a comma separator.
    SafeAppend(caption, bufferSize, &length, L", ");

    // Append a string representing the renderer implementation.
    switch (g_rendererID)
    {
    case RendererD2D:
        SafeAppend(caption, bufferSize, &length, IDS_USING_D2D);
        break;

    case RendererDWrite:
        SafeAppend(caption, bufferSize, &length, IDS_USING_DWRITE);
        break;
    }

    SetWindowText(hwnd, caption);
}
	TBool UpdateDevStateL(CBBFeedItem& aItem) 
	{
		TInt state = aItem.iMediaDownloadState(); 

		if ( HasLoadingError( aItem )  )
			{
				TBuf<200> msg; 
				SafeAppend( msg, _L("Couldn't draw loaded image:\n") );
				SafeAppend( msg, iPhoto->LoadingError() );
				iState->UpdateTextL( msg );
				return ETrue;
			}
		
			
		if (state == CBBFeedItem::ENotDownloading ||
			state == CBBFeedItem::EMediaDownloaded )
			{
				iState->ZeroL();
				return ETrue;
			}
		
		
 		TBuf<50> n;	
		switch ( state )
			{
			case CBBFeedItem::ENoMedia:               n = _L("No media"); break;
			case CBBFeedItem::ENotDownloading:        n = _L("Click to download"); break; // NOT USED 
			case CBBFeedItem::EQueued:                n = _L("Queued"); break;
			case CBBFeedItem::EDownloading:           n = _L("Downloading"); break;
			case CBBFeedItem::EMediaDownloaded:       n = _L("Downloaded"); break; // NOT USED 
			case CBBFeedItem::EDownloadErrorRetrying: n = _L("Download error. Retrying"); break;
			case CBBFeedItem::EDownloadErrorFailed:   n = _L("Download failed"); break;
			case CBBFeedItem::EDownloadPausedOffline: n = _L("Download paused: Offline"); break;
			case CBBFeedItem::EDownloadPausedNotConnecting: n = _L("Download paused: Not connecting"); break;
			default:                                  n = _L("Unknown"); break;
			}

		TBool hasError = 
			state == CBBFeedItem::EDownloadErrorRetrying ||
			state == CBBFeedItem::EDownloadErrorFailed;
		
		if ( aItem.iErrorInfo )
			{
				TBuf<200> msg;
				msg.Append(n);
				msg.Append( _L(":\n") );
				//msg.Append( _L(": ") );
				CBBString* s = aItem.iErrorInfo->iUserMsg;
				if ( s )
					SafeAppend(msg, s->Value() );
				else
					SafeAppend(msg, _L("Unknown error"));
				
				// #ifdef __DEV__
				// User and technical messages are equivalent
				// 				s = aItem.iErrorInfo->iTechnicalMsg;
				// 				if ( s )
				// 					{
				// 						SafeAppend(msg, _L("\nDEV:"));
				// 						SafeAppend(msg, s->Value() );
				// 					}
				// #endif // __DEV__
				iState->UpdateTextL(msg);
				return ETrue;
			}
		else
			{
				iState->UpdateTextL(n);
				return EFalse;
			}
	}