1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

VC++, save command

Discussion in 'Software Development' started by calculus87, Sep 29, 2003.

Thread Status:
Not open for further replies.
  1. calculus87

    calculus87 Thread Starter

    Sep 4, 2003
    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.

    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";

    if (GetOpenFileName(&ofn))
    transfile1= ofn.lpstrFile;
    CEdit* pEditShow = (CEdit*)GetDlgItem(IDC_EDIT4);
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/168355

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice