#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    60
    Rep Power
    11

    VC++ 6.0, save command


    Hello,
    This is what I would like to do. I would like to make a save command. I would like it to look just like the one in Microsoft word when you click on the "save as" button. This is the code that I have, but it is for the open command, not the save command. I would like to know what the key words for the save as command are.
    Thank you very much for your time.
    Ronald

    void CTry4Dlg::OnButton4()
    {
    OPENFILENAME ofn = {0};
    char szName[MAX_PATH];
    *szName = 0;
    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = AfxGetApp()->m_pMainWnd->m_hWnd;
    ofn.lpstrFilter = NULL;
    ofn.lpstrFilter = "Text files (*.txt)\0*.txt\0All files (*.*)\0*.*\0";
    ofn.lpstrCustomFilter = NULL;
    ofn.nFilterIndex = 1;
    ofn.lpstrFile = &szName[0];
    ofn.nMaxFile = MAX_PATH;
    ofn.lpstrInitialDir = m_DefaultDir;
    ofn.lpstrTitle = "Open Text File";
    ofn.lpstrFileTitle = NULL;
    ofn.lpstrDefExt = "TXT";
    ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_EXPLORER;

    if (GetOpenFileName(&ofn))
    transfile1= ofn.lpstrFile;
    CEdit* pEditShow = (CEdit*)GetDlgItem(IDC_EDIT4);
    pEditShow->SetWindowText(transfile4);
    }
    This message is a natural product made from recycled electrons. The slight
    variations in spelling and grammar enhance its individual character and
    beauty and in no way are to be considered flaws or defects.
  2. #2
  3. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    243
    Did you take the time to google? http://msdn.microsoft.com/library/de...enFileName.asp has at the bottom links to other interesting functions.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

IMN logo majestic logo threadwatch logo seochat tools logo