void initialize(HWND hwnd, HDC hdc) { gDrawData.hDrawPen = CreatePen(PS_SOLID, 1, RGB(255, 0, 0)); gDrawData.maxBoundary.cx = GetSystemMetrics(SM_CXSCREEN); gDrawData.maxBoundary.cy = GetSystemMetrics(SM_CYSCREEN); createMemoryBitmap(hdc); setDrawMode(READY_MODE, hwnd); }
// Create the Windows window bool X11Wnd::createWindow(int x, int y, int w, int h) { // Return if the window already exists if (m_hWnd != 0) return false; // Create the window m_hWnd = ::CreateWindowEx(0,"X11Wnd","", WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,x,y,w,h, m_parentWnd->getHwnd(),0,X11App::getApp().getAppInstance(),NULL); if (m_hWnd == 0) return false; // Create a memory device context and bitmap m_dc = ::CreateCompatibleDC(::GetDC(m_hWnd)); createMemoryBitmap(); // Store in the map m_windowMap.insert(WindowMap::value_type(m_hWnd,this)); return true; }
void X11Wnd::onSize(void) { // Resize the memory bitmap createMemoryBitmap(); ::InvalidateRect(m_hWnd,NULL,FALSE); }