Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Save image using dialog

Hello,I tried to use GetOpenSaveName diaog , but it didn't work,how to fix it? Any Idea?

here is a photo of error

image description

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 = L"\0\0";
ofn.nMaxCustFilter = 256;
ofn.nFilterIndex = NULL;
ofn.lpstrFile = saveSzFile;
ofn.nMaxFile = 260;
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, 260);//fucn wich converts wchar_t in char



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!

Save image using dialog

Hello,I tried to use GetOpenSaveName diaog , but it didn't work,how to fix it? Any Idea?

here is a photo of error

image description

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 = L"\0\0";
ofn.nMaxCustFilter = 256;
ofn.nFilterIndex = NULL;
ofn.lpstrFile = saveSzFile;
ofn.nMaxFile = 260;
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, 260);//fucn wich converts wchar_t in char



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!

Save image using dialog

Hello,I tried to use GetOpenSaveName diaog , but it didn't work,how to fix it? Any Idea?

here is a photo of error

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 = L"\0\0";
ofn.nMaxCustFilter = 256;
ofn.nFilterIndex = NULL;
ofn.lpstrFile = saveSzFile;
ofn.nMaxFile = 260;
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, 260);//fucn wich converts wchar_t in char



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!

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 = L"\0\0";
saveSzFile;
ofn.nMaxCustFilter = 256;
sizeof(saveSzFile);
ofn.nFilterIndex = NULL;
ofn.lpstrFile = saveSzFile;
ofn.nMaxFile = 260;
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, 260);//fucn wich converts wchar_t in char
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!