Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How can I detect the Delphi IDE is running

Posted on 2003-11-05
18
Medium Priority
?
1,029 Views
Last Modified: 2010-04-05
Hi All,
   How can I detect the Delphi IDE is running when my application is running outside of IDE as Stand-Alone EXE ?
   I need the answer without using FINDWINDOW Command. Thanks
Regards,
MatrixWorld
0
Comment
Question by:matrixworld
  • 5
  • 5
  • 3
  • +3
18 Comments
 
LVL 5

Expert Comment

by:arjanh
ID: 9685719
if  (FindWindow('TApplication', nil) = 0) or
    (FindWindow('TAlignPalette', nil) = 0) or
    (FindWindow('TPropertyInspector', nil) = 0) or
    (FindWindow('TAppBuilder', nil) = 0) then
begin
  ShowMessage('Delphi is not running!');
end
0
 
LVL 5

Expert Comment

by:arjanh
ID: 9685724
Oops - strike that, I didn't read your second sentence. Sorry.
0
 
LVL 5

Expert Comment

by:arjanh
ID: 9685734
begin
  if DebugHook<>0 then
    ShowMessage('Running in Delphi IDE');
end.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:matrixworld
ID: 9685739
Hi arjanh,
   Sorry, I already mention that I need the answer without using FINDWINDOW Command. Thanks
0
 

Author Comment

by:matrixworld
ID: 9685805
Hi arjanh,
   DebugHook is not working if I running my appliction directly without calling from Delphi.
0
 
LVL 5

Expert Comment

by:arjanh
ID: 9686018
For me this does what you'd expect:

  if DebugHook=0 then
    ShowMessage('Running Standalone')
  else
    ShowMessage('Running in Delphi IDE');

But DebugHook is Platform specific. Are you running on Windows or on Linux?
0
 
LVL 17

Expert Comment

by:geobul
ID: 9686372
Hi,

Would you explain why the solution should be without using FindWindow? Alternatively you might enumerate all the running processes, get their file names and search for delphi32.exe in that list.

Regards, Geo
0
 

Author Comment

by:matrixworld
ID: 9691174
Hi Geo,

   If using the FindWindow security to control Trial Version is easy to break it (just using   Windows.RegisterClass  & CreateWindow to break it), and if using running processes to get the file names for DELPHI32.EXE more easy to break it (just create the DELPHI32.EXE), any other solution that can I use it ? Thanks for Help.

Hi Arjanh,

   Your method I try only working if I press F9 to run it can check Delphi IDE is running but I running the Application it self, it told me that the Delphi IDE is not running although Delphi IDE is running. Thanks for Help.

Regards,
MatrixWorld
0
 
LVL 6

Expert Comment

by:swift99
ID: 9691735
Check out the design interface.  This should give you some clues.
0
 

Author Comment

by:matrixworld
ID: 9691779
Hi Swift99,

   How to do it ? Please give the sample code to test it. Thanks.

0
 
LVL 5

Expert Comment

by:arjanh
ID: 9692471
MatrixWorld,

So if I got your trial app, I could use it forever if I just start my delphi32 ide on a completely different project?
I would think the best security would be to detect whether or not YOUR project is running in the IDE.... And then the DebugHook works.
0
 
LVL 3

Expert Comment

by:ThoseBug
ID: 9693459
if FindWindow('TAppBuilder', Nil) <> 0 then
  ShowMessage('Delphi or C++ Builder is runing) else
        ShowMessage('Delphi or  C++ Builder not runing);
0
 
LVL 6

Expert Comment

by:swift99
ID: 9694080
It's in your VCL source that came shipped with Delphi.
0
 

Author Comment

by:matrixworld
ID: 9698341
Hi Swift99,
   What you mean the VCL source came together with Delphi ? If I wrote my own Component or Application that able to detect Delphi IDE, how do I check the design interface ? Thanks
0
 
LVL 2

Expert Comment

by:DeNavigator
ID: 9700313
[quote]
 Your method I try only working if I press F9 to run it can check Delphi IDE is running but I running the Application it self, it told me that the Delphi IDE is not running although Delphi IDE is running. Thanks for Help.
[unquote]
But this i what you want, is it not?
0
 
LVL 6

Accepted Solution

by:
swift99 earned 120 total points
ID: 9701451
Delphi contains the source for the entire VCL, including the design interface.  Many components behave one way when working under the designer, and another way when when working under your application.  

For example, a TDatamodule has a visible window and editors when run under the IDE.  But it has no visible representation in your application.  The code for a TDatamodule is in the VCL source code.  It should have what you need to get started.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

926 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