Re: Set the desktop back ground color
Are you talking about the gray color for the frame window of an MDI
application?
If so then you have to do a couple of things:
In your CMainFrame class
declare m_Client
private:
CClientWnd m_Client;
then:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext*
pContext)
{
if (CMDIFrameWnd::OnCreateClient(lpcs, pContext))
{
m_Client.SubclassWindow(m_hWndMDIClient);
return TRUE;
}
return FALSE;
}
And here is the implementation of CClientWnd
////////////////header file
#pragma once
// CClientWnd
class CClientWnd : public CWnd
{
DECLARE_DYNAMIC(CClientWnd)
public:
CClientWnd();
virtual ~CClientWnd();
protected:
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
DECLARE_MESSAGE_MAP()
};
///////////////cpp file
// ClientWnd.cpp : implementation file
//
#include "stdafx.h"
#include "MDIEditView.h"
#include "ClientWnd.h"
#include ".\clientwnd.h"
// CClientWnd
IMPLEMENT_DYNAMIC(CClientWnd, CWnd)
CClientWnd::CClientWnd()
{
}
CClientWnd::~CClientWnd()
{
}
BEGIN_MESSAGE_MAP(CClientWnd, CWnd)
ON_WM_ERASEBKGND()
END_MESSAGE_MAP()
// CClientWnd message handlers
BOOL CClientWnd::OnEraseBkgnd(CDC* pDC)
{
CRect Rect;
GetClientRect(&Rect);
pDC->FillSolidRect(&Rect,RGB(255,0,0));
return TRUE;
}
AliR.
"Michael Nielsen" <not@likely.dk> wrote in message
news:op.tqopk7dkx6hlge@vulture.vrml.aau.dk...
Hi, I want to change the desktop backgrouind color from my MFC program. I
tried doing it by setting the registry key, but then it requires reboot.
How do I tell windows to look up the new color after I changed it?
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/