Solved

changing the application wnd title after fileopen and filesave

Posted on 2000-02-16
4
277 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 10 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to know only "File created" with EventLog 3 35
matchUp  challenge 6 82
withoutTen challenge 14 140
mapAB Challlenge 35 180
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

739 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