Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

check for delphi runing

Posted on 2001-07-16
9
360 Views
Last Modified: 2008-02-01
hi,

I want check is delphi runing?

tanks
0
Comment
Question by:m_r_zamani
9 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6285919
a possibility could be to search a window which class is TAppBuilder
0
 

Expert Comment

by:comptebidon81
ID: 6285939
If you want to know if Delphi is currently running on the PC, then try this procedure:

procedure TfrmMain.IsDelphiRunning;
    function IsItDelphi(HandleParam : HWND; LPARAM : lParam): boolean; stdcall;
    var
        Buffer : array [0..255] of Char;
        szBuffer : String;
    begin
        Result := True;
        if((Windows.IsWindowVisible(HandleParam)) and
           (HandleParam <> Application.Handle))then
        begin
            Windows.GetWindowText(HandleParam, Buffer, 255);
            setlength(szBuffer, 6);
            if(szBuffer = 'Delphi')then
            begin
                frmMain.m_bDelphiIsRunning := True;
                Result := False;
            end;
        end;
    end;
var
    szPath : ShortString;
Begin
    try

        m_bDelphiIsRunning := False;
        Windows.EnumWindows(@IsItDelphi, 0);
    except
    end;
end;
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 6285972
Or alternatively,

If (FindWindow('TAppBuilder', nil)+FindWindow('TPropertyInspector', nil)+FindWindow('TAlignPalette')+FindWindow('TMenuBuilder'))=0 then.....delphi is not running.


John.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 6

Expert Comment

by:Jaymol
ID: 6286229
Or perhaps a better way would be....

function DelphiIsRunning: Boolean;
begin
  Result:=Not ((FindWindow('TAppBuilder', nil)=0) or
               (FindWindow('TPropertyInspector', nil)=0) or
               (FindWindow('TMenuBuilder', nil)=0) or
               (FindWindow('TAlignPalette', nil)=0));
end;


And just say...

  If DelphiIsRunning .......

John.
0
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
ID: 6286321
there is a little used function debughook to see if i dlephi debugging mode:

if (debughook <> 0)
Form1.Caption := 'debugging in delphi'
else
Form1.Caption := 'not debugging in delphi';



or as TAppBuilder etc also catches cbuilder etc for delphi only use also look for delphi[version no.] as in:

function DelphiRunning : 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 DelphiRunning then
 Form1.Caption := 'The Delphi Ide is Running'
 else
 Form1.Caption := 'The Delphi Ide is Not Running';
 end;
0
 
LVL 6

Expert Comment

by:edey
ID: 6287064
and components have the csDesigning State.

GL
Mike
0
 

Author Comment

by:m_r_zamani
ID: 6287417
i want know have can simulate the delphi is running?
0
 
LVL 17

Expert Comment

by:inthe
ID: 6287541
why ?
you can only simulate if you know what is going to be looked for..

ie
if you made an app using the classnames above then the above functions would think delphi was running.
0
 
LVL 1

Expert Comment

by:piscean
ID: 6288658
such as fooling a demo component (maybe raize's) that you are in debug mode???
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FMX enumerated colours 2 115
When I am typing into a TEdit last word repeats 7 145
Magic Software info 18 138
Dev Express grid collapse 2 45
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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 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