Solved

Is Delphi IDE running?

Posted on 2000-03-24
5
480 Views
Last Modified: 2010-04-04
Please help me, I badly need a _working piece of code_ for Delphi 3 to determine whether Delphi IDE is running at the moment my app is launched. Thanks,

yegor
0
Comment
Question by:yegor
  • 4
5 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 600 total points
ID: 2655563
hi,
just have to do below on form create event:

Function IsIdeRunning: boolean;
Begin
  Result:=FindWindow('TAppBuilder',nil) > 0;
End;

Regards Barry

0
 
LVL 17

Expert Comment

by:inthe
ID: 2655582
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

Function RunningInTheIDE: boolean;
Begin
  Result:=FindWindow('TAppBuilder', nil) > 0;
End;

procedure TForm1.FormCreate(Sender: TObject);
begin
 if RunningInTheIDE then
 Form1.Caption := 'The Delphi Ide is Running'
 else
 Form1.Caption := 'The Delphi Ide is Not Running';
 end;

end.


OR

if FindWindow('TAppBuilder', Nil) <> 0 Then
  BEGIN
            ShowMessage('Delphi and or C++ Builder is running');   END
 
  if  ({FindWindow('TApplication', nil) = 0) OR - all delphi apps have TApp }
 
      (FindWindow('TAlignPalette', nil) = 0) OR
      (FindWindow('TPropertyInspector', nil) = 0) OR
      (FindWindow('TAppBuilder', nil) = 0) then
  begin
    ShowMessage('Delphi is not running!');
  end
  else
    ShowMessage('Delphi is running!');
0
 
LVL 17

Expert Comment

by:inthe
ID: 2655592
MMM..
FOR DELPHI 3 THIS WOULD BE BEST:

function DelphiIsRunning : boolean;
var
  H1, H2, H3, H4 : Hwnd;
const
  A1 : array[0..12] of char = 'TApplication'#0;
  A2 : array[0..15] of char = 'TAlignPalette'#0;
  A3 : array[0..18] of char = 'TPropertyInspector'#0;
  A4 : array[0..11] of char = 'TAppBuilder'#0;
  T1 : array[0..8] of char = 'Delphi 3'#0;
begin
  H1 := FindWindow(A1, T1);
  H2 := FindWindow(A2, nil);
  H3 := FindWindow(A3, nil);
  H4 := FindWindow(A4, nil);
  Result := (H1 <> 0) and (H2 <> 0) and
            (H3 <> 0) and (H4 <> 0);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 if DelphiIsRunning then
 Form1.Caption := 'The Delphi Ide is Running'
 else
 Form1.Caption := 'The Delphi Ide is Not Running';
 end;
0
 
LVL 17

Expert Comment

by:inthe
ID: 2655627
Sorry for so many postings ,
thought i better test this and this one is best to work if any version of delphi is running:

function DelphiIsRunning : boolean;
var
  H2,H3,H4,D1, D2, D3, D4,D5 : Hwnd;
  Yep : Boolean;
const
  A1 : array[0..12] of char = 'TApplication'#0;
  A2 : array[0..15] of char = 'TAlignPalette'#0;
  A3 : array[0..18] of char = 'TPropertyInspector'#0;
  A4 : array[0..11] of char = 'TAppBuilder'#0;
  T1 : array[0..8] of char = 'Delphi'#0;
  T2 : array[0..8] of char = 'Delphi 2'#0;
  T3 : array[0..8] of char = 'Delphi 3'#0;
  T4 : array[0..8] of char = 'Delphi 4'#0;
  T5 : array[0..8] of char = 'Delphi 5'#0;
begin
yep := false;
  D1 := FindWindow(A1, T1);
  D2 := FindWindow(A1, T2);
  D3 := FindWindow(A1, T3);
  D4 := FindWindow(A1, T4);
  D5 := FindWindow(A1, T5);
  IF (D1 <> 0) or (D2 <> 0) or (D3 <> 0) or
      (D4 <> 0) or (D5 <> 0) then yep := true
      else yep := false;
  H2 := FindWindow(A2, nil);
  H3 := FindWindow(A3, nil);
  H4 := FindWindow(A4, nil);
  Result := (H2 <> 0) and (H3 <> 0) and (H4 <> 0) and yep;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 if DelphiIsRunning then
 Form1.Caption := 'The Delphi Ide is Running'
 else
 Form1.Caption := 'The Delphi Ide is Not Running';
 end;
0
 

Author Comment

by:yegor
ID: 2655946
Thank you very much,

yegor
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now