Hello Stephen!
Friday October 11 1996 11:07, Stephen Whitis wrote to All:
SW> The problem is that the only event I know which will run when the
SW> app starts, is the FormCreate event. However, when that event
SW> runs, the OptionsDlg hasn't yet been created, so trying to modify
SW> anything based on it (or stored in it) causes a GPF.
I have succesfully used the following method:
Define a const like this above the form definition:
const
WM_StartProgram = WM_USER + $0000;
Write this in the private section of the form:
procedure StartProgram(var M: TWMNoParams); message WM_StartProgram;
Add this to the FormCreate procedure:
PostMessage(Handle, WM_StartProgram, 0, 0);
and finally all you have to do is write the StartProgram procedure, which
does the rest of your initializing. All other components have been created
when the StartProgram is called including the forms OnShow, OnActivate and
OnPaint.
procedure Form.StartProgram(var M: TWMNoParams);
begin
// All initializing comes here
end;
SW> Can anyone help me out with this?
Hope this does the trick.
Ken
... Public speaking is very easy.
--- GoldED/386 2.51.A0901+
---------------
* Origin: Living in interesting times (2:238/31.1)
|