Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Background Bitmap in CMDIFrameWnd

Posted on 1998-03-15
2
Medium Priority
?
268 Views
Last Modified: 2013-11-20
How do I display a bitmap, or pattern in the frame window of an MDI application? I would like to display a logo etc when no Child windows are open.
0
Comment
Question by:cjs
2 Comments
 

Accepted Solution

by:
scroll0 earned 200 total points
ID: 1316996
        //MainFrm.h
            CBitmapClient m_wndClient;
         //MainFrm.cpp
         //OnCreate(LPCREATESTRUCT lpCreateStruct)
      if(!m_wndClient.SubclassWindow(m_hWndMDIClient))
      {
            TRACE("Failed Load BitMap");
            return -1;
      }


//CBitmapClient Haeder File
// BitmapClient.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CBitmapClient window
class CBitmapClient : public CWnd
{
// Construction
public:
      CBitmapClient();

// Attributes
public:

// Operations
public:

// Overrides
      // ClassWizard generated virtual function overrides
      //{{AFX_VIRTUAL(CBitmapClient)
      //}}AFX_VIRTUAL

// Implementation
public:
      virtual ~CBitmapClient();

      // Generated message map functions
protected:
      //{{AFX_MSG(CBitmapClient)
      afx_msg void OnSize(UINT nType, int cx, int cy);
      afx_msg BOOL OnEraseBkgnd(CDC* pDC);
      afx_msg void OnMouseMove(UINT nFlags, CPoint point);
      afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
      //}}AFX_MSG
      DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

// BitmapClient.cpp : implementation file
//

#include "stdafx.h"
#include "ViewG.h"
#include "BitmapClient.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CBitmapClient

CBitmapClient::CBitmapClient()
{
}

CBitmapClient::~CBitmapClient()
{
}


BEGIN_MESSAGE_MAP(CBitmapClient, CWnd)
      //{{AFX_MSG_MAP(CBitmapClient)
      ON_WM_SIZE()
      ON_WM_ERASEBKGND()
      ON_WM_MOUSEMOVE()
      ON_WM_LBUTTONUP()
      //}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CBitmapClient message handlers

void CBitmapClient::OnSize(UINT nType, int cx, int cy)
{
      CWnd::OnSize(nType, cx, cy);
             
      RedrawWindow(NULL, NULL,
             RDW_INVALIDATE|RDW_ERASE|RDW_ERASENOW|RDW_ALLCHILDREN);    
      return ;  
}

BOOL CBitmapClient::OnEraseBkgnd(CDC* pDC)
{
      CWnd::OnEraseBkgnd(pDC);
         //Here BitMap File Load
   return TRUE;
}


void CBitmapClient::OnMouseMove(UINT nFlags, CPoint point)
{
      // TODO: Add your message handler code here and/or call default
      CWnd::OnMouseMove(nFlags, point);
}

void CBitmapClient::OnLButtonUp(UINT nFlags, CPoint point)
{
      // TODO: Add your message handler code here and/or call default
      CWnd::OnLButtonUp(nFlags, point);
}


0
 

Author Comment

by:cjs
ID: 1316997
Thanks...


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question