i was just working with files and opening them and i'm using the common open dialog box to get the filename and path from the user. anyways, there seems to be an error with my implementation of the open dialog box because the function returns false and it doesn't even bring up the open dialog box. here is how i call the function i wrote:
Code:
if(GetFileFromOpen(hDlg, szFileName, szTitleName) == FALSE)
                        MessageBox(NULL, TEXT("Could not open file name..."), TEXT("Error!"), 0);
and here is the function i wrote to set up the OPENFILENAME struct and call GetOpenFileName:
Code:
BOOL GetFileFromOpen(HWND hwnd, PTSTR szFileName, PTSTR szTitleName)
{
    OPENFILENAME ofn;
    static TCHAR szFilter[] = TEXT("Text Files (*.txt)\0*.txt\0");

    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = hwnd;
    ofn.hInstance = NULL;
    ofn.lpstrFilter = szFilter;
    ofn.lpstrCustomFilter = NULL;
    ofn.nMaxCustFilter = 0;
    ofn.nFilterIndex = 0;
    ofn.lpstrFile = szFileName;
    ofn.nMaxFile = MAX_PATH;
    ofn.lpstrFileTitle = szTitleName;
    ofn.nMaxFileTitle = MAX_PATH;
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = NULL;
    ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT;
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lpstrDefExt = TEXT("txt");
    ofn.lCustData = 0;
    ofn.lpfnHook = NULL;
    ofn.lpTemplateName = NULL;

    return GetOpenFileName(&ofn);
}
why is GetOpenFileName returning FALSE therefore causing GetFileFromOpen (the function i wrote) to return false? am i doing something wrong in setting up the fields of the OPENFILENAME struct? or am i calling something wrongly? please help.

thanks!