Solved

Borland C++ 4.5 for Windows General Protection Exception error

Posted on 1997-05-01
3
449 Views
Last Modified: 2013-11-08
Question: Can anyone help with the following problem?

I have a program built from Borland C++ version 4.5 which essentially interfaces with a fortran program, takes the data, and graphs it in several different ways.  Two files are opened (calling the same subroutine) and the data is generated and then read in and graphed.

Recently a new graph was added and now, upon calling for the second file to open, the following error occurs:

      General Protection Exception 0x2B17:0x380E
      <Program name>(1) 0x2B17:0x380E Processor Fault

Nothing was changed in the open subroutine when the new graph was added, so this is quite a mystery.

I put breaks in and tracked the error to a line within the open subroutine which opens the first file without the error.  I'll paste in the whole subroutine, with a **** on the line giving the error below.

If anybody can help with this, I would greatly appreciate it... It's a new program for me (just started a new job).  Thanks in advance.



void sintautoApp::CmFileOpen ()
{
       //
       // Display standard Open dialog box to select a file name.
       //
       *FileData.FileName = 0;

       FileData.SetFilter(
 "Material Files (*.mat)|*.mat|Plate Files (*.plt)|*.plt|Sphere Files
(*.sph)|*.sph|Agglomerates Files (*.agg)|*.agg|");
       sintautoWindow *client =
TYPESAFE_DOWNCAST(GetMainWindow()->GetClientWindow(), sintautoWindow);
// Client window for the frame.
       if (client->CanClose())
****              if (TFileOpenDialog(GetMainWindow(),
FileData).Execute() == IDOK)
                        OpenFile();
       Paint='Y';
       (GetMainWindow()->GetClientWindow())->Invalidate();
       //MessageBox(GetMainWindow()->HWindow,good_path , "sintwin
path", MB_OK);
}
0
Comment
Question by:Skywise
[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
3 Comments
 
LVL 3

Accepted Solution

by:
gaohong earned 150 total points
ID: 1163152
I am not gurantee this will be the solution, however there are places certainly deserve some checking, watch for %%%%%%%%

So do a careful check among the things newly added, the code
you given contains not much information to pinpoint the problem.

good luck

                void sintautoApp::CmFileOpen ()
                {
                //
                // Display standard Open dialog box to select a file name.
                //
                *FileData.FileName = 0;

                FileData.SetFilter(
                 "Material Files (*.mat)|*.mat|Plate Files (*.plt)|*.plt|Sphere Files
                (*.sph)|*.sph|Agglomerates Files (*.agg)|*.agg|");

%%%%%%

                sintautoWindow *client =
                TYPESAFE_DOWNCAST(GetMainWindow()->GetClientWindow(),
                sintautoWindow);
                // Client window for the frame.
%%%%% the client should be checked against 0 here, and I am not
sure the potential of CanClose() did.
                if (client->CanClose())
                **** if (TFileOpenDialog(GetMainWindow(),
                FileData).Execute() == IDOK)
                OpenFile();
%%%%% assuming you use FileData.FileName in OpenFile()                
%%%%%% the code here means, no matter canclose or not, no matter cancel or not, it always do paint
           
                 Paint='Y';
                (GetMainWindow()->GetClientWindow())->Invalidate();
                //MessageBox(GetMainWindow()->HWindow,good_path , "sintwin
                path", MB_OK);
                }
0
 

Author Comment

by:Skywise
ID: 1163153
Hi Gaohong.
Thanks for answering so fast!

I'm not clear on what you're suggesting I try with the line where the program is crashing.  You said:
%%%%% assuming you use FileData.FileName in OpenFile()
%%%%%% the code here means, no matter canclose or not, no matter cancel or not, it always do paint

Do you want/need me to send the code sections that were added?
Thanks again!
Skywise

0
 
LVL 3

Expert Comment

by:gaohong
ID: 1163154
I'm not clear on what you're suggesting I try with the line where the program is crashing. You said:
                      %%%%% assuming you use FileData.FileName in OpenFile()

> I mean your OpenFile() routine got use the newly got file name
> which is FileData.FileName, right. Else you end up open the > same which depends on the system and file open mode, could
> give you exception
                   
  %%%%%% the code here means, no matter canclose or not, no matter cancel or not, it always do
                      paint
> does CanClose() have some side effects ?

cheers
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dialogbox API leak? 18 109
Create a path if not exists 7 108
Re-position sub-options beneath the TAB 7 106
Adjust the position 3 70
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

763 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