setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
LONG_PTR exstyle = ::GetWindowLongPtr(winId(), GWL_EXSTYLE);
::SetWindowLongPtr(winId(), GWL_EXSTYLE, exstyle | WS_EX_LAYERED | WS_EX_TOPMOST );
_axWidget = new FlashAxWidget(this, winId());
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
LONG_PTR exstyle = ::GetWindowLongPtr(winId(), GWL_EXSTYLE);
::SetWindowLongPtr(winId(), GWL_EXSTYLE, exstyle | WS_EX_LAYERED | WS_EX_TOPMOST );
_axWidget = new FlashAxWidget(this, winId());
To copy to clipboard, switch view to plain text mode
case WM_PAINT:
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
g_pAxWInstance->DispatchPaint(hwnd, hdc);
EndPaint(hwnd, &ps);
return 0L;
break;
case WM_PAINT:
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
g_pAxWInstance->DispatchPaint(hwnd, hdc);
EndPaint(hwnd, &ps);
return 0L;
break;
To copy to clipboard, switch view to plain text mode
void FlashAxWidget::DispatchPaint(HWND hwnd, HDC hdc)
{
RECT r;
::GetClientRect(hwnd, &r);
POINT p = {r.left, r.top};
POINT p0 = {0,0};
SIZE sz = {r.right - r.left, r.bottom - r.top};
HDC hdcScr = ::GetDC(0);
HDC _dcBackBuf = ::CreateCompatibleDC(hdcScr);
BYTE * pBits;
BITMAPINFOHEADER bmi = {0};
bmi.biSize = sizeof(BITMAPINFOHEADER);
bmi.biBitCount = 32;
bmi.biCompression = BI_RGB;
bmi.biPlanes = 1;
bmi.biWidth = sz.cx;
bmi.biHeight = -(sz.cy);
HBITMAP _hbmpBackBuf = ::CreateDIBSection(hdc, (BITMAPINFO*)&bmi, DIB_RGB_COLORS,
(void**)&pBits, 0, 0);
::SelectObject(_dcBackBuf, _hbmpBackBuf);
unsigned long cDIBits = sz.cx*sz.cy*4;
::RtlZeroMemory(pBits, cDIBits);
::OleDraw(_pIVO, DVASPECT_TRANSPARENT, _dcBackBuf, &r);
::UpdateLayeredWindow(parentWidget()->winId(), NULL, &p,
&sz, _dcBackBuf, &p0, 0, NULL, ULW_COLORKEY);
::DeleteDC(_dcBackBuf);
::DeleteObject(_hbmpBackBuf);
::ReleaseDC(GetDesktopWindow(), hdcScr);
}
void FlashAxWidget::DispatchPaint(HWND hwnd, HDC hdc)
{
RECT r;
::GetClientRect(hwnd, &r);
POINT p = {r.left, r.top};
POINT p0 = {0,0};
SIZE sz = {r.right - r.left, r.bottom - r.top};
HDC hdcScr = ::GetDC(0);
HDC _dcBackBuf = ::CreateCompatibleDC(hdcScr);
BYTE * pBits;
BITMAPINFOHEADER bmi = {0};
bmi.biSize = sizeof(BITMAPINFOHEADER);
bmi.biBitCount = 32;
bmi.biCompression = BI_RGB;
bmi.biPlanes = 1;
bmi.biWidth = sz.cx;
bmi.biHeight = -(sz.cy);
HBITMAP _hbmpBackBuf = ::CreateDIBSection(hdc, (BITMAPINFO*)&bmi, DIB_RGB_COLORS,
(void**)&pBits, 0, 0);
::SelectObject(_dcBackBuf, _hbmpBackBuf);
unsigned long cDIBits = sz.cx*sz.cy*4;
::RtlZeroMemory(pBits, cDIBits);
::OleDraw(_pIVO, DVASPECT_TRANSPARENT, _dcBackBuf, &r);
::UpdateLayeredWindow(parentWidget()->winId(), NULL, &p,
&sz, _dcBackBuf, &p0, 0, NULL, ULW_COLORKEY);
::DeleteDC(_dcBackBuf);
::DeleteObject(_hbmpBackBuf);
::ReleaseDC(GetDesktopWindow(), hdcScr);
}
To copy to clipboard, switch view to plain text mode
Bookmarks