1

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". When I try to show something with imshow it gives me an error with acces violation. The images are coming from webcam. Any help would be appreciated! Thanks.

UPDATE

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.

Eddie
  • 55
  • 1
  • 9
  • you have to use opencv libs fitting your compiler. if you build 64 bit you have to use 64 bit opencv libs. in addition you have to use debug libearies in debug build and release libraries in release build! – Micka Mar 28 '16 at 19:38
  • Calling the C implementation (`cvNamedWindow`) does return a value, indicating success/failure. That's at least a bit more information than what you get from the C++ implementation. I don't know how you inspect the window name; Windows doesn't store them in a user-visible way. Does `cvGetWindowHandle` return a valid window handle? Is it the one you were querying (use Spy++ to find out)? – IInspectable Mar 29 '16 at 09:02
  • 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. – Eddie Mar 30 '16 at 07:51

0 Answers0