We place a dummy begin..end section inside a compiler option just before the
real begin..end. The IDE doesn't see the compiler options and puts it code
in the first begin..end section. This dummy code is never compiled and our
real begin ..end section is never touched by the IDE.


i.e.

{$IFDEF Delphi_IDE automatic code creation will go here.}
begin
  Application.Title := '//PowerManagerII';
  Application.Initialize;
  Application.CreateForm(TMainForm, MainForm);
  Application.Run;
end.
{$ENDIF}

begin
  // now the real code goes here....
        
 
TAppInstanceReporter.GetInstance(SPM2AppString).BroadcastAppStartupCommence;
  etc....
  etc....
        
  end;
end.
 

Regards Paul
Software Engineer, 
Invensys Energy Systems (NZ) Limited
http://www.invensys-energy.co.nz



-----Original Message-----
From: Neven MacEwan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 5 September 2000 12:13
To: Multiple recipients of list delphi
Subject: [DUG]: Any way to stop IDE maintaining Project File


I Have the following project file
But the IDE keeps on spontaneously putting in an extra
      Application.CreateForm(TMainForm, MainForm);

Any way to prevent this (bar flagging the file RO)

Regards
Neven


begin
  {Attempt to create a named mutex}
  CreateMutex(nil, false, 'MWK-Athena');
  {if it failed then there is another instance}
  if GetLastError = ERROR_ALREADY_EXISTS then begin
   {Send all windows our custom message - only our other}
   {instance will recognise it, and restore itself}
    SendMessage(HWND_BROADCAST, RegisterWindowMessage('MWK-Athena'), 0, 0);
    Halt(0);
  end;
  Application.Initialize;
  with TSplashForm.Create(nil) do
  try
    if FindWindow('TAppBuilder',nil) = 0 then // ide not running
    begin
      Show;   // show a splash screen
      Update; // force display
    end;  
    Application.Title := 'MWK Athena';
    Application.CreateForm(TADataModule, ADataModule);
    if ADataModule.Active then
    begin
      Application.CreateForm(TMainForm, MainForm);
      Application.CreateForm(TDBUpdateErrorDlg, DBUpdateErrorDlg);
    end;
  finally
    Free;
  end;
  Application.Run;
end.


Regards Neven
N.K. MacEwan B.E. E&E
Ph 649 574 0027 
Fax 649 570 2706
Mobile 025 749 062
[EMAIL PROTECTED]
[EMAIL PROTECTED]

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to