WindowBase::WindowBase(tstring Name, int Width, int Height, WindowType style, bool consider_frame) : param(new Param(Name, Width, Height)) { if(!initWindowClass()) throw std::runtime_error("ウィンドウの登録に失敗しました"); if(!initWindowInstance(style, consider_frame)) throw std::runtime_error("ウィンドウ作成に失敗しました"); //自身のハンドルをプロパティに追加 //::SetProp(m_hWnd, L"THIS_PTR", static_cast<HANDLE>(this)); ::SetWindowLongPtr(param->hWnd, GWLP_USERDATA, (LONG_PTR)this); }
//----------------------------------------------------------------------------- Win32Frame::Win32Frame (IPlatformFrameCallback* frame, const CRect& size, HWND parent) : IPlatformFrame (frame) , windowHandle (0) , parentWindow (parent) , tooltipWindow (0) , backBuffer (0) , deviceContext (0) , inPaint (false) , mouseInside (false) , updateRegionList (0) , updateRegionListSize (0) { initWindowClass (); DWORD style = isParentLayered (parent) ? WS_EX_TRANSPARENT : 0; #if !DEBUG_DRAWING if (getD2DFactory ()) // workaround for Direct2D hotfix (KB2028560) { // when WS_EX_COMPOSITED is set drawing does not work correctly. This seems like a bug in Direct2D wich happens with this hotfix } else if (getSystemVersion ().dwMajorVersion >= 6) // Vista and above style |= WS_EX_COMPOSITED; else backBuffer = createOffscreenContext (size.getWidth (), size.getHeight ()); #endif windowHandle = CreateWindowEx (style, gClassName, TEXT("Window"), WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, 0, (int)size.width (), (int)size.height (), parentWindow, NULL, GetInstance (), NULL); if (windowHandle) { SetWindowLongPtr (windowHandle, GWLP_USERDATA, (__int3264)(LONG_PTR)this); RegisterDragDrop (windowHandle, new CDropTarget (this)); } }