|Maybe you didn't get my phsyco babble but the previous code works perfectly as long the application is created manually using the method shown. The only portion of code that I'm trying to use is the code under "Virtual Window Stuff" the Create function in that is working fine if not I wouldn't get a window.
My problem is with App-Wizard generated MFC single document application. However I have a kind-of-solution but for what ever reason the background of the view goes black so I have to change the text color and text background. Not quite what I'm after yet.
Check out the code below it works quite well.
I think this is how it works;
A bitmsap is created to hold the content of the device context.
draw stuff is added to the bitmap in memory then pasted to the view when I call ShowIt().
I had to use a message handler or other function to create the "virtual window" (memory DC). The problem is It doesn't stick around like this I have try and keep everything in the bitmap and recreate the memory DC each time before I draw.
Source File Stuff
void Ccom_testView::OnLButtonDblClk(UINT nFlags, CPoint point)
maxX = GetSystemMetrics(SM_CXSCREEN);
maxY = GetSystemMetrics(SM_CYSCREEN);
if (m_bmp.m_hObject == NULL)
m_bmp.CreateCompatibleBitmap(&dc, maxX, maxY);
CBitmap* pOldBitmap = memDC.SelectObject(&m_bmp);
CBrush* pOldbkBrush = memDC.SelectObject(&bkBrush);
memDC.SetTextColor(RGB(0, 200, 100));
wsprintf(str, "Hello World");
memDC.TextOutA(point.x, point.y, str, strlen(str));
CBitmap* pbmOld = NULL;
pbmOld = memDC.SelectObject(&m_bmp);
dc.BitBlt(0, 0, maxX, maxY, &memDC, 0, 0, SRCCOPY);
Header File Stuff
class Ccom_testView : public CView
CFont m_SystemFont, m_AnsiVarFont;
Ccom_testDoc* GetDocument() const;
virtual void OnDraw(CDC* pDC);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnPaint();
Comments or suggestions would be great. Even better yet a better way to do it.
Thank you for your help.