/**
 Utility to close the dialogs once the screen has been compared
 with a previous capture of an expected display.
 */	
void CConeErrorMsgTestAppUi::CloseDialogsL()
	{	
	User::LeaveIfError(iWs.Connect());
	TInt wgFocus = iWs.GetFocusWindowGroup();

	const TUint32 ENullWsHandle = 0xFFFFFFFF;	// Events delivered to this handle are thrown away
	RWindowGroup wg = RWindowGroup(iWs);

	wg.Construct(ENullWsHandle);
	TInt wgId = wg.Identifier();

	TWsEvent event;
	event.SetType(EEventKey);
	TKeyEvent *keyEvent = event.Key();
	keyEvent->iCode = EKeyEscape;
	keyEvent->iScanCode = EStdKeyEscape;
	keyEvent->iModifiers = 0;

	TInt limit = 0;
	for(limit = 0; wgFocus != wgId && (limit < 50); limit++)
		{
		iWs.SendEventToAllWindowGroups(event);
		wgFocus = iWs.GetFocusWindowGroup();
		RDebug::Print(_L("CloseAllPanicWindowsL() - EKeyEscape sent to Windows Group"));
		}

	wg.Close();
	iWs.Close();
	}
	~CSplashScreenImpl() {
		iWg.Close();
		delete iBitmap;
	}