Mega Code Archive

 
Categories / Delphi / Ide Indy
 

How to Know if you are in the IDE

Title: How to Know if you are in the IDE Question: Sometimes you want something to happen only if you are in the IDE, i.e. for debugging or evaluation purposes Answer: I looked for this all over the web and could not find it. Some people kindly posted answers on a newsgroup and I thought I would share. If debugHook0 then // you are in the IDE The above works with D5, I have not tried it in other environments. I did not need to add anything to the uses clause to get it to work, so I am not sure where it is defined. Someone else posted this tip: Lennie's Weekly Delphi Tip: Is Delphi Running? 11 January 2000 Ref. 10 Lennie De Villiers ------------------------------------------------------------------------ Please share this tip with your friends and fellow programmers. Sometimes you may want to find out weather the Delphi IDE is running. You can use the following function: function IsDelphiRunning : boolean; begin Result: := ( FindWindow('TAppBuilder', nil) 0); end; This function will return a value of TRUE if the IDE is running or FALSE, otherwise.