How to realize hiding my app while sharing screen
Solved
General and Desktop
-
Finally I find a way to do that in Windows.
#pragma once #include <windows.h> #include "frameless_dialog.h" /** * @brief 防止被截图的无边框对话框 * setResizeable(true)启用手动调整大小,setContentRemovable(true)启用内容区域可拖动 */ class FramelessQDialogAntiCapture : public FramelessQDialog { public: FramelessQDialogAntiCapture(QWidget* parent = nullptr) : FramelessQDialog(parent) { SetWindowDisplayAffinity((HWND)(this->winId()), WDA_EXCLUDEFROMCAPTURE); } protected: virtual void showEvent(QShowEvent *e) override{ SetWindowDisplayAffinity((HWND)(this->winId()), WDA_EXCLUDEFROMCAPTURE); FramelessQDialog::showEvent(e); } virtual void hideEvent(QHideEvent *e) override{ SetWindowDisplayAffinity((HWND)(this->winId()), WDA_NONE); FramelessQDialog::hideEvent(e); } };
-
-
no. RFB protocol simply copies the screen image memory to the other end as-is. RDP may have some facility to restrict what gets copied but that is well beyond the scope of this forum to discuss.
-
Finally I find a way to do that in Windows.
#pragma once #include <windows.h> #include "frameless_dialog.h" /** * @brief 防止被截图的无边框对话框 * setResizeable(true)启用手动调整大小,setContentRemovable(true)启用内容区域可拖动 */ class FramelessQDialogAntiCapture : public FramelessQDialog { public: FramelessQDialogAntiCapture(QWidget* parent = nullptr) : FramelessQDialog(parent) { SetWindowDisplayAffinity((HWND)(this->winId()), WDA_EXCLUDEFROMCAPTURE); } protected: virtual void showEvent(QShowEvent *e) override{ SetWindowDisplayAffinity((HWND)(this->winId()), WDA_EXCLUDEFROMCAPTURE); FramelessQDialog::showEvent(e); } virtual void hideEvent(QHideEvent *e) override{ SetWindowDisplayAffinity((HWND)(this->winId()), WDA_NONE); FramelessQDialog::hideEvent(e); } };