Solved

Logging all method calls

Posted on 1998-06-11
2
162 Views
Last Modified: 2011-09-20
I have a friend that asked me this question and I could come up with only one solution, but I'd be interested in hearing what other possibilities are out there.

Q: Is there any way to "trap" and then log all method calls to all objects in an application?  We're talking several hundred classes and many, many methods.  Is there any way to hook into the Delphi object model and do this?

My suggested answer was to take all the base classes and add code to the methods to log the calls and parameters of each of the methods.  This is not a desirable solution, but at the moment it is the only one we could come up with.

I'm not aware of any single point to trap method calls, except possibly in COM or CORBA objects, which these are not.  Anyone have any thoughts or a solution?
0
Comment
Question by:descikartus
[X]
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
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
pjdb earned 100 total points
ID: 1352239
Hook the OnMessage event of the Application to intercept every message send to every windows of the application. You can event put some filtering in this event toi log only some messages.
You can do the same for any form by defining a procedure asfollow
0
 
LVL 1

Expert Comment

by:pjdb
ID: 1352240
One line is missing, something has gone wrong. It should be :

procedure OnWMSysCommand(var msg: Tmessage); message wm_syscommand;

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

Suggested Solutions

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…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

756 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