View Full Version : Don't understand a line in ELeaks.pas
MerijnB
13-Aug-2008, 07:56 AM
Inspired by this: http://news.eurekalog.com/showpost.php?p=6495&postcount=13
I decided to give a go at a request I did myself: http://news.eurekalog.com/showthread.php?t=1940
Though while searching how to do this, I came across line 1656 in ELeaks.pas:
InstallNewMemoryManager := ((not IsIntoIDE) and GetOptionsFromExeFile(LeaksOptions));
To me, this sounds like the feature I requested is hardcoded into ELeaks.pas, though I know from experience this isn't the case. What am I missing here?
Yams
13-Aug-2008, 06:05 PM
I think this one is easy :)
Here is my guess (I didn't peek in sources): IsIntoIDE is True for EL in IDE. It is not for your application. It is for integrated EL expert - it is that thingie that appears in Delphi's menu and modifies exception dialog inside Delphi.
Let's wait for admin to confirm this.
You probably want to add new option in this line...
I wonder: is it a proper way to detect running from IDE? What do you think? IFAIK there is no "magic" switch called "running from Delphi or Builder". What should you do? Should you check exe name of parent process?
Yams
13-Aug-2008, 06:35 PM
The some thought just flashed in my mind: I think that IDE part of EL should create some mark for current Delphi process. Maybe just any kernel object (mutex for example) with special constructed name:
'SomeGUIDHere_PID_Of_Delphi_Process'
Then to check if you are running from IDE you should detect PID of parent process and try to open mutex with name:
'SomeGUIDHere_PID_Of_Parent_Process'
If you are able to open this mutex (do not forget to close it immediately) then you are surely running from IDE. If not - then you are running from some other application (it may be even called 'Delphi32.exe' or 'bds.exe') or from Delphi that has not EL installed.
I think it is bulletproof solution. No chances of wrong detection.
Maybe my thoughts will be useful to you.
MerijnB
14-Aug-2008, 07:35 AM
Hi Yams,
Thanks for your thoughts. You might very well be (partly) right, in that's a way that the installed component won't active the alternative memory manager if your application isn't running (while it's just the IDE).
I hope Fabio can confirm this soon.
btw, a very good way to detect whether you're running in the IDE or not:
if DebugHook <> 0 then
ShowMessage('Running in Delphi IDE');
I'm going to give this another go.
MerijnB
14-Aug-2008, 07:39 AM
ok, I'm starting to feel dumb now :o
the function IsIntoIDE() is right below the following commented lines:
//------------------------------------------------------------------------------
// Design-Time routines...
//------------------------------------------------------------------------------
that explains...
Yams
14-Aug-2008, 10:53 AM
btw, a very good way to detect whether you're running in the IDE or not
This is nice one! I haven't know about DebugHook :)
MerijnB
14-Aug-2008, 11:46 AM
It's implemented and seems to be working. I've mailed my stuff to Fabio. Let's see what he does with it :)
admin
22-Aug-2008, 06:50 AM
Hi Yams,
I think this one is easy :)
Here is my guess (I didn't peek in sources): IsIntoIDE is True for EL in IDE. It is not for your application. It is for integrated EL expert - it is that thingie that appears in Delphi's menu and modifies exception dialog inside Delphi.
Let's wait for admin to confirm this.
Yes, it's so!
admin
22-Aug-2008, 06:54 AM
Hi Merijn,
It's implemented and seems to be working. I've mailed my stuff to Fabio. Let's see what he does with it :)
I have just received and analyzed your changes, all goods, but the problem is that new features as like will be implemented only in the next 7.0 version (I'm just working on it).
PS: I was just implemented it in the under working 7.0 version. :)
MerijnB
22-Aug-2008, 07:43 AM
Fabio, any (approx) eta on 7.x, or on how many 6.x versions will come first?
admin
27-Aug-2008, 05:06 PM
Hi Merijn,
currently not exists a definitely 7.0 road-map but I hope we'll releases it into this year! :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.