When I start my applycation I create my own tables. But when I do this in On
Create event of my principal form it raises an exception and tell me Access
violation read of address XXXXXXXX & xXXXXXXX. I'm little lost with this
error. I know it raises an Access violation when a table has the same record
various times but the tables that I create are still empty. Somebody could
help me?
Thanks a lot.
Mario.
"Mario Furió" <mari...@teleline.es> schreef in bericht
news:8pleju$3jc...@SGI3651ef0.iddeo.es...
Ok, and wich event can I use to create them?
I use OnShow.
Smola
--
...and then you read this.
(use "supersmola@" to reply)
(http://www.katedrala.com/ass}
begin
hWnd := FindWindow('TApplication', 'Reunion Tracking');
if hWnd = 0 then
begin
Application.Initialize;
Application.Title := 'Program Tracking';
Application.CreateForm(TdbModule, dbModule);
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end
else
begin
if IsIconic(hWnd) then
ShowWindow(hWnd, SW_RESTORE);
SetForegroundWindow(hWnd);
end;
end.
The key thing here for your purposes is that call to
Application.CreateForm(TdbModule, dbModule) comes before
Application.CreateForm(TMainForm, MainForm).
If you're not allowing Delphi to autocreate your datamodule, just make sure
you instantiate the datamodule before you attempt to use any of its
components. You can also get an access violation if you attempt to access
any of the controls (edit boxes, etc) on your mainform form the its OnCreate
event.
The important thing to remember is that any objects you reference, must be
created before you reference them.
--
================================================
Ray Porter
Applications Analyst Programmer
Administrative Information Services, UNC-CH
Phone: 966-5878
email: ray_p...@unc.edu
dra...@email.unc.edu
Home Page: http://www.unc.edu/~dragon/
"Meddle not in the affairs of dragons,
for thou art crunchy and taste good with ketchup."
"Mario Furió" <mari...@teleline.es> wrote in message
news:8pn4uu$49...@SGI3651ef0.iddeo.es...
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
const
wm_AfterCreate = wm_User;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure WMAfterCreate(var Message: TMessage); message wm_AfterCreate;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
PostMessage(Handle, wm_AfterCreate, 0, 0);
end;
procedure TForm1.WMAfterCreate(var Message: TMessage);
begin
// now all forms are created
end;
end.
"Mario Furió" <mari...@teleline.es> schreef in bericht
news:8pn4uu$49...@SGI3651ef0.iddeo.es...
Smola <A...@inet.hr> wrote in message news:39bfc3a5...@news.iskon.hr...
"Robert Kaplan" <rka...@iamerica.net> schreef in bericht
news:R34w5.297$wn2....@dca1-nnrp2.news.digex.net...
> It would be nice to have something like "On After Create", to initialize a
> form. I use OnActivate with a tacky switch to prevent the code from being
> executed on subsequent activations of the form.
>
> Smola <A...@inet.hr> wrote in message
news:39bfc3a5...@news.iskon.hr...
> > "Mario Furió" <mari...@teleline.es> wrote:
> >
> > >