C++无法创建放大镜窗口

发布于 2025-01-26 19:03:49 字数 626 浏览 1 评论 0原文

我试图制定放大程序,但是如果没有错误1407,我无法创建子窗口,子窗口也使主机Windows GUI消失了。

hwnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TRANSPARENT | WS_EX_LAYERED, wc.lpszClassName, skCrypt(_T("magnifier")), WS_POPUP | WS_CLIPCHILDREN, rect.left, rect.top, widthh, heightt, nullptr, nullptr, NULL, nullptr);
    
RegisterClassEx(&wc2);
    magHwnd = CreateWindow(WC_MAGNIFIER, "a", WS_VISIBLE | WS_CHILD, 250, 250, 250, 250, hwnd, NULL, wc2.hInstance, NULL);
    if (!magHwnd) {
        MessageBox(NULL, std::to_string(GetLastError()).c_str(), "Window Creation", MB_OK);
    }

编辑:第二个createWindow函数有效,直到我添加wc_magnifier标志

Im trying to make a magnification program, but I cannot create the child window without the error 1407, The child window also makes the host windows gui disappear.

hwnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TRANSPARENT | WS_EX_LAYERED, wc.lpszClassName, skCrypt(_T("magnifier")), WS_POPUP | WS_CLIPCHILDREN, rect.left, rect.top, widthh, heightt, nullptr, nullptr, NULL, nullptr);
    
RegisterClassEx(&wc2);
    magHwnd = CreateWindow(WC_MAGNIFIER, "a", WS_VISIBLE | WS_CHILD, 250, 250, 250, 250, hwnd, NULL, wc2.hInstance, NULL);
    if (!magHwnd) {
        MessageBox(NULL, std::to_string(GetLastError()).c_str(), "Window Creation", MB_OK);
    }

EDIT: the second CreateWindow function works until i add the WC_MAGNIFIER flag

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

糖果控 2025-02-02 19:03:49

感谢帮助我解决这个问题的人。
我通过将WC2中的className更改为“放大镜”来解决此问题

Thank you to the people that helped me fix this.
I fixed this by changing the classname in wc2 to "Magnifier"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文