当在MFC中应用opencv的窗口来显示图片。希望namedWindow创建的窗口能根据需要改变风格:

 

//by dongchunxiao


cv::namedWindow("windows1",0); //创建一个窗口
HWND hWnd = (HWND)cvGetWindowHandle("windows1");//获取子窗口的HWND
HWND hParentWnd = ::GetParent(hWnd);//获取父窗口HWND。父窗口是我们要用的

::SetWindowPos(hParentWnd,HWND_TOPMOST,100,1,500,500,SWP_NOSIZE | SWP_NOMOVE); //修改窗口为最顶部

//隐藏窗口标题栏
long style = GetWindowLong(hParentWnd,GWL_STYLE);
style &= ~(WS_CAPTION);
// style &= ~(WS_MAXIMIZEBOX);
SetWindowLong(hParentWnd,GWL_STYLE,style);

//改变窗口的位置和大小。这里主要前面的SetWindowPos不能改变位置和大小(为什么?)
::MoveWindow(hParentWnd,10,100,500,500,0);

相关文章:

  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2022-12-23
  • 2022-01-10
  • 2022-02-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
  • 2021-12-19
  • 2021-08-16
  • 2021-05-19
相关资源
相似解决方案