Hello!
I do simple picture editor,using openCV libriary,and i faced , that when i use openCV libriary,image that i need to open in hWnd opens in his "own" child window,and i don't know,how to get picture from child window,and set in parent window.
What I have tried:
int MyOpenFile(HWND hWnd)
{
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hWnd;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"Bitmap files(*.bmp)\0*.bmp\0JPEG files(*.jpg)\0*.jpg\0All files(*.*)\0*.*\0\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
GetOpenFileName(&ofn);
wcstombs(filename,szFile,255);
hdc = GetDC(hWnd);
memDC = CreateCompatibleDC(hdc);
image = cvLoadImage(filename, CV_LOAD_IMAGE_UNCHANGED);;
dst = cvCloneImage(image);
cvShowImage("image",image);
cvWaitKey(0);
cvReleaseImage(&image);
cvDestroyAllWindows();
ReleaseDC(hWnd, hdc);
UpdateWindow(hWnd);
return 0;
}
I've tried this MFC algorithm,but it doesn't work in Winapi,but i think it's correct,but not for winapi,please tell me how to use it correctly in winapi
cvNamedWindow("IDC_STATIC_OUTPUT", 0);
cvResizeWindow("IDC_STATIC_OUTPUT", 420, 240);
hWnd = (HWND)cvGetWindowHandle("IDC_STATIC_OUTPUT");
HWND hParent = ::GetParent(hWnd);
::SetParent(hWnd, GetDlgItem(hWnd, ));
::ShowWindow(hParent, SW_HIDE);
cvShowImage("IDC_STATIC_OUTPUT", frame_copy)
Thank you in advance!