Embedding ZGE-programs in Win32 applications

Share your ZGE-development tips and techniques here!

Moderator: Moderators

Post Reply
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Embedding ZGE-programs in Win32 applications

Post 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;
Post Reply