Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV and MFC - strange behaviour of cvGetWindowHandler on 32-bit and 64-bit

I have a MFC project in Microsoft Visual Studi 2010. In my dialog I have a PictureControl. I generate a window with opencv and then i translate it to my PictureControl like this

namedWindow("INPUT", 1);
HWND hWnd = (HWND) cvGetWindowHandle("INPUT");
HWND hParent = ::GetParent(hWnd);
::SetParent(hWnd, GetDlgItem(IDC_BMP_LOAD)->m_hWnd);
::ShowWindow(hParent, SW_HIDE);

When I compile it for 32-bit arhitecture it works. When I compile for 64-bit it generate the namedwindow but doesn't hide and at the name I have a strange string like "%HO", different than "INPUT".

I tried to see if the window handler hWnd is ok and at unsued filed it gives me "CXX0030: Error: expression cannot be evaluated". In documention of OpenCV at the function cvGetWindowHandle() says that it returns a native HWND of the window refered by name in case of Win32 application.

Any help would be appreciated! Thanks.

OpenCV and MFC - strange behaviour of cvGetWindowHandler on 32-bit and 64-bit

I have a MFC project in Microsoft Visual Studi Studio 2010. In my dialog I have a PictureControl. I generate a window with opencv and then i translate it to my PictureControl like this

namedWindow("INPUT", 1);
HWND hWnd = (HWND) cvGetWindowHandle("INPUT");
HWND hParent = ::GetParent(hWnd);
::SetParent(hWnd, GetDlgItem(IDC_BMP_LOAD)->m_hWnd);
::ShowWindow(hParent, SW_HIDE);

When I compile it for 32-bit arhitecture it works. When I compile for 64-bit it generate the namedwindow but doesn't hide and at the name I have a strange string like "%HO", different than "INPUT".

I tried to see if the window handler hWnd is ok and at unsued filed it gives me "CXX0030: Error: expression cannot be evaluated". In documention of OpenCV at the function cvGetWindowHandle() says that it returns a native HWND of the window refered by name in case of Win32 application.

Any help would be appreciated! Thanks.

click to hide/show revision 3
retagged

updated 2016-03-30 04:33:33 -0600

berak gravatar image

OpenCV and MFC - strange behaviour of cvGetWindowHandler on 32-bit and 64-bit

I have a MFC project in Microsoft Visual Studio 2010. In my dialog I have a PictureControl. I generate a window with opencv and then i translate it to my PictureControl like this

namedWindow("INPUT", 1);
HWND hWnd = (HWND) cvGetWindowHandle("INPUT");
HWND hParent = ::GetParent(hWnd);
::SetParent(hWnd, GetDlgItem(IDC_BMP_LOAD)->m_hWnd);
::ShowWindow(hParent, SW_HIDE);

When I compile it for 32-bit arhitecture it works. When I compile for 64-bit it generate the namedwindow but doesn't hide and at the name I have a strange string like "%HO", different than "INPUT".

I tried to see if the window handler hWnd is ok and at unsued filed it gives me "CXX0030: Error: expression cannot be evaluated". In documention of OpenCV at the function cvGetWindowHandle() says that it returns a native HWND of the window refered by name in case of Win32 application.

Any help would be appreciated! Thanks.