Compare commits

...

27 Commits

Author SHA1 Message Date
Ian Brun
223881eae3
Merge pull request #173 from meekee7/video-options
Repair resolution selection & add window mode selection
2021-08-29 18:32:52 +02:00
Michael
e24bb62b5b uiwnd.h: react to windowposchanged window message 2021-08-29 13:43:11 +02:00
Michael
62f3947931 uiwnd.cpp: react to windowposchanged window message 2021-08-29 13:42:48 +02:00
Michael
80b8977f73 uidlgs.cpp: move UI element repositioning to handling of windowposchanged window message 2021-08-29 13:42:27 +02:00
Michael
6c5fdd665e mainwnd.cpp: react to windowposchanged window message 2021-08-29 13:41:36 +02:00
Michael
bbe72506c2 trespass/main.h: react to windowposchanged window message 2021-08-29 13:41:02 +02:00
Michael
8c8f17f171 main.cpp: resize window after showing CConfigureWnd 2021-08-28 14:29:16 +02:00
Michael
48b6b6c90d dlgrender.cpp: scroll to active resolution when render menu is opened 2021-08-28 13:28:14 +02:00
Michael
10923b14f8 Trespass/main.cpp: remove filtering of high display resolutions 2021-08-28 13:21:46 +02:00
Michael
a11a6ac711 View/Video.cpp: remove filtering of high display resolutions
- remove filtering of 16bit screen modes
2021-08-28 13:21:04 +02:00
Michael
9e5227af5e View/Video.hpp: remove filtering of high display resolutions 2021-08-28 13:19:45 +02:00
Michael
fee7df9701 ctrls.cpp: add CUIListbox::ScrollToActive 2021-08-28 13:03:42 +02:00
Michael
39f64dc697 ctrls.h: add CUIListbox::ScrollToActive 2021-08-28 13:03:19 +02:00
Michael
2591beeee1 uidlgs.cpp: reset window if resolution was changed in video options 2021-08-28 13:02:02 +02:00
Michael
410cc17e0f trespass.rc: add dropdown box for window mode selection to video settings menu
- replace help text in video settings menu
2021-08-14 23:01:55 +02:00
Michael
50901fd256 trespass/main.h: add support for window mode selection 2021-08-14 23:00:24 +02:00
Michael
8347b2c66e dlgrender.cpp: add support for window mode selection 2021-08-14 22:59:40 +02:00
Michael
bbd5e83c87 trespass/resource.h: add IDC_COMBO_WINDOWMODE 2021-08-14 22:58:14 +02:00
Michael
0497f93130 DDDevice.cpp: relax resolution filter conditions, filter below 640x480 2021-08-14 22:56:56 +02:00
Michael
6117334a64 trespass/main.cpp: replace GetWindowModeConfigured with GetWindowModeActive 2021-08-14 22:55:57 +02:00
Michael
c3b01fc54a supportfn.cpp: replace GetWindowModeConfigured with GetWindowModeActive 2021-08-14 22:54:31 +02:00
Michael
b5e1fe531e RasterVid.cpp: replace GetWindowModeConfigured with GetWindowModeActive 2021-08-14 22:53:56 +02:00
Michael
a29d29911c DisplayMode.hpp: add SetWindowModeConfigured and GetWindowModeActive 2021-08-14 22:46:27 +02:00
Michael
fbe473067e DisplayMode.cpp: add SetWindowModeConfigured and GetWindowModeActive 2021-08-14 22:46:00 +02:00
Michael
25a6277599 mainwnd.cpp: add missing nullptr checks 2021-08-14 22:20:09 +02:00
Michael
51ad6fd46a ColourBase.cpp: add missing nullptr check 2021-08-14 22:19:02 +02:00
meekee7
d502b39700
Merge pull request #39 from OpenTrespasser/dev
Merge upstream/dev into staging
2021-07-31 15:51:21 +02:00
19 changed files with 125 additions and 55 deletions

View File

