I'd like to just click the button and have a path set \\myfile.jpg for example
How can I edit this code to get this done instead of "open file dialog" to select it.
void CSampleDlg::OnBnClickedBkopen()
{
UNICODECHAR fn[512];
OPENFILENAME ofn;
UNICODECHAR szFile[512];
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = this->m_hWnd;
ofn.lpstrFile = szFile;
wcscpy_s(ofn.lpstrFile, 512, L"\0\0");
ofn.nMaxFile = 260;
ofn.lpstrFilter = L"Image Files (bmp,jpg,tif,png,gif,pdf)\0*.bmp;*.jpg;*.tif;*.tiff;*.png;*.gif;*.pdf\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_NONETWORKBUTTON | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;// show open file dialog
if (!GetOpenFileName(&ofn)) return;
wcscpy_s(fn, 512, ofn.lpstrFile);
////////
wchar_t str[100];
if (m_cbScale.IsWindowEnabled())
{
if (m_cbScale.GetCurSel() < 1) //autoscaling
{
NsOCR->Cfg_SetOption(CfgObj, BT_DEFAULT, L"ImgAlizer/AutoScale", L"1");
NsOCR->Cfg_SetOption(CfgObj, BT_DEFAULT, L"ImgAlizer/ScaleFactor", L"1.0"); //default scale if cannot detect it automatically
}
else //fixed scaling
{
NsOCR->Cfg_SetOption(CfgObj, BT_DEFAULT, L"ImgAlizer/AutoScale", L"0");
m_cbScale.GetWindowTextW(str, 100);
NsOCR->Cfg_SetOption(CfgObj, BT_DEFAULT, L"ImgAlizer/ScaleFactor", str);
}
}
////
//note: there are other possible ways to load image to NSOCR
int res = NsOCR->Img_LoadFile(ImgObj, fn);