我赢了7x64,看起来对我很管用。不管怎样,你可以在这里发布一些小片段,也许它会为你的问题提供一些线索。
class CMainWindow : public CWindowImpl<CMainWindow, CWindow, CFrameWinTraits>
{
public:
DECLARE_WND_SUPERCLASS(_T("CMainWindow"), CWindow::GetWndClassName())
BEGIN_MSG_MAP(CMainWindow)
MSG_WM_SIZE(OnSize)
MSG_WM_TIMER(OnTimer)
END_MSG_MAP();
VOID OnSize(UINT, CSize)
{
m_timerId = SetTimer((UINT_PTR)this, 100);
}
VOID OnTimer(UINT_PTR)
{
KillTimer(m_timerId);
CDCHandle dc = GetDC();
Draw(dc);
}
VOID Draw(HDC hDC)
{
CDCHandle dc(hDC);
CRect objClientRect;
GetClientRect(objClientRect);
dc.FillSolidRect(objClientRect, RGB(0, 255, 0));
}
private:
UINT_PTR m_timerId;
};
int main(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
{
_Module.Init(0, hInstance, 0);
CMainWindow wnd;
wnd.Create(NULL, CWindow::rcDefault, _T("Hello world"));
wnd.ShowWindow(SW_SHOW);
CMessageLoop loop;
_Module.AddMessageLoop(&loop);
int res = loop.Run();
_Module.Term();
return 0;
}