{*************************************************************************}
{                                                                         }
{ DQP2.dpr - head project's file                                          }
{                                                                         }
{ This file is a part of the project:                                     }
{   Dizzy Quest Player - player for *.dqe files, created in DQE2          }
{                                                                         }
{ © Parfenov Alexey Andreevich, 2007                                      }
{                                                                         }
{ e-mail: AlkatrazStudio@yandex.ru                                        }
{                                                                         }
{ This program is free software; you can redistribute it and/or modify    }
{ it under the terms of the GNU General Public License as published by    }
{ the Free Software Foundation; either version 2 of the License, or       }
{ (at your option) any later version.                                     }
{                                                                         }
{ This program is distributed in the hope that it will be useful,         }
{ but WITHOUT ANY WARRANTY; without even the implied warranty of          }
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            }
{ GNU General Public License for more details.                            }
{                                                                         }
{ You may read GNU General Public License at:                             }
{   http://www.gnu.org/copyleft/gpl.html                                  }
{                                                                         }
{*************************************************************************}
program DQP2;

uses
  Forms,
  windows,
  messages,
  DQE2_types in '..\Shared\Lib\DQE2_types.pas',
  FilesUnit in 'FilesUnit.pas' {Form_Files},
  AboutUnit in '..\DizzyQuestEditor2\AboutUnit.pas' {Form_About},
  MainUnit in 'MainUnit.pas' {Form_Main_DQP},
  OptionsUnit in '..\DizzyQuestEditor2\OptionsUnit.pas' {Form_Options},
  WaitUnit in '..\DizzyQuestEditor2\WaitUnit.pas' {Form_Wait},
  BackUnit in 'BackUnit.pas' {Form_Back};

{$R *.res}

var
  win:HWND;
  s:array[0..MAX_PATH]of char;
  data:COPYDATASTRUCT;
  n:integer;

begin
  win:=FindWindow(PAnsiChar(string(TForm_Main_DQP.ClassName)),nil);
  if win<>0 then
  begin
    SetForegroundWindow(win);
    if ParamCount>0 then
    begin
      ZeroMemory(@s,sizeof(s));
      n:=length(paramstr(1));
      CopyMemory(@s,PAnsiChar(ParamStr(1)),n);
      data.dwData:=0;
      data.cbData:=n+1;
      data.lpData:=@s;
      SendMessage(win,WM_COPYDATA,0,integer(@data));
    end;
    exit;
  end;
  Application.Initialize;
  Application.Title:='Dizzy Quest Player 2';
  Application.CreateForm(TForm_Main_DQP, Form_Main_DQP);
  Application.CreateForm(TForm_Files, Form_Files);
  Application.CreateForm(TForm_About, Form_About);
  Application.CreateForm(TForm_Options, Form_Options);
  Application.CreateForm(TForm_Wait, Form_Wait);
  Application.CreateForm(TForm_Back, Form_Back);
  Application.Run;
end.
