Page 1 of 1

Embedding ZGE-programs in Win32 applications

Posted: Tue Jun 03, 2008 1:56 pm
by VilleK
The About-box in ZDesigner use a embedded ZGE-program to display an animation. Here is how you can do that in your own applications.

1. Generate your ZGE-application as a screensaver
2. Call the screensaver binary from your program passing the parent window handle as a parameter

This is the code that does this in ZDesigner. It is in Pascal but could easily be converted to other languages.

Code: Select all

procedure TAboutForm.FormCreate(Sender: TObject);
var
  Prog,ProgParam : string;
begin
  //Path to screensaver executable
  Prog := ExtractFilePath(Application.ExeName) + 'about.bin';

  //Parameter string containing the string value of the numeric window handle of the panel in the aboutbox
  ProgParam := '-p ' + IntToStr(SplashPanel.Handle);

  //Must use winexec or createproces because shellexecute cannot start
  //programs that doesn't end with '.exe'.
  //Process is closed automatically when its parent window is destroyed.
  WinExec(PAnsiChar(Prog + ' ' + ProgParam), SW_SHOWNORMAL);
end;