Discussion:
OpenDialog->Execute error
(too old to reply)
Samuel Fogarty
2008-08-04 03:39:42 UTC
Permalink
Hi Team,

I'm using CodeGear C++ builder(recently converted from studio). I'm getting
an 'Access violation at address 00000000' when calling execute on an
OpenDlg. Here is the code.

TOpenDialog* OpenDlg=new TOpenDialog(MainForm);
bool Answer=OpenDlg->Execute(); //Access error here

(There were other lines here for file filtering, etc, but I've stripped
those away and the error remains)
I use lots of OpenDlgs, and others in the program appear to work. Also, this
code worked fine in studio, so it is unlikely to be an obvious error in my
code. Does anyone know what is happening? Anyone seen this before? I am
stumped.
Miguel Gimenez
2008-08-04 10:16:11 UTC
Permalink
Post by Samuel Fogarty
Hi Team,
I'm using CodeGear C++ builder(recently converted from studio). I'm getting
an 'Access violation at address 00000000' when calling execute on an
OpenDlg. Here is the code.
TOpenDialog* OpenDlg=new TOpenDialog(MainForm);
bool Answer=OpenDlg->Execute(); //Access error here
(There were other lines here for file filtering, etc, but I've stripped
those away and the error remains)
I use lots of OpenDlgs, and others in the program appear to work. Also, this
code worked fine in studio, so it is unlikely to be an obvious error in my
code. Does anyone know what is happening? Anyone seen this before? I am
stumped.
Did new succeed? Check for exceptions and/or OpenDlg == NULL.

--
Regards
Miguel Gimenez
Remy Lebeau (TeamB)
2008-08-04 18:40:17 UTC
Permalink
Post by Samuel Fogarty
I'm using CodeGear C++ builder(recently converted from studio).
Which version, though? 2006, 2007?
Post by Samuel Fogarty
I'm getting an 'Access violation at address 00000000' when calling
execute on an OpenDlg.
00000000 means a NULL pointer is being accessed.
Post by Samuel Fogarty
Here is the code.
Is "MainForm" valid at the time?


Gambit
Samuel Fogarty
2008-08-05 02:20:16 UTC
Permalink
New succeeded. OpenDlg is non-null. MainForm is valid and non-null. I'm
using CodeGear C++ Builder 2007.

When in debug mode, I note that the access violation happens after a whole
bunch of module loads(more than 20 of them) and various unloads. It
repeatedly loads and unloads 'windows-1252.so' and 'utf-8.so'.
I still have my older studio compiler installed. Is it possible that it is
loading the wrong modules?

Thanks for your help.
Post by Remy Lebeau (TeamB)
Post by Samuel Fogarty
I'm using CodeGear C++ builder(recently converted from studio).
Which version, though? 2006, 2007?
Post by Samuel Fogarty
I'm getting an 'Access violation at address 00000000' when calling
execute on an OpenDlg.
00000000 means a NULL pointer is being accessed.
Post by Samuel Fogarty
Here is the code.
Is "MainForm" valid at the time?
Gambit
Samuel Fogarty
2008-08-05 02:36:41 UTC
Permalink
I have compared the list of module loads and unloads between the working and
non-working OpenDlgs. The seem to be exactly the same, except that the
non-working one has the access violation after reaching BROWSEUI.dll, so
ntshrui.dll never ends up being loaded, which appears to be the last module
to be loaded for a working OpenDlg. I don't know if this is a red herring or
not, but wondered if there was a clue there.
Post by Samuel Fogarty
New succeeded. OpenDlg is non-null. MainForm is valid and non-null. I'm
using CodeGear C++ Builder 2007.
When in debug mode, I note that the access violation happens after a whole
bunch of module loads(more than 20 of them) and various unloads. It
repeatedly loads and unloads 'windows-1252.so' and 'utf-8.so'.
I still have my older studio compiler installed. Is it possible that it is
loading the wrong modules?
Thanks for your help.
Post by Remy Lebeau (TeamB)
Post by Samuel Fogarty
I'm using CodeGear C++ builder(recently converted from studio).
Which version, though? 2006, 2007?
Post by Samuel Fogarty
I'm getting an 'Access violation at address 00000000' when calling
execute on an OpenDlg.
00000000 means a NULL pointer is being accessed.
Post by Samuel Fogarty
Here is the code.
Is "MainForm" valid at the time?
Gambit
Mike Ruskai
2008-08-05 14:01:19 UTC
Permalink
On or about Tue, 5 Aug 2008 10:20:16 +0800 did "Samuel Fogarty"
Post by Samuel Fogarty
I still have my older studio compiler installed. Is it possible that it is
loading the wrong modules?
Quite possible. I have BCB6 and BCB2007 installed myself, and what I do is
set the system paths to use BCB2007's directories, and use a batch file to
launch BCB6 with it's binary and library directories prepended to the path.
Samuel Fogarty
2008-08-07 02:03:21 UTC
Permalink
But that doesn't explain why other OpenDlgs work in the project. I'm
guessing I must be doing something to annoy it.
Post by Mike Ruskai
On or about Tue, 5 Aug 2008 10:20:16 +0800 did "Samuel Fogarty"
Post by Samuel Fogarty
I still have my older studio compiler installed. Is it possible that it is
loading the wrong modules?
Quite possible. I have BCB6 and BCB2007 installed myself, and what I do is
set the system paths to use BCB2007's directories, and use a batch file to
launch BCB6 with it's binary and library directories prepended to the path.
Loading...