Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Windows OpenFileName CDERR_INITIALIZATION error

$
0
0

                    OPENFILENAME of;
                    SecureZeroMemory(&of, sizeof(OPENFILENAME));

                    of.lStructSize  = sizeof(OPENFILENAME);
                    of.lpstrTitle   = "Open Image File";
                    of.hwndOwner    = window;
                    of.lpstrFilter  = "Image Files\0Bitmap(.bmp)\0*.bmp\0";
                    of.Flags        = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
                    of.nFilterIndex = 1;

                    of.lpstrFile    = new char[256];
                    SecureZeroMemory(of.lpstrFile, 256 * sizeof(char));

                    if(!GetOpenFileName(&of))
                    {

                        DWORD b = CommDlgExtendedError();

                        delete[] of.lpstrFile;

                        return TRUE;
                    }
                    
                    SetWindowText((HWND)Txt_Browse, of.lpstrFile);

                    delete[] of.lpstrFile;




GetOpenFileName returns 0, and CommDlgExtendedError returns CDERR_INITIALIZATION.

Any help will be appreciated.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>