Save image using dialog
Hello,I tried to use GetOpenSaveName diaog , but it didn't work,how to fix it? Any Idea?
and code
int SaveAs(HWND hWnd) {
ZeroMemory(&saveSzFile, sizeof(saveSzFile));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hWnd;
ofn.hInstance = hInst;
ofn.lpstrFilter = L"Bitmap files(*.bmp)\0 * .bmp\0JPEG files(*.jpg)\0 * .jpg\0All files(*.*)\0 * .*\0\0";;
ofn.lpstrCustomFilter = saveSzFile;
ofn.nMaxCustFilter = sizeof(saveSzFile);
ofn.nFilterIndex = NULL;
ofn.lpstrFile = saveSzFile;
ofn.nMaxFile = sizeof(saveSzFile);
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = 0;
ofn.Flags = OFN_FILEMUSTEXIST;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = NULL;
ofn.lCustData = NULL;
ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL;
wcstombs(savefilename, saveSzFile, sizeof(savefilename));
if (GetSaveFileName(&ofn))
{
cvSaveImage(savefilename, dst);
}
return 0;
And actually cvSaveImage() includes only char-adress to file,i write it into savefilename,but it doesn't work and i don't know why
Thank for help in advance!
apologies for deleting this question but we really don't' want you to mislead noobs here thinking, that any of this is a valid idea in 2017