Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I'm 'casting' the screen of
window1
to
window2
using the WINAPI
DwmRegisterThumbnail
but as soon I set the
window2
child of another window the image
disappears
.
After reading the docs I found this mention:
Setting the destination window handle to anything other than a
top-level window type will result in a return value of E_INVALIDARG.
HWND dest = (HWND)this->winId();
HWND source = ...
hr = DwmRegisterThumbnail(dest, source, &thumbnail_id);
DWORD err = GetLastError();
qDebug() << "hr: " << hr;
if (SUCCEEDED(hr) && NULL != thumbnail_id)
prop.dwFlags = DWM_TNP_RECTDESTINATION | DWM_TNP_RECTSOURCE | DWM_TNP_OPACITY
| DWM_TNP_VISIBLE | DWM_TNP_SOURCECLIENTAREAONLY;
prop.rcSource = { 0, 0, 1200, 600 };
prop.rcDestination = { 0, 0, 1200, 600 };
prop.opacity = 255;
prop.fVisible = TRUE;
prop.fSourceClientAreaOnly = FALSE;
hr = DwmUpdateThumbnailProperties(thumbnail_id, &prop);
qDebug() << "hr: " << hr;
I also tried using a QDockWidget but the image is visible only when the widget is not docked to the MainWindow
, as soon I dock the widget, the image disappears, sad.
There's something else I could try to be able to 'cast' the image to a child window?
or maybe another winapi I could use?
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.