Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

changing the application wnd title after fileopen and filesave

Posted on 2000-02-16
4
Medium Priority
?
299 Views
Last Modified: 2013-11-20
I have a drawing based application .. when drawing in the application i have the title of the window to be whatever i specify under OnInitialUpdate() now I need to save the applocation and then later be able to open the application based on the saved filename ... How do i make it do :
1. the new file name comes up like this
Draw RMS_Voltage and Pst Calculator - filename . ext as soon as i do filesave
2. when i open the saved case the application window comes up like this
Draw RMS_Voltage and Pst Calculator - filename . ext






// *******************************************************************
void CRms_VoltageView::OnInitialUpdate()
{
      CView::OnInitialUpdate();
  GetParentFrame()->SetWindowText("Draw RMS_Voltage and Pst Calculator");
      
      // TODO: Add your specialized code here and/or call the base class
      
}


// *****************************
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
      // TODO: Modify the Window class or styles here by modifying
      //  the CREATESTRUCT cs
cs.style&=~FWS_ADDTOTITLE; // PREFIXTITLE - default will give untitled as text

      return CFrameWnd::PreCreateWindow(cs);
}



//********************************

// *******************************************************************************
void CRms_VoltageView::OnFileSaveAs()
{
      // TODO: Add your command handler code here


//CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL,
                //LPCTSTR lpszFileName = NULL, DWORD dwFlags =
                //OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
                //LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );

static char szFilter[] = "Data Files (*.dat)|*.dat|All Files (*.*)|*.*||";

CFileDialog SaveAsDlg(FALSE,"dat","*.dat",OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT, szFilter,NULL);


  if (SaveAsDlg.DoModal() == IDOK)
  {          
      ofstream outfile;
      CString filename = SaveAsDlg.GetFileName();
      outfile.open (filename,ios::out);        //  open file name given by user
      outfile.setf(ios::fixed);      

// ********* FILE STORAGE BEGINS HERE ***********

            outfile<<current_line;
            outfile<<"\n"<<m_Startvolt;
            outfile<<"\n"<<m_Tottime;
            outfile<<"\n"<<m_Period;
            outfile<<"\n"<<m_miny;
            outfile<<"\n"<<m_maxy;
            outfile<<"\n"<<CircleDraw;
            outfile<<"\n"<<Process_Started;
            outfile<<"\n"<<Pointer_PST_Value;
            outfile<<"\n"<<m_bDraw;
            outfile<<"\n"<<ScaleDraw;
            outfile<<"\n"<<CursorValue;
// array elements


         for ( j=1; j<=(current_line); j++)
       {
               outfile<<"\n"<<pline_array[j].x1_pixel;
               outfile<<"\n"<<pline_array[j].y1_pixel;
               outfile<<"\n"<<pline_array[j].x2_pixel;
               outfile<<"\n"<<pline_array[j].y2_pixel;
               outfile<<"\n"<<pline_array[j].ini_volt;
               outfile<<"\n"<<pline_array[j].ini_time;
               outfile<<"\n"<<pline_array[j].fin_volt;
               outfile<<"\n"<<pline_array[j].fin_time;
                         
         } // for ends

   outfile.close();

  } // SaveAsDlg if
 
}
// *******************************************************************************
void CRms_VoltageView::OnFileOpen()
{
      // TODO: Add your command handler code here
      
  CFileDialog OpenDlg( TRUE, "dat", "*.dat", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "*.dat", NULL );

  if (OpenDlg.DoModal() == IDOK)
  {
   CString filename = OpenDlg.GetFileName();
   ifstream inputfile(filename);       
   FileOn = 1;
   mode =1; // retreival mode of the saved case
   
// ********* FILE STORAGE BEGINS HERE ***********

            inputfile>>current_line;
            inputfile>>m_Startvolt;
            inputfile>>m_Tottime;
            inputfile>>m_Period;
            inputfile>>m_miny;
            inputfile>>m_maxy;
            inputfile>>CircleDraw;
            inputfile>>Process_Started;
            inputfile>>Pointer_PST_Value;
            inputfile>>m_bDraw;
            inputfile>>ScaleDraw;
            inputfile>>CursorValue;
          Flag = 0;

// array elements
         // These are three conditions that needs initialization
             pline_array = make_line_array(current_line); // call the function
      
         for ( j=1; j<=(current_line); j++)
       {
         inputfile>>pline_array[j].x1_pixel;
         inputfile>>pline_array[j].y1_pixel;  
         inputfile>>pline_array[j].x2_pixel;
         inputfile>>pline_array[j].y2_pixel;
         inputfile>>pline_array[j].ini_volt;
         inputfile>>pline_array[j].ini_time;
         inputfile>>pline_array[j].fin_volt;
         inputfile>>pline_array[j].fin_time;
         } // for ends


  Invalidate();         
  inputfile.close();


               ofstream fileout("out.out");

            fileout<<current_line;
            fileout<<"\n"<<m_Startvolt;
            fileout<<"\n"<<m_Tottime;
            fileout<<"\n"<<m_Period;
            fileout<<"\n"<<m_miny;
            fileout<<"\n"<<m_maxy;
            fileout<<"\n"<<CircleDraw;
            fileout<<"\n"<<Process_Started;
            fileout<<"\n"<<Pointer_PST_Value;
            fileout<<"\n"<<m_bDraw;
            fileout<<"\n"<<ScaleDraw;
            fileout<<"\n"<<CursorValue;

            // array elements

         for ( j=1; j<=(current_line); j++)
       {
               fileout<<"\n"<<pline_array[j].x1_pixel;
               fileout<<"\n"<<pline_array[j].y1_pixel;
               fileout<<"\n"<<pline_array[j].x2_pixel;
               fileout<<"\n"<<pline_array[j].y2_pixel;
               fileout<<"\n"<<pline_array[j].ini_volt;
               fileout<<"\n"<<pline_array[j].ini_time;
               fileout<<"\n"<<pline_array[j].fin_volt;
               fileout<<"\n"<<pline_array[j].fin_time;
         }
        
          fileout.close();         

   } // OpenDlg if




}
// *******************************************************************************
0
Comment
Question by:arindam042099
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
captainkirk earned 40 total points
ID: 2529288
1) sounds like you want to do this in your OnFileSave() function:

CString csText = "Draw RMS_Voltage and Pst Calculator - ";
GetParentFrame()->SetWindowText(csText + filename);


2) and then do the same thing in your OnFileOpen

0
 

Author Comment

by:arindam042099
ID: 2529345
I should have got that ... anyway how can I remove the icon besides the title
0
 
LVL 4

Expert Comment

by:captainkirk
ID: 2531668
I'm not sure that can be done easily...give me your email and I will check on that...
0
 

Author Comment

by:arindam042099
ID: 2532258
ari@ece.msstate.edu

Please look into one more problem that i am having on this code in my next posted question ....
thanks
arindam
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question