TIP: Click on subject to list as thread! ANSI
echo: delphi
to: MATHEAS MANSSEN
from: GARY WEINFURTHER
date: 1996-11-21 07:08:00
subject: Show event

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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.