Solved

Background Bitmap in CMDIFrameWnd

Posted on 1998-03-15
2
252 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 50 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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…
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

679 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