Hi Ross,

> So what does this mean?  What else is executing during for
> CreateForm procedure that could cause it to hang?  How can
> I debug this?  I have MadExcept compiled in but it doesn't
> activate.

If you are unable to debug the application in the 'traditional' way, I
would suggest scattering OutputDebugString() liberally throughout your
code and then using a tool like DebugView to monitor the output. Pass
decent comments to OutputDebugString() so that you can see what the last
one was that was executed before your application hung. Seek out places
like Initialization sections of units and add calls to
OutputDebugString() there too.

So for example, if you had the following:

program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit1.pas' {Form2},
  Unit3 in 'Unit1.pas' {Form3};

{$R *.RES}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.CreateForm(TForm3, Form3);
  Application.Run;
end.

You could start by doing something like this:

program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit1.pas' {Form2},
  Unit3 in 'Unit1.pas' {Form3};

{$R *.RES}

begin
  OutputDebugString(PChar('Calling Application.Initialize'));
  Application.Initialize;
  OutputDebugString(PChar('Calling Application.CreateForm(TForm1,
Form1)'));
  Application.CreateForm(TForm1, Form1);
  OutputDebugString(PChar('Calling Application.CreateForm(TForm2,
Form2)'));
  Application.CreateForm(TForm2, Form2);
  OutputDebugString(PChar('Calling Application.CreateForm(TForm3,
Form3)'));
  Application.CreateForm(TForm3, Form3);
  OutputDebugString(PChar('Calling Application.Run'));
  Application.Run;
  OutputDebugString(PChar('All done.'));
end.

Run DebugView on the machine that's causing the problems and then run
your application and see what the last message was that was sent to the
debugger. Identify the unit that caused everything to hang, and then
start adding OutputDebugString() to that unit. Keep repeating these
steps until you can find where the cause of the problem is. Your biggest
obstacle will be units that you don't have the source code for. If
you're using some component that you only have DCUs for, and they have
something in their Initialization section that causes your application
to hang, then I'm afraid that you're on your own!

Unfortunately, there's not going to be an easy way to do this: it's
going to take a lot of time and even more patience. Good luck!

Cord Schneider
StaffPlan
http://www.staffplan.co.uk/


For more information about OutputDebugString() see
http://msdn.microsoft.com/en-us/library/aa363362(VS.85).aspx
For more information about DebugView see
http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx
_______________________________________________
Delphi mailing list -> Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to