I have this code which should create a new red window and then print it. Except it only works when I include the CWsScreenDevice function SizeInPixels() after the gc->Clear() command. Everything seems to work as it should, except nothing is displayed on the screen. I am using this code with the Series 60 emulator under VC++ 6. Is it a compiler bug or something as SizeInPixels() has nothing to do with the creation or printing of the window.
wscheck = ws.Connect();
if (wscheck != KErrNone) return ERROR;
iScreenDevice = new(ELeave) CWsScreenDevice(ws);
wg = new RWindowGroup(ws);
wscheck = wg->Construct(reinterpret_cast<TUint32>(wg), EFalse);
wscheck = iScreenDevice->CreateContext(gc);
wscheck = window.Construct(*wg, reinterpret_cast<TUint32>(wg) + 1);
window.SetBackgroundColor(TRgb(0xFF, 0, 0));
window.SetExtent(TPoint(0, 0), ScreenSize);
//Only works when this command is included after gc->Clear()???