繁体   English   中英

如何设置 OpenCV window 无顶栏,并在名称窗口后保持输入焦点在控制台?

[英]How to set OpenCV window no topbar , and keep input focus at console after namewindow?

我做了一个不使用鼠标修改工业相机参数的子程序。 我希望用户可以在控制台 window 中从键盘输入相机参数,并在名为“Viwer”的 OpenCV window 中查看当前情况(更改)。 另外,我希望用户不能通过点击顶部栏中的X来关闭window。用户只能通过输入“ESC”来关闭window。

所以,我试试这个:

int __GetAndSetModifyValue(CInstantCamera *camera)
{
  unsigned int flags = { SWP_SHOWWINDOW  };
  namedWindow("Viwer", WINDOW_AUTOSIZE);
  HWND win_handle = FindWindow(NULL, "Viwer");
  SetWindowLong(win_handle, GWL_STYLE, GetWindowLong(win_handle, GWL_EXSTYLE));
  while(true)
  {
    GetInput(input)....;
    if(input==esc) break;
    SetWindowPos(win_handle, HWND_BOTTOM, x, y, pictureWidth, pictureHeight, flags);
    ShowWindow(win_handle, SW_SHOW);}
    change camera(input)..... maybe error return
  }
return 0;
}

有两个问题:

(1)namewindow whill change the keyboard input focus from console window to OpenCV window,so i need to click consloe window after OpnenCV window show.How to keep the input focus at console?

(2) 实际上,我会继续使用 SetWindowPos(win_handle, HWND_BOTTOM, x, y, pictureWidth, pictureHeight, flags) 来保持 Viwer 与 pircutre 的大小相同。但这会让 Viwer 将 flash 保持在底部。 也许我应该尝试一些 function 像 resizewindow?

PS 我已经搜索了一些解决方案,例如 GetConsoleWindow。它实际上是如何工作的?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM