Matheas Manssen mentioned this to All:
MM> When all this happens the forms isn't visible yet, offcourse. The music
MM> and sound start before something is visible. But I want the music/sound
to
MM> start after the form with picture etc. is visible. Should I use the
MM> onPaint event of the form?
Use a custom Windows message, like so:
interface
const
WM_PLAYMUSIC = WM_USER + 1;
type
Form1 = class (TForm1)
...
protected
procedure WMPlayMusic(var Msg : TMsg); message WM_PLAYMUSIC;
implementation
procedure TForm1.OnShow(Sender : TObject);
begin
PostMessage(Handle, WM_PLAYMUSIC, 0, 0);
end;
procedure TForm1.WMPlayMusic(var Msg : TMsg);
begin
{ Start playing the music and sound here }
end;
By using PostMessage, you're telling the form to process the custom message
AFTER all the other messages (such as WM_PAINT, etc.) are done.
...Gary
--- GoldED 2.41
---------------
* Origin: The Flying Circus BBS, Farmington Hills, MI, USA. (1:2410/905)
|