@ -286,6 +286,8 @@ CProfileStat psCluts/*("Cluts", &proProfile.psMain)*/;
{
Assert(ppal);
Assert(pmat);
if (!ppal)
return nullptr;
//
// Search for palette & material in the array.

View File

@ -10,6 +10,19 @@ WindowMode GetWindowModeConfigured()
return static_cast<WindowMode>(selection);
}
void SetWindowModeConfigured(WindowMode mode)
{
int value = static_cast<int>(mode);
if (value >= 0 && value <= static_cast<int>(WindowMode::EXCLUSIVE))
SetRegValue("WindowMode", value);
}
WindowMode GetWindowModeActive()
{
static WindowMode active = GetWindowModeConfigured();
return active;
}
int GetSystemBitDepth(HWND wnd)
{
return GetSystemBitDepth(GetDC(wnd));

View File

@ -10,6 +10,8 @@ enum class WindowMode {
};
WindowMode GetWindowModeConfigured();
void SetWindowModeConfigured(WindowMode mode);
WindowMode GetWindowModeActive();
int GetSystemBitDepth(HWND wnd);
int GetSystemBitDepth(HDC dc);

View File

@ -126,7 +126,6 @@ namespace Video
//
void EnumerateDisplayModes
(
bool b_highres = true // Enables the enumeration of screen modes higher than 640x480.
);
//
// Enumerates screen resolutions, and stores the results in 'ascrmdList.'

View File

@ -334,11 +334,11 @@ private:
Assert(bWithin(i_buffers, 1, 3));
iBuffers = i_buffers;
bFullScreen = i_bits != 0 && GetWindowModeConfigured() != WindowMode::FRAMED;
bFullScreen = i_bits != 0 && GetWindowModeActive() != WindowMode::FRAMED;
iWidthFront = i_width;
iHeightFront = i_height;
if (i_bits && GetWindowModeConfigured() == WindowMode::EXCLUSIVE)
if (i_bits && GetWindowModeActive() == WindowMode::EXCLUSIVE)
{
// Go fullscreen. We need to call 2 DD functions to do this.
DirectDraw::err = DirectDraw::pdd4->SetCooperativeLevel(hwnd,
@ -1321,7 +1321,7 @@ rptr<CRaster> prasReadBMP(const char* str_bitmap_name, bool b_vid)
// Return to Windows screen if necessary.
if (DirectDraw::pdd4)
{
if (GetWindowModeConfigured() == WindowMode::EXCLUSIVE)
if (GetWindowModeActive() == WindowMode::EXCLUSIVE)
DirectDraw::err = DirectDraw::pdd4->RestoreDisplayMode();
DirectDraw::err = DirectDraw::pdd4->SetCooperativeLevel(0, DDSCL_NORMAL);
}
@ -1735,7 +1735,7 @@ rptr<CRaster> prasReadBMP(const char* str_bitmap_name, bool b_vid)
//******************************************************************************************
bool CRasterWin::CPriv::bConstructD3D(HWND hwnd, int i_width, int i_height, int i_bits, bool force16Bit)
{
if (GetWindowModeConfigured() == WindowMode::EXCLUSIVE)
if (GetWindowModeActive() == WindowMode::EXCLUSIVE)
return bConstructD3DExclusive(hwnd, i_width, i_height, i_bits);
else
return bConstructD3DWindowed(hwnd, i_width, i_height, i_bits, force16Bit);

View File

@ -81,7 +81,6 @@ namespace Video
int iTotalVideoMemory;
SScreenMode ascrmdList[iMAX_MODES];
int iModes;
bool bEnumHighResolutions = true;
//
// Functions needed by CInitVideo.
@ -98,10 +97,6 @@ namespace Video
//
//**********************************
{
// We now only support 16-bit rendering.
if (i_bits != 16)
return;
// Search list to see if already there.
for (int i = 0; i < iModes; i++)
{
@ -136,10 +131,6 @@ namespace Video
//
//**********************************
{
if (!bEnumHighResolutions)
if (pddsd->dwWidth > 800)
return DDENUMRET_OK;
// Suppress resolutions if required.
if (bSuppress512x384 && pddsd->dwWidth == 512)
return DDENUMRET_OK;
@ -179,7 +170,7 @@ namespace Video
//******************************************************************************************
//
void EnumerateDisplayModes(bool b_highres)
void EnumerateDisplayModes()
//
// Generate the list of available display modes. Store it sorted in ascrmdList.
//
@ -194,7 +185,6 @@ namespace Video
//**********************************
{
CDDSize<DDCAPS> ddcaps_hw, ddcaps_sw;
bEnumHighResolutions = b_highres;
EVideoCard evc;
// Get the video card type.

View File

@ -216,16 +216,8 @@ static HRESULT CALLBACK EnumDisplayMode
assert(pddsd);
assert(pv_context);
// If the mode is not 16 bits, ignore it.
if (pddsd->ddpfPixelFormat.dwRGBBitCount != 16)
return DDENUMRET_OK;
// Suppress resolutions if required.
if (bSuppress512 && pddsd->dwWidth == 512)
return DDENUMRET_OK;
// Do not enumerate screen resolutions higher than 640x480.
if (pddsd->dwWidth > 800)
// Do not enumerate screen resolutions lower than 640x480.
if (pddsd->dwWidth < 640 || pddsd->dwHeight < 480)
return DDENUMRET_OK;
// Get the next available element.

View File

@ -1440,6 +1440,15 @@ BOOL CUIListbox::SetFont(HFONT hfont)
return TRUE;
}
void CUIListbox::ScrollToActive()
{
if (m_iCurrSel != -1 && m_iCurrSel < m_vInfo.size())
{
m_iTop = m_iCurrSel;
m_bUpdate = true;
}
}
BOOL CUIListbox::InitSurface()
{
int iWidth;

View File

@ -270,7 +270,9 @@ public:
virtual BOOL GetFontSize() { return m_bFontSize;}
virtual void SetFontSize(BOOL bFontSize) { m_bFontSize = bFontSize; m_bUpdate = TRUE;}
void ScrollToActive();
private:
std::vector<CUILISTBOXINFO> m_vInfo;

View File

@ -28,6 +28,7 @@
#include "../Lib/Sys/RegInit.hpp"
#include "DDDevice.hpp"
#include "Lib/Std/MemLimits.hpp"
#include "Lib/View/DisplayMode.hpp"
//
@ -92,6 +93,7 @@ BOOL CConfigureWnd::OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
m_hwndResolutions = GetDlgItem(m_hwnd, IDC_COMBO_RESOLUTION);
m_hwndTextureSizes = GetDlgItem(m_hwnd, IDC_COMBO_TEXTURESIZE);
m_hwndWindowModes = GetDlgItem(m_hwnd, IDC_COMBO_WINDOWMODE);
m_hwndList = GetDlgItem(m_hwnd, IDC_LIST_CARD);
InitializeCardSelection();
@ -245,6 +247,16 @@ void CConfigureWnd::InitializeTextureSizes()
ComboBox_SetCurSel(m_hwndTextureSizes, i_sel);
}
void CConfigureWnd::InitializeWindowModes()
{
ComboBox_ResetContent(m_hwndWindowModes);
ComboBox_AddString(m_hwndWindowModes, "Window");
ComboBox_AddString(m_hwndWindowModes, "Borderless Window");
ComboBox_AddString(m_hwndWindowModes, "Exclusive Fullscreen");
int selected = static_cast<int>(GetWindowModeConfigured()) - 1;
ComboBox_SetCurSel(m_hwndWindowModes, selected);
}
void CConfigureWnd::InitializeCardSelection()
{
@ -338,6 +350,7 @@ void CConfigureWnd::OnSelchangeListCard()
// Set up the resolution combo box.
InitializeResolutions();
InitializeTextureSizes();
InitializeWindowModes();
// Set up dither check box.
CheckDlgButton(m_hwnd, IDC_CHECK_DITHER, (bGetDither()) ? (BST_CHECKED) : (BST_UNCHECKED));
@ -410,12 +423,15 @@ void CConfigureWnd::OnOK()
// Set the dither flag.
SetDither(IsDlgButtonChecked(m_hwnd, IDC_CHECK_DITHER));
int selectedWindowMode = ComboBox_GetCurSel(m_hwndWindowModes);
SetWindowModeConfigured(static_cast<WindowMode>(selectedWindowMode + 1));
// Close the registry and exit.
CMultiDlg::OnOK();
// Remove the device enumeration object.
delete penumdevDevices;
penumdevDevices = 0;
penumdevDevices = nullptr;
//exit(0);
}
@ -755,6 +771,7 @@ void CRenderWnd::SelectCurrentResolution()
}
plistbox->SetCurrSel(i);
plistbox->ScrollToActive();
}

View File

@ -455,7 +455,7 @@ int DoWinMain(HINSTANCE hInstance,
return -1;
}
if ( !IsDisplayConfigurationValid( GetSystemBitDepth(g_hwnd), bGetD3D(), GetWindowModeConfigured()))
if ( !IsDisplayConfigurationValid( GetSystemBitDepth(g_hwnd), bGetD3D(), GetWindowModeActive()))
{
if (MsgDlg(g_hwnd,
MB_YESNOCANCEL | MB_SETFOREGROUND,
@ -538,6 +538,14 @@ DoRestartWithRenderDlg:
dlg.MultiDialogBox(g_hInst, MAKEINTRESOURCE(IDD_INITIALIZATION), g_hwnd);
g_pMainWnd->m_bRelaunch = true;
bVideoCardChosen = true;
int windowWidth = 0;
int windowHeight = 0;
if (bGetDimensions(windowWidth, windowHeight))
{
SetWindowPos(g_hwnd, NULL, -1, -1, windowWidth, windowHeight,
SWP_NOMOVE | SWP_NOREDRAW | SWP_NOZORDER);
}
}
EnableMenuItem(GetSystemMenu(g_hwnd, FALSE),
@ -623,7 +631,7 @@ DoRestartWithRenderDlg:
}
}
Video::EnumerateDisplayModes(false);
Video::EnumerateDisplayModes();
//
// If safe mode is not active, set some defaults that depend on the CPU speed.
@ -912,7 +920,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
bGetDimensions(windowWidth, windowHeight);
DWORD style = WS_VISIBLE | WS_POPUP | WS_SYSMENU;
if (GetWindowModeConfigured() == WindowMode::FRAMED)
if (GetWindowModeActive() == WindowMode::FRAMED)
style |= WS_OVERLAPPEDWINDOW;
if (!CreateWindowEx(0,

View File

@ -78,6 +78,7 @@ public:
void OnPaint(HWND hwnd);
void OnTimer(HWND hwnd, UINT id);
void OnSysCommand(HWND hwnd, UINT cmd, int x, int y);
void OnWindowPosChanged(HWND hwnd, LPWINDOWPOS pos);
void GameLoop();
void CopyrightScreen();
@ -105,10 +106,12 @@ private:
HWND m_hwndD3DDriver;
HWND m_hwndList;
HWND m_hwndTextureSizes;
HWND m_hwndWindowModes;
void InitializeCardSelection();
void InitializeResolutions();
void InitializeTextureSizes();
void InitializeWindowModes();
void OnSelchangeListCard();
};

View File

@ -170,7 +170,7 @@ void CMainWnd::OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
void CMainWnd::OnKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags)
{
CUIWnd * puiwnd;
CUIWnd* puiwnd = nullptr;
if (vk == VK_SNAPSHOT)
{
@ -180,7 +180,8 @@ void CMainWnd::OnKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags)
return;
}
puiwnd = m_pUIMgr->GetActiveUIWnd();
if (m_pUIMgr)
puiwnd = m_pUIMgr->GetActiveUIWnd();
if (puiwnd && !puiwnd->m_bExitWnd)
{
puiwnd->OnKey(vk, fDown, cRepeat, flags);
@ -191,9 +192,10 @@ void CMainWnd::OnKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags)
void CMainWnd::OnChar(HWND hwnd, TCHAR ch, int cRepeat)
{
CUIWnd * puiwnd;
CUIWnd* puiwnd = nullptr;
puiwnd = m_pUIMgr->GetActiveUIWnd();
if (m_pUIMgr)
puiwnd = m_pUIMgr->GetActiveUIWnd();
if (puiwnd && !puiwnd->m_bExitWnd)
{
puiwnd->OnChar(ch, cRepeat);
@ -336,6 +338,15 @@ void CMainWnd::OnSysCommand(HWND hwnd, UINT cmd, int x, int y)
}
}
void CMainWnd::OnWindowPosChanged(HWND hwnd, LPWINDOWPOS pos)
{
if (!m_pUIMgr)
return;
auto* puiwnd = m_pUIMgr->GetActiveUIWnd();
if (puiwnd)
puiwnd->OnWindowPosChanged();
}
void CMainWnd::SendActivate(BOOL fActivate, DWORD dwThreadId)
@ -420,7 +431,7 @@ void CMainWnd::OnActivateApp(HWND hwnd, BOOL fActivate, DWORD dwThreadId)
m_pUIMgr->m_bPause = FALSE;
if (prasMainScreen && GetWindowModeConfigured() == WindowMode::EXCLUSIVE)
if (prasMainScreen && GetWindowModeActive() == WindowMode::EXCLUSIVE)
{
SetRect(&rc,
0,
@ -743,6 +754,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
HANDLE_MSG(hwnd, WM_MBUTTONDOWN, g_pMainWnd->OnMButtonDown);
HANDLE_MSG(hwnd, WM_TIMER, g_pMainWnd->OnTimer);
HANDLE_MSG(hwnd, WM_SYSCOMMAND, g_pMainWnd->OnSysCommand);
HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGED, g_pMainWnd->OnWindowPosChanged);
}
return DefWindowProc(hwnd, uiMsg, wParam, lParam);

View File

@ -80,6 +80,7 @@
#define IDC_COMBO_TEXTURESIZE 1005
#define IDC_STATIC_SIZES 1006
#define IDC_COMBO_D3D 1006
#define IDC_COMBO_WINDOWMODE 1006
#define IDC_STATIC_BOX 1007
#define IDC_D3D 1008
#define IDC_LIST_CARD 1008
@ -132,7 +133,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 122
#define _APS_NEXT_RESOURCE_VALUE 123
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1039
#define _APS_NEXT_SYMED_VALUE 105

View File

@ -948,7 +948,7 @@ void SetupGameScreen()
bGetDimensions(iWindowWidth, iWindowHeight);
if (GetWindowModeConfigured() == WindowMode::FRAMED)
if (GetWindowModeActive() == WindowMode::FRAMED)
{
POINT clientsize = GetCurrentClientSize();
iClientWidth = clientsize.x;

View File

@ -70,7 +70,7 @@ IDB_DEF_PAL BITMAP DISCARDABLE "res\\smallPal.bmp"
// Dialog
//
IDD_INITIALIZATION DIALOG DISCARDABLE 0, 0, 272, 185
IDD_INITIALIZATION DIALOG DISCARDABLE 0, 0, 292, 225
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
CAPTION "Trespasser 3D Video Driver Setup"
@ -78,31 +78,34 @@ FONT 8, "MS Sans Serif"
BEGIN
LISTBOX IDC_LIST_CARD,16,24,142,52,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_RESOLUTION,184,24,72,78,CBS_DROPDOWNLIST |
COMBOBOX IDC_COMBO_RESOLUTION,184,24,85,78,CBS_DROPDOWNLIST |
CBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,7,131,48,18
PUSHBUTTON "Cancel",IDCANCEL,63,131,48,18
GROUPBOX "Screen Resolution",IDC_STATIC,176,8,88,36
DEFPUSHBUTTON "OK",IDOK,7,165,48,18
PUSHBUTTON "Cancel",IDCANCEL,63,165,48,18
GROUPBOX "Screen Resolution",IDC_STATIC,176,8,103,36
LTEXT "Unknown",IDC_STATIC_D3D,77,93,78,15
GROUPBOX "Select 3D Video Driver",IDC_STATIC,5,8,163,113
LTEXT "Error",IDC_STATIC_VIDEODRIVER,77,83,78,8
RTEXT "3D Driver Name:",IDC_STATIC,17,83,56,8
RTEXT "Description:",IDC_STATIC,33,92,40,8
GROUPBOX "Features",IDC_STATIC,176,88,88,65
GROUPBOX "Features",IDC_STATIC,176,128,103,65
CONTROL "Hardware Water",IDC_CHECK_HARDWAREWATER,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,184,100,68,10
COMBOBOX IDC_COMBO_TEXTURESIZE,184,64,72,78,CBS_DROPDOWN |
BS_AUTOCHECKBOX | WS_TABSTOP,184,140,68,10
COMBOBOX IDC_COMBO_TEXTURESIZE,184,64,85,78,CBS_DROPDOWN |
CBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Texture Resolution",IDC_STATIC,176,48,88,36
PUSHBUTTON "Help",IDHELP,119,131,48,18
GROUPBOX "Texture Resolution",IDC_STATIC,176,48,103,36
PUSHBUTTON "Help",IDHELP,119,165,48,18
CONTROL "Triple Buffer",IDC_CHECK_TRIPLEBUFFER,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,184,112,54,10
CTEXT "For notes on maximizing performance on hardware, click on the 'Help' button and view the hardware section in the 'Readme.txt' file.",
IDC_STATIC,8,160,253,17
BS_AUTOCHECKBOX | WS_TABSTOP,184,152,54,10
CTEXT "Applying changes to window mode requires a game restart.",
IDC_STATIC,7,200,268,17
CONTROL "Dither",IDC_CHECK_DITHER,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,184,124,35,10
WS_TABSTOP,184,164,35,10
CONTROL "Page Manager",IDC_CHECK_PAGEMANAGED,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,184,136,63,10
BS_AUTOCHECKBOX | WS_TABSTOP,184,176,63,10
GROUPBOX "Window Mode",IDC_STATIC,176,88,103,36
COMBOBOX IDC_COMBO_WINDOWMODE,184,104,85,78,CBS_DROPDOWN |
CBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
END
IDD_DXERROR DIALOG DISCARDABLE 0, 0, 252, 101
@ -132,9 +135,9 @@ BEGIN
IDD_INITIALIZATION, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 265
RIGHTMARGIN, 285
TOPMARGIN, 7
BOTTOMMARGIN, 178
BOTTOMMARGIN, 218
END
IDD_DXERROR, DIALOG

View File

@ -1083,6 +1083,10 @@ void COptionsWnd::UIButtonUp(CUIButton * pbutton)
if (dlg.m_dwExitValue != 0)
{
EndUIWnd(dlg.m_dwExitValue);
if (dlg.m_dwExitValue == 2)
{
g_CTPassGlobals.ResetScreen();
}
}
}
break;

View File

@ -569,6 +569,18 @@ void CUIWnd::ResizeScreen(int iWidth, int iHeight)
}
void CUIWnd::OnWindowPosChanged()
{
if (!m_pUIMgr)
return;
for (auto* wnd : m_pUIMgr->m_vUIWnd)
{
if (wnd)
CenterUIWindow(wnd);
}
}
void CUIWnd::DrawIntoSurface(LPBYTE pbDst,
int iDstWidth,
int iDstHeight,

View File

@ -151,6 +151,7 @@ public:
virtual void OnTimer(UINT uiID);
virtual void OnPaint(HWND hwnd);
virtual BOOL OnEraseBkgnd(HWND hwnd, HDC hdc);
virtual void OnWindowPosChanged();
};